Skip to content

Commit 47f464d

Browse files
committed
Add option to run benchmarks on PRs
1 parent f3c8886 commit 47f464d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/benchmark.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Benchmark Main
33
on:
44
push:
55
branches: [ main ]
6+
pull_request:
7+
types: [opened, synchronize, reopened, labeled]
68
workflow_dispatch:
79

810
permissions:
@@ -17,6 +19,7 @@ jobs:
1719
container:
1820
image: ubuntu:24.04@sha256:353675e2a41babd526e2b837d7ec780c2a05bca0164f7ea5dbbd433d21d166fc
1921
timeout-minutes: 20 # since there is only a single bare metal runner across all repos
22+
if: github.event_name != 'pull_request' || contains(github.event.label.name, 'run benchmarks')
2023
steps:
2124
- name: Install Git
2225
run: |
@@ -46,9 +49,11 @@ jobs:
4649
java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark
4750
4851
- name: Use CLA approved github bot
52+
if: github.event_name != 'pull_request'
4953
run: .github/scripts/use-cla-approved-github-bot.sh
5054

5155
- name: Store benchmark results
56+
if: github.event_name != 'pull_request'
5257
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
5358
with:
5459
tool: 'jmh'
@@ -57,3 +62,10 @@ jobs:
5762
github-token: ${{ secrets.GITHUB_TOKEN }}
5863
benchmark-data-dir-path: "benchmarks"
5964
auto-push: true
65+
66+
- name: Upload benchmark results
67+
if: github.event_name == 'pull_request'
68+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
69+
with:
70+
name: jmh-result.json
71+
path: sdk/trace/build/jmh-result.json

0 commit comments

Comments
 (0)