Skip to content

Commit f4a09a2

Browse files
committed
ci: run benchmarks on PRs without updating baseline
1 parent f4d87ea commit f4a09a2

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ permissions: {}
55
push:
66
branches:
77
- main
8+
pull_request:
9+
branches:
10+
- main
811
workflow_dispatch:
912

1013
jobs:
@@ -15,6 +18,7 @@ jobs:
1518
permissions:
1619
contents: write
1720
issues: write
21+
pull-requests: write
1822
steps:
1923
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2024
- name: Set up Go
@@ -29,13 +33,15 @@ jobs:
2933
run: |
3034
cd test/e2e && go test -tags evm -bench=. -benchmem -run='^$' \
3135
-timeout=10m --evm-binary=../../build/evm | tee output.txt
36+
# only update the benchmark baseline on push/dispatch, not on PRs
3237
- name: Store benchmark result
3338
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
3439
with:
3540
name: EVM Contract Roundtrip
3641
tool: 'go'
3742
output-file-path: test/e2e/output.txt
38-
auto-push: true
43+
auto-push: ${{ github.event_name != 'pull_request' }}
44+
save-data-file: ${{ github.event_name != 'pull_request' }}
3945
github-token: ${{ secrets.GITHUB_TOKEN }}
4046
alert-threshold: '150%'
4147
fail-on-alert: true
@@ -45,13 +51,15 @@ jobs:
4551
run: |
4652
go test -bench=BenchmarkProduceBlock -benchmem -run='^$' \
4753
./block/internal/executing/... > block_executor_output.txt
54+
# only update the benchmark baseline on push/dispatch, not on PRs
4855
- name: Store Block Executor benchmark result
4956
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
5057
with:
5158
name: Block Executor Benchmark
5259
tool: 'go'
5360
output-file-path: block_executor_output.txt
54-
auto-push: true
61+
auto-push: ${{ github.event_name != 'pull_request' }}
62+
save-data-file: ${{ github.event_name != 'pull_request' }}
5563
github-token: ${{ secrets.GITHUB_TOKEN }}
5664
alert-threshold: '150%'
5765
fail-on-alert: true
@@ -64,6 +72,7 @@ jobs:
6472
permissions:
6573
contents: write
6674
issues: write
75+
pull-requests: write
6776
steps:
6877
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6978
- name: Set up Go
@@ -78,13 +87,15 @@ jobs:
7887
run: |
7988
cd test/e2e && BENCH_JSON_OUTPUT=spamoor_bench.json go test -tags evm \
8089
-run='^TestSpamoorSmoke$' -v -timeout=15m --evm-binary=../../build/evm
90+
# only update the benchmark baseline on push/dispatch, not on PRs
8191
- name: Store spamoor benchmark result
8292
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
8393
with:
8494
name: Spamoor Trace Benchmarks
8595
tool: 'customSmallerIsBetter'
8696
output-file-path: test/e2e/spamoor_bench.json
87-
auto-push: true
97+
auto-push: ${{ github.event_name != 'pull_request' }}
98+
save-data-file: ${{ github.event_name != 'pull_request' }}
8899
github-token: ${{ secrets.GITHUB_TOKEN }}
89100
alert-threshold: '150%'
90101
fail-on-alert: true

0 commit comments

Comments
 (0)