Skip to content

Commit 3da2b1f

Browse files
author
tilo-14
committed
Add basic-operations examples to CI workflows and update dependencies
- Add basic-operations/native to Rust tests workflow - Add basic-operations/anchor to Anchor tests workflow - Add anchor_version specification to Anchor.toml - Update Cargo.lock with latest dependency versions - Reorganize test files into separate test directories - Add test helper modules for test utilities
1 parent bf3c079 commit 3da2b1f

28 files changed

Lines changed: 3043 additions & 331 deletions

File tree

.github/workflows/rust-tests.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
SOLANA_CLI_VERSION: "2.3.11"
18+
RUST_TOOLCHAIN: "1.90.0"
19+
20+
jobs:
21+
test-rust:
22+
name: ${{ matrix.example }}
23+
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
example:
28+
- create-and-update
29+
- counter/native
30+
- counter/pinocchio
31+
- account-comparison
32+
- zk-id
33+
- basic-operations/native
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Setup environment
38+
uses: ./.github/actions/setup
39+
with:
40+
example: ${{ matrix.example }}
41+
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
42+
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
43+
install-circom: ${{ matrix.example == 'zk-id' }}
44+
45+
- name: Setup ZK circuits
46+
if: matrix.example == 'zk-id'
47+
working-directory: ${{ matrix.example }}
48+
run: ./scripts/setup.sh
49+
50+
- name: Build and test
51+
working-directory: ${{ matrix.example }}
52+
run: cargo test-sbf
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Anchor
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
SOLANA_CLI_VERSION: "2.3.11"
18+
RUST_TOOLCHAIN: "1.90.0"
19+
NODE_VERSION: "22"
20+
21+
jobs:
22+
test-typescript:
23+
name: ${{ matrix.example }}
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
example:
29+
- counter/anchor
30+
- basic-operations/anchor
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Setup environment
35+
uses: ./.github/actions/setup
36+
with:
37+
example: ${{ matrix.example }}
38+
node-version: ${{ env.NODE_VERSION }}
39+
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
40+
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
41+
photon-indexer: 'true'
42+
43+
- name: Install dependencies
44+
working-directory: ${{ matrix.example }}
45+
run: npm install
46+
47+
- name: Build and sync program ID
48+
working-directory: ${{ matrix.example }}
49+
run: anchor build
50+
51+
- name: Test sbf
52+
working-directory: ${{ matrix.example }}
53+
run: cargo test-sbf
54+
55+
- name: Start test validator
56+
working-directory: ${{ matrix.example }}
57+
run: |
58+
PROGRAM_ID=$(grep -A 1 "\[programs.localnet\]" Anchor.toml | grep "counter" | sed 's/.*"\(.*\)".*/\1/')
59+
light test-validator --sbf-program "$PROGRAM_ID" ./target/deploy/counter.so &
60+
sleep 10
61+
62+
- name: Run TypeScript tests
63+
working-directory: ${{ matrix.example }}
64+
run: anchor test --skip-local-validator --skip-build --skip-deploy

basic-operations/anchor/create/Anchor.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[toolchain]
2+
anchor_version = "0.31.1"
23

34
[features]
45
resolution = true

basic-operations/anchor/create/Cargo.lock

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

basic-operations/native/Cargo.lock

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)