feat: add ci #8
Workflow file for this run
This file contains hidden or 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: Program Tests | |
| on: | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| jobs: | |
| program-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - program: create-and-update | |
| sub-tests: '[ | |
| "cargo test-sbf -p create-and-update" | |
| ]' | |
| - program: counter-anchor | |
| sub-tests: '[ | |
| "cargo test-sbf -p counter --manifest-path counter/anchor/Cargo.toml", | |
| "cd counter/anchor && npm install && npm test" | |
| ]' | |
| - program: counter-native | |
| sub-tests: '[ | |
| "cargo test-sbf -p counter --manifest-path counter/native/Cargo.toml" | |
| ]' | |
| - program: counter-pinocchio | |
| sub-tests: '[ | |
| "cargo test-sbf -p counter --manifest-path counter/pinocchio/Cargo.toml" | |
| ]' | |
| - program: account-comparison | |
| sub-tests: '[ | |
| "cargo test-sbf -p account-comparison --manifest-path account-comparison/Cargo.toml" | |
| ]' | |
| name: Test ${{ matrix.program }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "23.5.0" | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libudev-dev pkg-config | |
| - name: Install Solana CLI | |
| run: | | |
| # Install via cargo for better CI reliability | |
| cargo install solana-cli --version 2.2.15 | |
| # Verify installation | |
| ~/.cargo/bin/solana --version | |
| ~/.cargo/bin/solana-keygen --version | |
| # Add to PATH for subsequent steps | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install Anchor CLI | |
| run: | | |
| cargo install --git https://github.com/coral-xyz/anchor avm --locked --force | |
| avm install latest | |
| avm use latest | |
| - name: Install Light CLI | |
| run: | | |
| npm install -g @lightprotocol/zk-compression-cli | |
| - name: Generate Solana keypair | |
| run: | | |
| solana-keygen new --no-bip39-passphrase | |
| - name: Start Light test validator | |
| run: | | |
| light test-validator | |
| - name: Run tests | |
| run: | | |
| export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" | |
| SUB_TESTS='${{ matrix.sub-tests }}' | |
| for test in $(echo $SUB_TESTS | jq -r '.[]'); do | |
| echo "Running: $test" | |
| eval $test | |
| done |