123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- name: Tests
- on:
- push:
- branches:
- - master
- pull_request:
- branches:
- - master
- env:
- SOLANA_CLI_VERSION: 1.8.5
- NODE_VERSION: 17.0.1
- jobs:
- test-core:
- name: Core Tests
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - uses: ./.github/actions/setup/
- - uses: actions/setup-node@v2
- with:
- node-version: ${{ env.NODE_VERSION }}
- - uses: actions/cache@v2
- name: Cache Cargo registry + index
- id: cache-cargo-build
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- ./target/
- key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- - run: cargo build
- - run: cargo fmt -- --check
- - run: cargo clippy --all-targets -- -D warnings
- - run: rustup toolchain install nightly --profile minimal --component clippy
- - run: cargo +nightly clippy --all-targets -- -D warnings
- - run: cargo test
- - run: cd ts && yarn
- - run: cd ts && yarn test
- - run: cd ts && yarn lint
- - run: cd examples/tutorial && yarn
- - run: cd examples/tutorial && yarn lint
- - run: cd tests && yarn
- - run: cd tests && yarn lint
- setup-anchor-cli:
- name: Setup Anchor cli
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - uses: ./.github/actions/setup/
- - uses: actions/cache@v2
- name: Cache Cargo registry + index
- id: cache-anchor
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- ./target/
- key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- - run: cargo install --path cli anchor-cli --locked --force
- - uses: actions/upload-artifact@v2
- with:
- name: anchor-binary
- path: ~/.cargo/bin/anchor
- test-examples:
- needs: setup-anchor-cli
- name: Examples Test
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - uses: actions/download-artifact@v2
- with:
- name: anchor-binary
- path: ~/.cargo/bin/
- - run: chmod +rwx ~/.cargo/bin/anchor
- - uses: ./.github/actions/setup/
- - uses: ./.github/actions/setup-solana/
- - uses: ./.github/actions/setup-ts/
- - uses: actions/cache@v2
- name: basic-0 cache
- id: cache-basic-0
- with:
- path: ./examples/tutorial/basic-0/target
- key: cargo-${{ runner.os }}-${{ hashFiles('./examples/tutorial/basic-0/**/Cargo.toml') }}
- - uses: actions/cache@v2
- name: basic-1 cache
- id: cache-basic-1
- with:
- path: ./examples/tutorial/basic-1/target
- key: cargo-${{ runner.os }}-${{ hashFiles('./examples/tutorial/basic-1/**/Cargo.toml') }}
- - uses: actions/cache@v2
- name: basic-2 cache
- id: cache-basic-2
- with:
- path: ./examples/tutorial/basic-2/target
- key: cargo-${{ runner.os }}-${{ hashFiles('./examples/tutorial/basic-2/**/Cargo.toml') }}
- - uses: actions/cache@v2
- name: basic-3 cache
- id: cache-basic-3
- with:
- path: ./examples/tutorial/basic-3/target
- key: cargo-${{ runner.os }}-${{ hashFiles('./examples/tutorial/basic-3/**/Cargo.toml') }}
- - uses: actions/cache@v2
- name: basic-4 cache
- id: cache-basic-4
- with:
- path: ./examples/tutorial/basic-4/target
- key: cargo-${{ runner.os }}-${{ hashFiles('./examples/tutorial/basic-4/**/Cargo.toml') }}
- - run: cd examples/tutorial && yarn workspaces run test
- setup-client-example:
- needs: setup-anchor-cli
- name: Setup Client Example Test
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- strategy:
- fail-fast: false
- matrix:
- node:
- - path: tests/events/
- name: events.so
- - path: examples/tutorial/basic-4/
- name: basic_4.so
- - path: examples/tutorial/basic-2/
- name: basic_2.so
- - path: tests/composite/
- name: composite.so
- steps:
- - uses: actions/checkout@v2
- - uses: ./.github/actions/setup/
- - uses: ./.github/actions/setup-solana/
- - uses: actions/download-artifact@v2
- with:
- name: anchor-binary
- path: ~/.cargo/bin/
- - run: chmod +rwx ~/.cargo/bin/anchor
- - run: cd ${{ matrix.node.path }} && anchor build --skip-lint
- - uses: actions/upload-artifact@v2
- with:
- name: ${{ matrix.node.name }}
- path: ${{ matrix.node.path }}target/deploy/${{ matrix.node.name }}
- test-client-example:
- needs: setup-client-example
- name: Client Example Test
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - uses: ./.github/actions/setup/
- - uses: ./.github/actions/setup-ts/
- - uses: actions/download-artifact@v2
- with:
- name: anchor-binary
- path: ~/.cargo/bin/
- - uses: actions/download-artifact@v2
- with:
- name: events.so
- path: tests/events/target/deploy/
- - uses: actions/download-artifact@v2
- with:
- name: basic_4.so
- path: examples/tutorial/basic-4/target/deploy/
- - uses: actions/download-artifact@v2
- with:
- name: basic_2.so
- path: examples/tutorial/basic-2/target/deploy/
- - uses: actions/download-artifact@v2
- with:
- name: composite.so
- path: tests/composite/target/deploy/
- - uses: actions/cache@v2
- name: Cache client/example target
- id: cache-test-target
- with:
- path: client/example/target
- key: cargo-${{ runner.os }}-client/example-${{ env.ANCHOR_VERSION }}
- - uses: ./.github/actions/setup-solana/
- - run: cd client/example && ./run-test.sh
- test-bpf-upgradeable-state:
- needs: setup-anchor-cli
- name: Test tests/bpf-upgradeable-state
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - uses: ./.github/actions/setup/
- - uses: ./.github/actions/setup-ts/
- - uses: ./.github/actions/setup-solana/
- - uses: actions/cache@v2
- name: Cache Cargo registry + index
- id: cache-anchor
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- ./target/
- key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- - uses: actions/download-artifact@v2
- with:
- name: anchor-binary
- path: ~/.cargo/bin/
- - uses: actions/cache@v2
- name: Cache tests/bpf-upgradeable-state target
- id: cache-test-target
- with:
- path: tests/bpf-upgradeable-state/target
- key: cargo-${{ runner.os }}-tests/bpf-upgradeable-state-${{ env.ANCHOR_VERSION }}
- - run: solana-test-validator -r --quiet &
- name: start validator
- - run: cd tests/bpf-upgradeable-state && yarn
- - run: cd tests/bpf-upgradeable-state && yarn link @project-serum/anchor
- - run: cd tests/bpf-upgradeable-state && anchor build --skip-lint
- - run: cd tests/bpf-upgradeable-state && solana program deploy --program-id program_with_different_programdata.json target/deploy/bpf_upgradeable_state.so
- - run: cd tests/bpf-upgradeable-state && cp bpf_upgradeable_state-keypair.json target/deploy/bpf_upgradeable_state-keypair.json && anchor deploy && anchor test --skip-deploy --skip-build --skip-lint
- test-programs:
- needs: setup-anchor-cli
- name: Test ${{ matrix.node.path }}
- runs-on: ubuntu-18.04
- timeout-minutes: 30
- strategy:
- fail-fast: false
- matrix:
- node:
- - cmd: cd tests/sysvars && anchor test --skip-lint
- path: tests/sysvars
- - cmd: cd tests/composite && anchor test --skip-lint
- path: tests/composite
- - cmd: cd tests/errors && anchor test --skip-lint
- path: tests/errors
- - cmd: cd tests/spl/token-proxy && anchor test --skip-lint
- path: spl/token-proxy
- - cmd: cd tests/multisig && anchor test --skip-lint
- path: tests/multisig
- - cmd: cd tests/interface && anchor test --skip-lint
- path: tests/interface
- - cmd: cd tests/lockup && anchor test --skip-lint
- path: tests/lockup
- - cmd: cd tests/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test --skip-lint
- path: tests/swap
- - cmd: cd tests/escrow && anchor test --skip-lint
- path: tests/escrow
- - cmd: cd tests/pyth && anchor test --skip-lint
- path: tests/pyth
- - cmd: cd tests/system-accounts && anchor test --skip-lint
- path: tests/system-accounts
- - cmd: cd tests/misc && anchor test --skip-lint
- path: tests/misc
- - cmd: cd tests/events && anchor test --skip-lint
- path: tests/events
- - cmd: cd tests/cashiers-check && anchor test --skip-lint
- path: tests/cashiers-check
- - cmd: cd tests/declare-id && anchor test --skip-lint
- path: tests/declare-id
- - cmd: cd tests/typescript && anchor test --skip-lint
- path: tests/typescript
- - cmd: cd tests/zero-copy && anchor test --skip-lint && cd programs/zero-copy && cargo test-bpf
- path: tests/zero-copy
- - cmd: cd tests/chat && anchor test --skip-lint
- path: tests/chat
- - cmd: cd tests/ido-pool && anchor test --skip-lint
- path: tests/ido-pool
- - cmd: cd tests/cfo && anchor run test-with-build
- path: tests/cfo
- - cmd: cd tests/auction-house && yarn && anchor test --skip-lint
- path: tests/auction-house
- - cmd: cd tests/floats && yarn && anchor test --skip-lint
- path: tests/floats
- - cmd: cd tests/safety-checks && ./test.sh
- path: tests/safety-checks
- steps:
- - uses: actions/checkout@v2
- - uses: ./.github/actions/setup/
- - uses: ./.github/actions/setup-ts/
- - uses: ./.github/actions/setup-solana/
- - uses: actions/cache@v2
- name: Cache Cargo registry + index
- id: cache-anchor
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- ./target/
- key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- - uses: actions/download-artifact@v2
- with:
- name: anchor-binary
- path: ~/.cargo/bin/
- - uses: actions/cache@v2
- name: Cache ${{ matrix.node.path }} target
- id: cache-test-target
- with:
- path: ${{ matrix.node.path }}/target
- key: cargo-${{ runner.os }}-${{ matrix.node.path }}-${{ env.ANCHOR_VERSION }}
- - run: ${{ matrix.node.cmd }}
- name: ${{ matrix.node.path }} program test
|