Chore: Use reusable workflows for GitHub actions (#2345)

* reusable workflows

* fix name

* fix syntax

* fix syntax again

* update install solana

* rename stuff

* fix naming

* Update test names once more
This commit is contained in:
Sammy Harris 2023-01-03 10:25:32 -06:00 committed by GitHub
parent a97d04ab06
commit d055c89ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 189 additions and 461 deletions

View File

@ -12,6 +12,7 @@ runs:
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_CLI_VERSION }}
- uses: nick-fields/retry@v2
if: steps.cache-solana.outputs.cache-hit != 'true'
with:
retry_wait_seconds: 300
timeout_minutes: 2
@ -19,8 +20,6 @@ runs:
retry_on: error
shell: bash
command: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_CLI_VERSION }}/install)"
- run: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_CLI_VERSION }}/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

17
.github/workflows/no-caching-tests.yaml vendored Normal file
View File

@ -0,0 +1,17 @@
name: No Caching Tests
on:
push:
branches:
- master
jobs:
no-caching-tests:
name: Reusable
uses: ./.github/workflows/reusable-tests.yaml
with:
cache: false
solana_cli_version: 1.14.11
node_version: 17.0.1
cargo_profile: release
anchor_binary_name: anchor-binary-no-caching

View File

@ -1,12 +1,35 @@
name: No Cashing Tests
name: Reusable Tests
on:
push:
branches:
- master
workflow_call:
inputs:
cache:
required: true
type: boolean
solana_cli_version:
required: true
type: string
node_version:
required: true
type: string
cargo_profile:
required: true
type: string
anchor_binary_name:
required: true
type: string
env:
SOLANA_CLI_VERSION: 1.14.11
NODE_VERSION: 17.0.1
CACHE: inputs.cache
SOLANA_CLI_VERSION: ${{ inputs.solana_cli_version }}
NODE_VERSION: ${{ inputs.node_version }}
CARGO_PROFILE: ${{ inputs.cargo_profile }}
ANCHOR_BINARY_NAME: ${{ inputs.anchor_binary_name }}
CARGO_CACHE_PATH: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./target/
jobs:
test-core:
@ -19,6 +42,13 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
name: Cache Cargo registry + index
id: cache-cargo-build
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- run: cargo build
- run: cargo fmt -- --check
- run: cargo clippy --all-targets -- -D warnings
@ -43,12 +73,23 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
name: Cache Cargo registry + index
id: cache-anchor
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ runner.os }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- run: cargo install --path cli anchor-cli --locked --force --debug
if: env.CARGO_PROFILE == 'debug'
- run: cargo install --path cli anchor-cli --locked --force
if: env.CARGO_PROFILE != 'debug'
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/upload-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
path: ~/.cargo/bin/anchor
- uses: ./.github/actions/git-diff/
@ -62,13 +103,54 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
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@v3
if: ${{ env.CACHE != 'false' }}
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- run: cd examples/tutorial && yarn workspaces run test
- uses: ./.github/actions/git-diff/
@ -98,7 +180,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
path: ~/.cargo/bin/
- run: chmod +rwx ~/.cargo/bin/anchor
@ -121,7 +203,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
@ -145,6 +227,13 @@ jobs:
with:
name: composite.so
path: tests/composite/target/deploy/
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
name: Cache client/example target
id: cache-test-target
with:
path: client/example/target
key: cargo-${{ runner.os }}-client/example-${{ env.ANCHOR_VERSION }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: ./.github/actions/setup-solana/
- run: cd client/example && ./run-test.sh
- uses: ./.github/actions/git-diff/
@ -160,12 +249,28 @@ jobs:
- uses: ./.github/actions/setup-ts/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
name: Cache Cargo registry + index
id: cache-anchor
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ runner.os }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/download-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
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 }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- run: solana-test-validator -r --quiet &
name: start validator
- run: cd tests/bpf-upgradeable-state && yarn --frozen-lockfile
@ -190,6 +295,14 @@ jobs:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/setup/
# - uses: ./.github/actions/setup-ts/
# - uses: actions/cache@v3
# name: Cache Solana Tool Suite
# id: cache-solana
# with:
# path: |
# ~/.cache/solana/
# ~/.local/share/solana/
# key: solana-${{ runner.os }}-v0000-1.8.14
# # using an outdated validator but that
# # is ok as long as the test doesn't
# # include newer incompatible features
@ -203,10 +316,17 @@ jobs:
# shell: bash
# - uses: actions/download-artifact@v3
# with:
# name: anchor-binary-no-caching
# name: ${{ env.ANCHOR_BINARY_NAME }}
# path: ~/.cargo/bin/
# - run: chmod +x ~/.cargo/bin/anchor
# - uses: actions/cache@v3
# name: Cache tests/misc target
# id: cache-test-target
# with:
# path: tests/misc/target
# key: cargo-${{ runner.os }}-tests/misc-${{ env.ANCHOR_VERSION }}-1.8.14-${{ hashFiles('**/Cargo.lock') }}
# - run: cd tests/misc && yarn --frozen-lockfile
# - run: cd tests/misc
# - run: cd tests/misc && chmod +x ci.sh && ./ci.sh
@ -223,9 +343,17 @@ jobs:
- uses: ./.github/actions/setup-ts/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
name: Cache Cargo registry + index
id: cache-anchor
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ runner.os }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/download-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
@ -259,6 +387,8 @@ jobs:
path: tests/escrow
- cmd: cd tests/pyth && anchor test --skip-lint && npx tsc --noEmit
path: tests/pyth
- cmd: cd tests/realloc && anchor test --skip-lint && npx tsc --noEmit
path: tests/realloc
- cmd: cd tests/system-accounts && anchor test --skip-lint
path: tests/system-accounts
- cmd: cd tests/misc && anchor test --skip-lint && npx tsc --noEmit
@ -293,10 +423,10 @@ jobs:
path: tests/cpi-returns
- cmd: cd tests/multiple-suites && anchor test --skip-lint && npx tsc --noEmit
path: tests/multiple-suites
- cmd: cd tests/optional && anchor test --skip-lint && npx tsc --noEmit
path: tests/optional
- cmd: cd tests/multiple-suites-run-single && anchor test --skip-lint --run tests/should-run && npx tsc --noEmit
path: tests/multiple-suites-run-single
- cmd: cd tests/optional && anchor test --skip-lint && npx tsc --noEmit
path: tests/optional
- cmd: cd tests/pda-derivation && anchor test --skip-lint && npx tsc --noEmit
path: tests/pda-derivation
- cmd: cd tests/relations-derivation && anchor test --skip-lint && npx tsc --noEmit
@ -311,12 +441,28 @@ jobs:
- uses: ./.github/actions/setup-ts/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
name: Cache Cargo registry + index
id: cache-anchor
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ runner.os }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/download-artifact@v3
with:
name: anchor-binary-no-caching
name: ${{ env.ANCHOR_BINARY_NAME }}
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/cache@v3
if: ${{ env.CACHE != 'false' }}
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 }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- run: ${{ matrix.node.cmd }}
name: ${{ matrix.node.path }} program test

View File

@ -7,448 +7,14 @@ on:
pull_request:
branches:
- master
env:
SOLANA_CLI_VERSION: 1.14.11
NODE_VERSION: 17.0.1
CARGO_PROFILE: debug
jobs:
test-core:
name: Core Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v3
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: 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/packages/borsh && yarn --frozen-lockfile && yarn build
- run: cd ts/packages/anchor && yarn --frozen-lockfile
- run: cd ts/packages/anchor && yarn test
- run: cd ts/packages/anchor && 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-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: actions/cache@v3
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 }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- run: cargo install --path cli anchor-cli --locked --force --debug
if: env.CARGO_PROFILE == 'debug'
- run: cargo install --path cli anchor-cli --locked --force
if: env.CARGO_PROFILE != 'debug'
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/upload-artifact@v3
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-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
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@v3
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
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') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- 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-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node:
- path: tests/optional/
name: optional.so
- 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@v3
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-solana/
- uses: actions/download-artifact@v3
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@v3
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-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-ts/
- uses: actions/download-artifact@v3
with:
name: anchor-binary
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/download-artifact@v3
with:
name: optional.so
path: tests/optional/target/deploy/
- uses: actions/download-artifact@v2
with:
name: events.so
path: tests/events/target/deploy/
- uses: actions/download-artifact@v3
with:
name: basic_4.so
path: examples/tutorial/basic-4/target/deploy/
- uses: actions/download-artifact@v3
with:
name: basic_2.so
path: examples/tutorial/basic-2/target/deploy/
- uses: actions/download-artifact@v3
with:
name: composite.so
path: tests/composite/target/deploy/
- uses: actions/cache@v3
name: Cache client/example target
id: cache-test-target
with:
path: client/example/target
key: cargo-${{ runner.os }}-client/example-${{ env.ANCHOR_VERSION }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- 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-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-ts/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v3
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 }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/download-artifact@v3
with:
name: anchor-binary
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/cache@v3
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 }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- run: solana-test-validator -r --quiet &
name: start validator
- run: cd tests/bpf-upgradeable-state && yarn --frozen-lockfile
- run: cd tests/bpf-upgradeable-state
- 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
- run: cd tests/bpf-upgradeable-state && npx tsc --noEmit
- 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-latest
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/setup/
# - uses: ./.github/actions/setup-ts/
# - uses: actions/cache@v3
# name: Cache Solana Tool Suite
# id: cache-solana
# with:
# path: |
# ~/.cache/solana/
# ~/.local/share/solana/
# key: solana-${{ runner.os }}-v0000-1.8.14
# # 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@v3
# with:
# name: anchor-binary
# path: ~/.cargo/bin/
# - run: chmod +x ~/.cargo/bin/anchor
# - uses: actions/cache@v3
# name: Cache tests/misc target
# id: cache-test-target
# with:
# path: tests/misc/target
# key: cargo-${{ runner.os }}-tests/misc-${{ env.ANCHOR_VERSION }}-1.8.14-${{ hashFiles('**/Cargo.lock') }}
# - run: cd tests/misc && yarn --frozen-lockfile
# - run: cd tests/misc
# - 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-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-ts/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v3
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 }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/download-artifact@v3
with:
name: anchor-binary
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
- run: cd "$(mktemp -d)" && anchor init hello-anchor && cd hello-anchor && yarn link @coral-xyz/anchor && yarn && anchor test && yarn lint:fix
- uses: ./.github/actions/git-diff/
test-programs:
needs: setup-anchor-cli
name: Test ${{ matrix.node.path }}
runs-on: ubuntu-latest
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 && npx tsc --noEmit
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/lockup && anchor test --skip-lint
# path: tests/lockup
- cmd: cd tests/swap/deps/openbook-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint
path: tests/swap
- cmd: cd tests/escrow && anchor test --skip-lint && npx tsc --noEmit
path: tests/escrow
- cmd: cd tests/pyth && anchor test --skip-lint && npx tsc --noEmit
path: tests/pyth
- cmd: cd tests/realloc && anchor test --skip-lint && npx tsc --noEmit
path: tests/realloc
- cmd: cd tests/system-accounts && anchor test --skip-lint
path: tests/system-accounts
- cmd: cd tests/misc && anchor test --skip-lint && npx tsc --noEmit
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 && npx tsc --noEmit
path: tests/declare-id
- cmd: cd tests/typescript && anchor test --skip-lint && npx tsc --noEmit
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 && npx tsc --noEmit
path: tests/floats
- cmd: cd tests/safety-checks && anchor run test
path: tests/safety-checks
- cmd: cd tests/custom-coder && anchor test --skip-lint && npx tsc --noEmit
path: tests/custom-coder
- cmd: cd tests/validator-clone && anchor test --skip-lint && npx tsc --noEmit
path: tests/validator-clone
- cmd: cd tests/cpi-returns && anchor test --skip-lint && npx tsc --noEmit
path: tests/cpi-returns
- cmd: cd tests/multiple-suites && anchor test --skip-lint && npx tsc --noEmit
path: tests/multiple-suites
- cmd: cd tests/multiple-suites-run-single && anchor test --skip-lint --run tests/should-run && npx tsc --noEmit
path: tests/multiple-suites-run-single
- cmd: cd tests/optional && anchor test --skip-lint && npx tsc --noEmit
path: tests/optional
- cmd: cd tests/pda-derivation && anchor test --skip-lint && npx tsc --noEmit
path: tests/pda-derivation
- cmd: cd tests/relations-derivation && anchor test --skip-lint && npx tsc --noEmit
path: tests/relations-derivation
- cmd: cd tests/anchor-cli-idl && ./test.sh
path: tests/anchor-cli-idl
- cmd: cd tests/anchor-cli-account && anchor test --skip-lint
path: tests/anchor-cli-account
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-ts/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v3
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 }}-${{ env.CARGO_PROFILE }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/download-artifact@v3
with:
name: anchor-binary
path: ~/.cargo/bin/
- run: chmod +x ~/.cargo/bin/anchor
- uses: actions/cache@v3
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 }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- run: ${{ matrix.node.cmd }}
name: ${{ matrix.node.path }} program test
- uses: ./.github/actions/git-diff/
tests:
name: Reusable
uses: ./.github/workflows/reusable-tests.yaml
with:
cache: true
solana_cli_version: 1.14.11
node_version: 17.0.1
cargo_profile: debug
anchor_binary_name: anchor-binary