Update .github/workflows/tests.yml #19
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 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- 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: Set solana target cluster to local | |
# run: solana config set --url http:localhost:8899 | |
- 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 "Directory structure:" | |
tree -L 3 || ls -R | |
echo "Anchor.toml content:" | |
cat Anchor.toml || echo "Anchor.toml not found" | |
echo "Cargo.toml content:" | |
cat Cargo.toml || echo "Cargo.toml not found" | |
echo "Program Cargo.toml content:" | |
cat programs/*/Cargo.toml || echo "Program Cargo.toml not found" | |
- name: Debug Environment | |
run: | | |
echo "Current directory: $(pwd)" | |
ls -la | |
echo "PATH: $PATH" | |
echo "Rust version: $(rustc --version)" | |
echo "Cargo version: $(cargo --version)" | |
echo "Solana version: $(solana --version)" | |
echo "Anchor version: $(anchor --version)" | |
- name: Build Anchor Program | |
run: anchor build | |
continue-on-error: true | |
- name: Run Anchor Tests | |
run: | | |
solana config set --keypair ~/.config/solana/id.json | |
anchor test |