Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 97 additions & 7 deletions .github/workflows/anchor-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Test Anchor Program
# Based on: https://github.com/IhorMuliar/test-anchor/

name: Anchor Test

on:
push:
Expand All @@ -7,17 +9,105 @@ on:
branches: [ "main" ]

env:
SOLANA_VERSION: "2.1.21"
ANCHOR_VERSION: "0.31.1"
NODE_VERSION: "22.14.0"
SOLANA_VERSION: "3.0.13"
ANCHOR_VERSION: "0.32.1"
NODE_VERSION: "24.10.0"
Comment thread
jannden marked this conversation as resolved.

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test Anchor
uses: IhorMuliar/test-anchor@v1.1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: yarn.lock

- name: Install Node.js dependencies
run: yarn install --frozen-lockfile

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
features: test
components: rustfmt, clippy

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev pkg-config

- name: Cache Solana CLI
id: cache-solana
uses: actions/cache@v4
with:
path: |
~/.cache/solana/
~/.local/share/solana/
~/.config/solana/
key: solana-cli-${{ runner.os }}-${{ env.SOLANA_VERSION }}

- name: Install Solana CLI
if: steps.cache-solana.outputs.cache-hit != 'true'
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_VERSION }}/install)"

- name: Setup Solana PATH
run: echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

- name: Setup Solana config
run: |
solana address || solana-keygen new --no-bip39-passphrase
solana config set --url localhost

- name: Cache Anchor CLI
id: cache-anchor
uses: actions/cache@v4
with:
path: |
~/.avm
~/.cargo/bin/anchor
~/.cargo/bin/avm
key: anchor-cli-${{ runner.os }}-${{ env.ANCHOR_VERSION }}

- name: Install Anchor CLI
if: steps.cache-anchor.outputs.cache-hit != 'true'
run: |
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install ${{ env.ANCHOR_VERSION }}
avm use ${{ env.ANCHOR_VERSION }}

- name: Setup Anchor PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Cache Anchor build artifacts
id: cache-anchor-build
uses: actions/cache@v4
with:
path: |
target/deploy/
target/idl/
target/types/
key: anchor-build-${{ runner.os }}-${{ hashFiles('programs/**/*.rs', 'Anchor.toml') }}

- name: Build Anchor program
run: anchor build

- name: Run Anchor tests
run: anchor test -- --features test
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js 22.14.0
- name: Use Node.js 24.10.0
uses: actions/setup-node@v4
with:
node-version: 22.14.0
node-version: 24.10.0
cache: 'yarn'
cache-dependency-path: app/yarn.lock

Expand Down
18 changes: 4 additions & 14 deletions Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
[toolchain]
anchor_version = "0.31.1"
solana_version = "2.1.21"
anchor_version = "0.32.1"
solana_version = "3.0.13"
Comment thread
jannden marked this conversation as resolved.
package_manager = "yarn"

[features]
resolution = true
skip-lint = false

[programs.devnet]
blockrunners = "FajM5A4b5VgLSqcxxeYz3WxqsG3RnGiW9FN7G7PiBpcV"

[programs.localnet]
blockrunners = "FajM5A4b5VgLSqcxxeYz3WxqsG3RnGiW9FN7G7PiBpcV"

[registry]
url = "https://api.apr.dev"
blockrunners = "6BwNv3aA437eCifxaUymtRov1bw17eK4xXuYVXodNWjC"
Comment thread
jannden marked this conversation as resolved.

[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"

[workspace]
types = "app/src/idl/"

[scripts]
copy_idl = "mkdir -p app/src/idl && cp target/idl/blockrunners.json app/src/idl/blockrunners.json"
copy_idl = "mkdir -p app/src/idl && cp target/idl/blockrunners.json app/src/idl/blockrunners.json && anchor idl type app/src/idl/blockrunners.json -o app/src/idl/blockrunners.ts"
frontend = "cd app && yarn dev:localnet"
frontend_devnet = "cd app && yarn dev:devnet"
frontend_mainnet = "cd app && yarn dev:mainnet"
Expand Down
Loading
Loading