Skip to content

Commit a324173

Browse files
committed
Fix benchmark workflow bugs
- Switch to shortened SHA for PR - Add PR for unique output file artifact
1 parent 33c5f3a commit a324173

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

.github/workflows/benchmark.yaml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,33 @@ on:
55
branches: [ "main" ]
66

77
jobs:
8-
get-tag:
8+
prep:
99
runs-on: ubuntu-latest
1010
outputs:
1111
tag: ${{ steps.last_tag.outputs.tag }}
12+
short_sha: ${{ steps.short.outputs.sha }}
1213
steps:
1314
- uses: actions/checkout@v6
1415
with:
1516
fetch-tags: true
1617
fetch-depth: 0
1718
- id: last_tag
18-
run: echo ="tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
19+
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
20+
- id: short
21+
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
1922

2023
benchmark:
21-
needs: get-tag
24+
needs: prep
2225
runs-on: ubuntu-latest
2326
strategy:
2427
matrix:
2528
target:
26-
- name: pr
29+
- name: ${{ needs.prep.outputs.short_sha }}
2730
ref: ${{ github.sha }}
2831
- name: main
2932
ref: main
30-
- name: ${{ needs.get_tag.outputs.tag }}
31-
ref: ${{ needs.get_tag.outputs.tag }}
33+
- name: ${{ needs.prep.outputs.tag }}
34+
ref: ${{ needs.prep.outputs.tag }}
3235
steps:
3336
- uses: actions/checkout@v6
3437
with:
@@ -38,24 +41,30 @@ jobs:
3841
- run: uv sync --extra "cloud"
3942
- name: Run benchmarks
4043
run: |
41-
uv run .github/scripts/run_benchmarks.py \
42-
--output benchmark-${{matrix.target.name }}.json
44+
FILENAME="benchmark-${{ matrix.target.name }}-PR-${{ github.event.pull_request.number }}.json"
45+
uv run .github/scripts/run_benchmarks.py --output "$FILENAME"
46+
echo "REPORT_PATH=$FILENAME" >> $GITHUB_ENV
4347
- uses: actions/upload-artifact@v7
4448
with:
45-
name: benchmark-${{ matrix.target.name }}
46-
path: benchmark-${{ matrix.target.name }}.json
49+
name: benchmark-${{ matrix.target.name }}-PR-${{
50+
github.event.pull_request.number }}
51+
path: ${{ env.REPORT_PATH }}
52+
retention-days: 1
53+
overwrite: true
4754

4855
report:
49-
needs: [ get-tag, benchmark ]
56+
needs: [ prep, benchmark ]
5057
runs-on: ubuntu-latest
5158
steps:
5259
- uses: actions/checkout@v6
5360
- uses: astral-sh/setup-uv@v8.1.0
5461
- uses: actions/download-artifact@v8
5562
with:
5663
pattern: benchmark-*
64+
merge-multiple: true
65+
path: benchmark-results
5766
- name: Generate report
5867
run: |
5968
uv run .github/scripts/compare_benchmarks.py \
6069
--output benchmarks.md \
61-
--pattern benchmark-*.json
70+
--pattern "benchmark-results/benchmark-*-PR-${{ github.event.pull_request.number }}.json

0 commit comments

Comments
 (0)