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 } });