Localnet-to-Devnet.md #142
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
name: Anchor Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_and_test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Rust releases: https://releases.rs/ | |
rust-version: [1.75.0, 1.80.0] | |
# Node.js releases: https://nodejs.org/en/about/previous-releases | |
node-version: [18, 20] | |
# Solana releases: https://github.com/solana-labs/solana/tags | |
solana-version: [1.18.14, 1.18.22] | |
# Anchor releases: https://github.com/coral-xyz/anchor/tags | |
anchor-version: [0.30.1] # Keep ONLY ONE version. | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust-version }} | |
profile: minimal | |
override: true | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Solana | |
run: | | |
sh -c "$(curl -sSfL https://release.solana.com/v${{ matrix.solana-version }}/install)" | |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
solana --version || echo "Solana version not found" | |
- name: Generate Solana Keypair | |
run: | | |
mkdir -p ~/.config/solana | |
solana-keygen new --outfile ~/.config/solana/id.json --no-bip39-passphrase --force | |
solana config set --keypair ~/.config/solana/id.json | |
- name: Install Anchor | |
run: | | |
cargo install --git https://github.com/coral-xyz/anchor anchor-cli --tag v${{ matrix.anchor-version }} || echo "Anchor installation failed" | |
anchor --version || echo "Anchor version not found" | |
- name: Debug Environment | |
run: | | |
echo "Current directory: $(pwd)" | |
echo "PATH: $PATH" | |
echo "Rust version: $(rustc --version)" | |
echo "Cargo version: $(cargo --version)" | |
echo "Solana version: $(solana --version)" | |
echo "Anchor version: $(anchor --version)" | |
echo "Node.js version: $(node --version)" | |
- name: Install NPM Dependencies | |
run: npm install | |
- name: Build Anchor Program | |
run: anchor build | |
- name: Run Anchor Tests | |
run: anchor test | |