-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (72 loc) · 2.75 KB
/
Copy pathtypescript-tests.yml
File metadata and controls
82 lines (72 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Anchor
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
SOLANA_CLI_VERSION: "4.0.0-rc.0"
RUST_TOOLCHAIN: "1.91.0"
NODE_VERSION: "22"
jobs:
test-typescript:
name: ${{ matrix.example }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example:
- counter/anchor
- create-and-update
- basic-operations/anchor/burn
- basic-operations/anchor/create
- basic-operations/anchor/update
- basic-operations/anchor/close
- basic-operations/anchor/reinit
- zk/nullifier
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
example: ${{ matrix.example }}
node-version: ${{ env.NODE_VERSION }}
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
photon-indexer: "true"
- name: Install dependencies
working-directory: ${{ matrix.example }}
run: npm install
- name: Build and sync program ID
working-directory: ${{ matrix.example }}
run: |
# Anchor 1.0 verifies declare_id! matches the program keypair. Sync it,
# then keep the hardcoded Light CPI signer (derived from the program ID
# at compile time) in sync with the synced ID so the CPI signer check
# in the light-system-program passes at runtime.
anchor keys sync
PROGRAM_ID=$(grep -A 10 '\[programs.localnet\]' Anchor.toml | grep '=' | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "Synced program ID: $PROGRAM_ID"
grep -rl 'derive_light_cpi_signer!' programs 2>/dev/null | while IFS= read -r f; do
sed -i -E "s/derive_light_cpi_signer!\(\"[^\"]*\"\)/derive_light_cpi_signer!(\"$PROGRAM_ID\")/g" "$f"
done
anchor build
- name: Test sbf
working-directory: ${{ matrix.example }}
run: cargo test-sbf -- --test-threads=1
- name: Start test validator
working-directory: ${{ matrix.example }}
run: |
PROGRAM_NAME=$(grep -A 10 '\[programs.localnet\]' Anchor.toml | grep '=' | head -1 | cut -d' ' -f1)
PROGRAM_ID=$(grep -A 10 '\[programs.localnet\]' Anchor.toml | grep '=' | head -1 | sed 's/.*"\(.*\)".*/\1/')
light test-validator --sbf-program "$PROGRAM_ID" ./target/deploy/${PROGRAM_NAME}.so &
sleep 10
- name: Run TypeScript tests
working-directory: ${{ matrix.example }}
run: anchor test --skip-local-validator --skip-build --skip-deploy