Update .github/workflows/tests.yml #17
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: 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 "Anchor.toml content:" | |
cat Anchor.toml || echo "Anchor.toml not found" | |
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: Debug Build Failure | |
if: failure() | |
run: | | |
echo "Build failed. Debugging information:" | |
echo "Current directory: $(pwd)" | |
ls -la | |
echo "target directory content:" | |
ls -la target || echo "target directory not found" | |
echo "programs directory content:" | |
ls -la programs || echo "programs directory not found" | |
echo "Cargo.toml content:" | |
cat Cargo.toml || echo "Cargo.toml not found" | |
- name: Run Anchor Tests | |
run: anchor test |