66 branches :
77 - main
88 - dev
9+
10+ defaults :
11+ run :
12+ working-directory : ./solana
13+
914jobs :
1015 solana-sbf :
1116 name : Solana Cargo SBF
@@ -18,13 +23,13 @@ jobs:
1823 - name : Get rust toolchain version
1924 id : toolchain
2025 run : |
21- RUST_VERSION="$(awk '/channel =/ { print substr($3, 2, length($3)-2) }' solana/ rust-toolchain)"
26+ RUST_VERSION="$(awk '/channel =/ { print substr($3, 2, length($3)-2) }' rust-toolchain)"
2227 echo "::set-output name=version::${RUST_VERSION}"
2328
2429 - name : Get solana version
2530 id : solana
2631 run : |
27- SOLANA_VERSION="$(awk '/solana-program =/ { print substr($3, 3, length($3)-3) }' solana/ Cargo.toml)"
32+ SOLANA_VERSION="$(awk '/solana-program =/ { print substr($3, 3, length($3)-3) }' Cargo.toml)"
2833 echo "::set-output name=version::${SOLANA_VERSION}"
2934
3035 - name : Cache rust toolchain
@@ -47,30 +52,19 @@ jobs:
4752 toolchain : ${{ steps.toolchain.outputs.version }}
4853 components : " clippy,rustfmt"
4954
50- - name : Cache rust packages / build cache
51- uses : actions/cache@v3
52- env :
53- cache-name : solana-rust-packages
55+ - name : Cache Cargo dependencies
56+ uses : Swatinem/rust-cache@v2
5457 with :
55- path : |
56- ~/.cargo/bin
57- ~/.cargo/registry
58- ~/.cargo/git/db
59- solana/target
60- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('solana/Cargo.lock') }}
61- restore-keys : |
62- ${{ runner.os }}-build-${{ env.cache-name }}-
63- ${{ runner.os }}-build-
64- ${{ runner.os }}-
58+ workspaces : " solana"
6559
6660 - name : Run `cargo fmt`
67- run : cargo fmt --check --all --manifest-path solana/ Cargo.toml
61+ run : cargo fmt --check --all --manifest-path Cargo.toml
6862
6963 - name : Run `cargo check`
70- run : cargo check --workspace --tests --manifest-path solana/ Cargo.toml
64+ run : cargo check --workspace --tests --manifest-path Cargo.toml
7165
7266 - name : Run `cargo clippy`
73- run : cargo clippy --workspace --tests --manifest-path solana/ Cargo.toml
67+ run : cargo clippy --workspace --tests --manifest-path Cargo.toml
7468
7569 - name : Cache solana tools
7670 id : cache-solana
9589 env :
9690 RUST_BACKTRACE : " 1"
9791 run : |
98- cd solana
9992 export BPF_OUT_DIR="$(pwd)/target/deploy"
10093 export PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}"
10194
@@ -107,13 +100,37 @@ jobs:
107100 anchor-test :
108101 name : Anchor Test
109102 runs-on : ubuntu-latest
110- # Anchor Docker image: https://www.anchor-lang.com/docs/verifiable-builds#images
111- container : backpackapp/build:v0.29.0
112103 steps :
113104 - uses : actions/checkout@v4
114- - name : Set default Rust toolchain
115- run : rustup default stable
116- working-directory : ./solana
117- - name : anchor test --arch sbf
118- run : make anchor-test
119- working-directory : ./solana
105+ - uses : metadaoproject/setup-anchor@v2
106+ with :
107+ node-version : ' 20.11.0'
108+ solana-cli-version : ' 1.18.10'
109+ anchor-version : ' 0.29.0'
110+ - name : Cache node_modules
111+ uses : actions/cache@v3
112+ with :
113+ path : ./solana/node_modules/
114+ key : node-modules-${{ runner.os }}-build-${{ inputs.node-version }}
115+ - name : Install node_modules
116+ run : make node_modules
117+ shell : bash
118+ - name : Create keypair
119+ run : solana-keygen new --no-bip39-passphrase
120+ shell : bash
121+ - name : Make Anchor.toml compatible with runner
122+ run : sed -i 's:/user/:/runner/:' Anchor.toml
123+ shell : bash
124+ - name : Install Cargo toolchain
125+ uses : actions-rs/toolchain@v1
126+ with :
127+ toolchain : stable
128+ profile : minimal
129+ components : rustc
130+ - name : Cache Cargo dependencies
131+ uses : Swatinem/rust-cache@v2
132+ with :
133+ workspaces : " solana"
134+ - name : Run tests
135+ run : anchor test
136+ shell : bash
0 commit comments