README.md #70
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] | |
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/v1.18.22/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 v0.30.1 || echo "Anchor installation failed" | |
anchor --version || echo "Anchor version not found" | |
- name: Debug Project Structure | |
run: | | |
echo "Current directory: $(pwd)" | |
echo "PATH: $PATH" | |
echo "Directory structure:" | |
tree -L 3 || ls -R | |
- name: Debug Environment | |
run: | | |
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 | |