File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,29 @@ jobs:
109109 - name : Test Programs
110110 run : pnpm programs:test
111111
112+ bench_program_compute_units :
113+ name : Benchmark Program Compute Units
114+ runs-on : ubuntu-latest
115+ needs : build_programs # Cargo Bench won't build the SBPF binary...
116+ steps :
117+ - name : Git Checkout
118+ uses : actions/checkout@v4
119+
120+ - name : Setup Environment
121+ uses : ./.github/actions/setup
122+ with :
123+ cargo-cache-key : cargo-program-benches
124+ cargo-cache-fallback-key : cargo-programs
125+ solana : true
126+
127+ - name : Benchmark Compute Units
128+ run : pnpm programs:bench
129+
130+ - name : Check Working Directory
131+ run : |
132+ git status --porcelain
133+ test -z "$(git status --porcelain)"
134+
112135 # # SKIP: IDL is hand-cranked here for now.
113136 # #
114137 # generate_idls:
Original file line number Diff line number Diff line change 33 "scripts" : {
44 "programs:build" : " zx ./scripts/program/build.mjs" ,
55 "programs:test" : " zx ./scripts/program/test.mjs" ,
6+ "programs:bench" : " zx ./scripts/program/bench.mjs" ,
67 "programs:clean" : " zx ./scripts/program/clean.mjs" ,
78 "programs:format" : " zx ./scripts/program/format.mjs" ,
89 "programs:lint" : " zx ./scripts/program/lint.mjs" ,
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env zx
2+ import 'zx/globals' ;
3+ import {
4+ cliArguments ,
5+ getProgramFolders ,
6+ workingDirectory ,
7+ } from '../utils.mjs' ;
8+
9+ // Save external programs binaries to the output directory.
10+ import './dump.mjs' ;
11+
12+ // Configure additional arguments here, e.g.:
13+ // ['--arg1', '--arg2', ...cliArguments()]
14+ const benchArgs = [
15+ '--features' ,
16+ 'bpf-entrypoint' ,
17+ ...cliArguments ( ) ,
18+ ] ;
19+
20+ const hasSolfmt = await which ( 'solfmt' , { nothrow : true } ) ;
21+
22+ // Test the programs.
23+ await Promise . all (
24+ getProgramFolders ( ) . map ( async ( folder ) => {
25+ const manifestPath = path . join ( workingDirectory , folder , 'Cargo.toml' ) ;
26+
27+ if ( hasSolfmt ) {
28+ await $ `RUST_LOG=error cargo bench --manifest-path ${ manifestPath } ${ benchArgs } 2>&1 | solfmt` ;
29+ } else {
30+ await $ `RUST_LOG=error cargo bench --manifest-path ${ manifestPath } ${ benchArgs } ` ;
31+ }
32+ } )
33+ ) ;
You can’t perform that action at this time.
0 commit comments