From 28cf541cdfc3191d4b43cf7f2cad703173d09cc4 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 12 Apr 2022 15:48:30 -0400 Subject: [PATCH] ci: add manually triggerable ci test that uses no caching (#1773) --- .github/workflows/no-cashing-tests.yaml | 296 ++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 .github/workflows/no-cashing-tests.yaml diff --git a/.github/workflows/no-cashing-tests.yaml b/.github/workflows/no-cashing-tests.yaml new file mode 100644 index 000000000..273fa21c5 --- /dev/null +++ b/.github/workflows/no-cashing-tests.yaml @@ -0,0 +1,296 @@ +name: No Cashing Tests + +on: + push: + branches: + - master +env: + SOLANA_CLI_VERSION: 1.9.13 + 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 }} + - run: cargo build + - run: cargo fmt -- --check + - run: cargo clippy --all-targets -- -D warnings + - run: cargo test + # using singlethreaded testing for avm so that tests that change files do not conflict with each other + - run: cd avm && cargo fmt -- --check && cargo clippy --all-targets -- -D warnings && cargo test -- --test-threads=1 + - run: cd ts && yarn --frozen-lockfile + - run: cd ts && yarn test + - run: cd ts && yarn lint + - run: cd examples/tutorial && yarn --frozen-lockfile + - run: cd examples/tutorial && yarn lint + - run: cd tests && yarn --frozen-lockfile + - run: cd tests && yarn lint + - uses: ./.github/actions/git-diff/ + + setup-anchor-cli: + name: Setup Anchor cli + runs-on: ubuntu-18.04 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup/ + + - run: cargo install --path cli anchor-cli --locked --force + - uses: actions/upload-artifact@v2 + with: + name: anchor-binary + path: ~/.cargo/bin/anchor + + - uses: ./.github/actions/git-diff/ + + 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/ + - run: cd examples/tutorial && yarn workspaces run test + - uses: ./.github/actions/git-diff/ + + 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 }} + - uses: ./.github/actions/git-diff/ + + 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: ./.github/actions/setup-solana/ + - run: cd client/example && ./run-test.sh + - uses: ./.github/actions/git-diff/ + + 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/download-artifact@v2 + with: + name: anchor-binary + path: ~/.cargo/bin/ + + - run: solana-test-validator -r --quiet & + name: start validator + - run: cd tests/bpf-upgradeable-state && yarn --frozen-lockfile + - 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 test --skip-local-validator --skip-build --skip-lint + - uses: ./.github/actions/git-diff/ + + # this test exists to make sure that anchor + # checks rent correctly for legacy accounts + # that don't have to be rent-exempt + test-misc-non-rent-exempt: + # the anchor cli is built with a different solana version + # but that's fine since it's just the cli + needs: setup-anchor-cli + name: Test tests/misc/nonRentExempt + runs-on: ubuntu-18.04 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup/ + - uses: ./.github/actions/setup-ts/ + # using an outdated validator but that + # is ok as long as the test doesn't + # include newer incompatible features + - run: sh -c "$(curl -sSfL https://release.solana.com/v1.8.14/install)" + shell: bash + - run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + shell: bash + - run: solana-keygen new --no-bip39-passphrase + shell: bash + - run: solana config set --url localhost + shell: bash + - uses: actions/download-artifact@v2 + with: + name: anchor-binary + path: ~/.cargo/bin/ + - run: chmod +x ~/.cargo/bin/anchor + + - run: cd tests/misc && yarn --frozen-lockfile + - run: cd tests/misc && yarn link @project-serum/anchor + - run: cd tests/misc && chmod +x ci.sh && ./ci.sh + - run: cd tests/misc && anchor test --skip-lint + + test-anchor-init: + needs: setup-anchor-cli + name: Test Anchor Init + 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/download-artifact@v2 + with: + name: anchor-binary + path: ~/.cargo/bin/ + + - run: cd "$(mktemp -d)" && anchor init hello-anchor && cd hello-anchor && yarn link @project-serum/anchor && anchor test && yarn lint:fix + - uses: ./.github/actions/git-diff/ + + 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 -- --locked && 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 && cd deps/stake && git checkout Cargo.lock && cd ../swap && git checkout Cargo.lock + path: tests/cfo + - cmd: cd tests/auction-house && yarn --frozen-lockfile && anchor test --skip-lint && git checkout Cargo.lock + path: tests/auction-house + - cmd: cd tests/floats && yarn --frozen-lockfile && anchor test --skip-lint + path: tests/floats + - cmd: cd tests/safety-checks && ./test.sh + path: tests/safety-checks + - cmd: cd tests/custom-coder && anchor test --skip-lint + path: tests/custom-coder + - cmd: cd tests/validator-clone && yarn --frozen-lockfile && anchor test --skip-lint + path: tests/validator-clone + - cmd: cd tests/cpi-returns && anchor test --skip-lint + path: tests/cpi-returns + - cmd: cd tests/multiple-suites && anchor test --skip-lint + path: tests/multiple-suites + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup/ + - uses: ./.github/actions/setup-ts/ + - uses: ./.github/actions/setup-solana/ + + - uses: actions/download-artifact@v2 + with: + name: anchor-binary + path: ~/.cargo/bin/ + + - run: ${{ matrix.node.cmd }} + name: ${{ matrix.node.path }} program test + + - uses: ./.github/actions/git-diff/