Skip to content

Commit bb1e536

Browse files
committed
chore: add ci
1 parent 5afb1d9 commit bb1e536

3 files changed

Lines changed: 155 additions & 0 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Setup Environment
2+
description: Setup Rust, Solana CLI, and optionally Node.js for testing
3+
4+
inputs:
5+
example:
6+
description: 'Example directory path'
7+
required: true
8+
node-version:
9+
description: 'Node.js version to install (optional)'
10+
required: false
11+
default: ''
12+
solana-cli-version:
13+
description: 'Solana CLI version'
14+
required: false
15+
default: '2.3.11'
16+
rust-toolchain:
17+
description: 'Rust toolchain version'
18+
required: false
19+
default: '1.90.0'
20+
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Install Rust toolchain
25+
uses: actions-rust-lang/setup-rust-toolchain@v1
26+
with:
27+
toolchain: ${{ inputs.rust-toolchain }}
28+
cache-workspaces: ${{ inputs.example }}
29+
30+
- name: Install Solana CLI
31+
uses: heyAyushh/setup-solana@v5.5
32+
with:
33+
solana-cli-version: ${{ inputs.solana-cli-version }}
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ inputs.node-version != '' && inputs.node-version || '22' }}
39+
cache: ${{ inputs.node-version != '' && 'npm' || '' }}
40+
cache-dependency-path: ${{ inputs.node-version != '' && format('{0}/package-lock.json', inputs.example) || '' }}
41+
42+
- name: Install Light CLI
43+
shell: bash
44+
run: npm install -g @lightprotocol/zk-compression-cli
45+
46+
- name: Generate keypair
47+
shell: bash
48+
run: solana-keygen new --no-bip39-passphrase
49+
50+
- name: Display versions
51+
shell: bash
52+
run: |
53+
rustc --version
54+
cargo --version
55+
solana --version
56+
light --version
57+
if [ -n "${{ inputs.node-version }}" ]; then
58+
node --version
59+
npm --version
60+
fi

.github/workflows/rust-tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Setup environment
36+
uses: ./.github/actions/setup
37+
with:
38+
example: ${{ matrix.example }}
39+
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
40+
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
41+
42+
- name: Build and test
43+
working-directory: ${{ matrix.example }}
44+
run: cargo test-sbf
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Setup environment
34+
uses: ./.github/actions/setup
35+
with:
36+
example: ${{ matrix.example }}
37+
node-version: ${{ env.NODE_VERSION }}
38+
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
39+
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
40+
41+
- name: Install dependencies
42+
working-directory: ${{ matrix.example }}
43+
run: npm install
44+
45+
- name: Test sbf
46+
working-directory: ${{ matrix.example }}
47+
run: cargo test-sbf
48+
49+
- name: Run TypeScript tests
50+
working-directory: ${{ matrix.example }}
51+
run: npm test

0 commit comments

Comments
 (0)