-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
113 additions
and
2,299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
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}" | ||
- name: Cache rust toolchain | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: solana-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 | ||
|
||
- name: Cache solana tools | ||
id: cache-solana | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: solana-tools | ||
with: | ||
path: | | ||
~/.local/share/solana/install/ | ||
~/.cache/solana/ | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.solana.outputs.version }} | ||
|
||
- if: ${{ steps.cache-solana.outputs.cache-hit != 'true' }} | ||
name: Install solana tools | ||
env: | ||
SOLANA_VERSION: ${{ steps.solana.outputs.version }} | ||
run: | | ||
sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_VERSION}/install)" | ||
- name: Cache anchor cli | ||
id: cache-anchor | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: anchor-cli | ||
with: | ||
path: | | ||
~/.cargo/bin/anchor | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.anchor.outputs.version }} | ||
|
||
- if: ${{ steps.cache-anchor.outputs.cache-hit != 'true' }} | ||
name: Install anchor cli | ||
run: cargo install --git https://github.com/coral-xyz/anchor --tag v${{ steps.anchor.outputs.version }} anchor-cli --locked --force | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "yarn" | ||
- run: yarn | ||
|
||
- run: | | ||
source ~/.cargo/env | ||
anchor test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
[toolchain] | ||
anchor_version = "0.29.0" | ||
solana_version = "1.18.1" | ||
|
||
[features] | ||
seeds = false | ||
|
Oops, something went wrong.