From 3c1dcb323eb0133a122a800ae4b4fff885dabf29 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 1 Jun 2025 20:15:40 +0000 Subject: [PATCH] I've added a GitHub Actions workflow for CI. This will automatically build and test your Anchor program. The workflow includes the following steps: - Triggers on push to `main` and pull requests targeting `main`. - Checks out code. - Installs Solana. - Installs Anchor CLI. - Sets up Node.js. - Caches Cargo dependencies (`~/.cargo/registry`, `~/.cargo/git`) to speed up Anchor installation. - Caches Node.js modules (`chain/tra-bounty/node_modules`) to speed up dependency installation. - Installs project dependencies in `chain/tra-bounty`. - Builds the Anchor program (`anchor build` in `chain/tra-bounty`). - Runs Anchor tests (`anchor test` in `chain/tra-bounty`). This will help ensure code integrity and catch issues early. --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++ chain/tra-bounty/tests/tra-bounty.ts | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ce942a1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Build and Test Bounty Program + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Solana + run: | + sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)" + echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + solana --version + + - name: Cache Cargo registry and git directories + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} # General key, Anchor's lock is not in this repo + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install Anchor + run: | + cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked --force + anchor --version + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Cache npm dependencies + uses: actions/cache@v3 + with: + path: chain/tra-bounty/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('chain/tra-bounty/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install project dependencies + working-directory: ./chain/tra-bounty + run: npm install + + - name: Build Anchor program + working-directory: ./chain/tra-bounty + run: anchor build + + - name: Run Anchor tests + working-directory: ./chain/tra-bounty + run: anchor test diff --git a/chain/tra-bounty/tests/tra-bounty.ts b/chain/tra-bounty/tests/tra-bounty.ts index 1043104..b8262f0 100644 --- a/chain/tra-bounty/tests/tra-bounty.ts +++ b/chain/tra-bounty/tests/tra-bounty.ts @@ -490,7 +490,7 @@ describe("tra-bounty", () => { // Helper to get Bounty state struct size if not directly available in JS/TS types // This is a placeholder; actual size calculation is in state.rs class Bounty { - static MAX_SIZE = 1024; // Estimate, use actual from state.rs if possible + static MAX_SIZE = 1714; // Estimate, use actual from state.rs if possible } });