Skip to content

Commit bd21ba4

Browse files
committed
fix(ci): nightly benchmark (#2922)
## Linked Issues/PRs <!-- List of related issues/PRs --> - none ## Description <!-- List of detailed changes --> some fixes for triggering PR creation and some fixes from @mchristopher (thx!) ## Checklist - [ ] Breaking changes are clearly marked as such in the PR description and changelog - [ ] New behavior is reflected in tests - [ ] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [ ] I have reviewed the code myself - [ ] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams [Add or remove entries as needed] - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) - [ ] Someone else?
1 parent 23e1cbe commit bd21ba4

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

.github/workflows/nightly-benchmark.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,55 @@ jobs:
2121
benchmark:
2222
runs-on:
2323
group: fuelcore-benchmark
24+
concurrency:
25+
group: fuelcore-benchmark # only allow one benchmark run at a time
26+
cancel-in-progress: false
2427
outputs:
2528
benchmark_results: ${{ steps.benchmarks.outputs.benchmark_results }}
2629
steps:
2730
- name: Checkout
2831
uses: actions/checkout@v4
32+
2933
- name: Install Rust Toolchain
3034
uses: dtolnay/rust-toolchain@master
3135
with:
3236
toolchain: ${{ env.RUST_VERSION }}
3337
targets: "wasm32-unknown-unknown"
38+
39+
- name: Install criterion
40+
run: cargo install cargo-criterion
41+
3442
- name: Cache
3543
uses: Swatinem/rust-cache@v2
44+
3645
- name: Run benchmarks
37-
id: benchmarks
46+
id: run_benchmarks
3847
run: |
3948
cargo criterion -p fuel-core-benches --message-format json --bench vm > nightly_benchmarks.json
4049
cargo run -p fuel-core-benches --bin collect --release -- --input nightly_benchmarks.json --format consensus-parameters --output nightly_benchmarks.json
41-
echo "benchmark_results=$(cat nightly_benchmarks.json | tr -d '\n' | jq '.${{ env.CONSENSUS_PARAMETERS_VERSION }}.gas_costs')" >> "$GITHUB_OUTPUT" # this will fail when consensus parameters version changes
50+
51+
- name: Archive benchmark results
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: nightly_benchmarks.json
55+
path: nightly_benchmarks.json
56+
57+
- name: Set benchmark result output
58+
id: benchmarks
59+
run: | # this will fail when consensus parameters version changes
60+
echo "benchmark_results=$(cat nightly_benchmarks.json | jq '.${{ env.CONSENSUS_PARAMETERS_VERSION }}.gas_costs' | tr -d '\n' )" >> "$GITHUB_OUTPUT"
61+
4262
create_pr:
4363
needs: benchmark
4464
runs-on: ubuntu-latest
45-
if: ${{ github.event.inputs.create_pr == 'true' }}
65+
permissions:
66+
pull-requests: write
67+
68+
if: ${{ github.event.inputs.create_pr == 'true' || github.event_name == 'pull_request' }}
4669
steps:
47-
- uses: actions/checkout@v4
70+
- name: Checkout
71+
uses: actions/checkout@v4
72+
4873
- run: |
4974
jq --argjson benchmark_results "$benchmark_results" \
5075
'.consensus_parameters.${{ env.CONSENSUS_PARAMETERS_VERSION }}.gas_costs = $benchmark_results' \
@@ -55,7 +80,6 @@ jobs:
5580
branch_name="chore/benchmark-update-$(date +%s)"
5681
git checkout -b "$branch_name"
5782
git add bin/fuel-core/chainspec/local-testnet/chain_config.json
58-
5983
git config user.name 'github-actions[bot]'
6084
git config user.email 'github-actions[bot]@users.noreply.github.com'
6185
git commit -m "Update benchmark results"

0 commit comments

Comments
 (0)