feat: add ci #12
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 Solana CLI | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bash | |
| export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
| solana-keygen new --no-bip39-passphrase | |
| - name: Install Light CLI | |
| run: | | |
| npm install -g @lightprotocol/zk-compression-cli | |
| - name: Generate Solana keypair | |
| run: | | |
| - name: Start Light test validator | |
| run: | | |
| export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | |
| light test-validator | |
| - name: Run tests | |
| run: | | |
| SUB_TESTS='${{ matrix.sub-tests }}' | |
| for test in $(echo $SUB_TESTS | jq -r '.[]'); do | |
| echo "Running: $test" | |
| eval $test | |
| done |