feat: add ci #3
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: | | |
| sh -c "$(curl -sSfL https://release.solana.com/v2.2.15/install)" | |
| echo "$HOME/.local/share/solana/install/active_release/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 & | |
| sleep 30 | |
| - name: Run tests | |
| run: | | |
| SUB_TESTS='${{ matrix.sub-tests }}' | |
| for test in $(echo $SUB_TESTS | jq -r '.[]'); do | |
| echo "Running: $test" | |
| eval $test | |
| done |