-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (93 loc) · 3.05 KB
/
test.yml
File metadata and controls
97 lines (93 loc) · 3.05 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Test
on:
workflow_call:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: 2.2.19
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.92'
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- run: cargo test -p escrow-program
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.92'
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install Solana CLI
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_VERSION }}/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- run: pnpm install
- name: Build program
run: |
pnpm run generate-idl
pnpm run generate-clients
cd program && cargo-build-sbf
- name: Build test hook programs
run: |
cd tests/test-hook-program
cargo-build-sbf --features allow
cp ../../target/deploy/test_hook_program.so ../../target/deploy/test_hook_allow.so
cargo-build-sbf --features deny
cp ../../target/deploy/test_hook_program.so ../../target/deploy/test_hook_deny.so
- name: Run integration tests
run: |
mkdir -p .cus
cargo test -p tests-escrow-program -- --test-threads=1
env:
CU_TRACKING: '1'
- name: Compute Units Summary
if: always()
run: |
echo "## Compute Units Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f .cus/results.txt ]; then
echo "| Instruction | Best | Avg | Worst | Count |" >> $GITHUB_STEP_SUMMARY
echo "|-------------|------|-----|-------|-------|" >> $GITHUB_STEP_SUMMARY
awk -F',' '
{
name = $1
cus = $2
count[name]++
sum[name] += cus
if (!(name in min) || cus < min[name]) min[name] = cus
if (!(name in max) || cus > max[name]) max[name] = cus
}
END {
for (name in count) {
avg = int(sum[name] / count[name])
printf "| %s | %d | %d | %d | %d |\n", name, min[name], avg, max[name], count[name]
}
}' .cus/results.txt | sort >> $GITHUB_STEP_SUMMARY
else
echo "No CU tracking data found." >> $GITHUB_STEP_SUMMARY
fi