Skip to content

enable ci

enable ci #52

Workflow file for this run

name: test
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
test:
name: Anchor Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get rust toolchain version
id: toolchain
run: |
RUST_VERSION="$(awk '/channel =/ { print substr($3, 2, length($3)-2) }' rust-toolchain.toml)"
echo "::set-output name=version::${RUST_VERSION}"
- name: Get solana version
id: solana
run: |
SOLANA_VERSION="$(awk '/solana_version =/ { print substr($3, 2, length($3)-2) }' Anchor.toml)"
echo "::set-output name=version::${SOLANA_VERSION}"
- name: Get solana version
id: anchor
run: |
ANCHOR_VERSION="$(awk '/anchor_version =/ { print substr($3, 2, length($3)-2) }' Anchor.toml)"
echo "::set-output name=version::${ANCHOR_VERSION}"
- uses: metadaoproject/anchor-test@c47c46486d1a62b0b22419163d7f7bfae570c390
with:
anchor-version: "${{steps.anchor.outputs.version}}"
solana-cli-version: "${{steps.solana.outputs.version}}"
- name: Cache rust toolchain
uses: actions/cache@v3
env:
cache-name: rust-toolchain
with:
path: |
~/.cargo/bin
~/.cargo/env
~/.rustup
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.toolchain.outputs.version }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
with:
toolchain: ${{ steps.toolchain.outputs.version }}
components: "clippy,rustfmt"
- name: Cache rust packages / build cache
uses: actions/cache@v3
env:
cache-name: solana-rust-packages
with:
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git/db
target
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: cargo fmt --check --all
- run: cargo clippy
- run: cargo --list
- run: anchor build
# - uses: actions/setup-node@v4
# with:
# node-version: "20"
# cache: "yarn"
# - run: yarn
# - run: anchor test --skip-build