Skip to content

Commit 595abe5

Browse files
committed
add cu bench recipe
1 parent 0b4c5a2 commit 595abe5

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/main.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,38 @@ jobs:
147147
- name: Test Program
148148
run: make test-program
149149

150+
bench_program_compute_units:
151+
name: Benchmark Program Compute Units
152+
runs-on: ubuntu-latest
153+
needs: build_program # Cargo Bench won't build the SBPF binary...
154+
steps:
155+
- name: Git Checkout
156+
uses: actions/checkout@v4
157+
158+
- name: Setup Environment
159+
uses: ./.github/actions/setup
160+
with:
161+
cargo-cache-key: cargo-program-benches
162+
cargo-cache-fallback-key: cargo-program
163+
solana: true
164+
165+
- name: Restore Program Builds
166+
uses: actions/cache/restore@v4
167+
with:
168+
path: ./**/*.so
169+
key: ${{ runner.os }}-builds-${{ github.sha }}
170+
171+
- name: Benchmark Compute Units
172+
run: make bench-program-compute-units
173+
174+
- name: Check Working Directory
175+
run: |
176+
if [ -n "$(git status --porcelain)" ]; then
177+
test -z "$(git status --porcelain)"
178+
echo "CU usage has changed. Please run `cargo bench` and commit the new results.";
179+
exit 1;
180+
fi
181+
150182
generate_clients:
151183
name: Check Client Generation
152184
runs-on: ubuntu-latest

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ build-program:
3232
test-program:
3333
cargo test-sbf --manifest-path program/Cargo.toml --features bpf-entrypoint
3434

35+
bench-program-compute-units:
36+
cargo bench --manifest-path program/Cargo.toml
37+
3538
format-js:
3639
cd ./clients/js && pnpm install && pnpm format
3740

0 commit comments

Comments
 (0)