44 pull_request :
55 branches : [ "main" ]
66
7+ permissions :
8+ pull-requests : write
79jobs :
8- get-tag :
10+ prep :
911 runs-on : ubuntu-latest
1012 outputs :
1113 tag : ${{ steps.last_tag.outputs.tag }}
14+ short_sha : ${{ steps.short.outputs.sha }}
1215 steps :
1316 - uses : actions/checkout@v6
1417 with :
1518 fetch-tags : true
1619 fetch-depth : 0
1720 - id : last_tag
18- run : echo ="tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
21+ run : echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
22+ - id : short
23+ run : echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
1924
2025 benchmark :
21- needs : get-tag
26+ needs : prep
2227 runs-on : ubuntu-latest
2328 strategy :
29+ fail-fast : false
2430 matrix :
2531 target :
26- - name : pr
32+ - name : ${{ needs.prep.outputs.short_sha }}
2733 ref : ${{ github.sha }}
2834 - name : main
2935 ref : main
30- - name : ${{ needs.get_tag.outputs.tag }}
31- ref : ${{ needs.get_tag.outputs.tag }}
36+ # Tag comparison disabled until next release (missing benchmark dependencies)
37+ # - name: ${{ needs.prep.outputs.tag }}
38+ # ref: ${{ needs.prep.outputs.tag }}
3239 steps :
3340 - uses : actions/checkout@v6
3441 with :
@@ -38,24 +45,35 @@ jobs:
3845 - run : uv sync --extra "cloud"
3946 - name : Run benchmarks
4047 run : |
41- uv run .github/scripts/run_benchmarks.py \
42- --output benchmark-${{matrix.target.name }}.json
48+ FILENAME="benchmark-${{ matrix.target.name }}-PR-${{ github.event.pull_request.number }}.json"
49+ uv run .github/scripts/run_benchmarks.py --output "$FILENAME"
50+ echo "REPORT_PATH=$FILENAME" >> $GITHUB_ENV
4351 - uses : actions/upload-artifact@v7
4452 with :
45- name : benchmark-${{ matrix.target.name }}
46- path : benchmark-${{ matrix.target.name }}.json
53+ name : benchmark-${{ matrix.target.name }}-PR-${{
54+ github.event.pull_request.number }}
55+ path : ${{ env.REPORT_PATH }}
56+ retention-days : 1
57+ overwrite : true
4758
4859 report :
49- needs : [ get-tag , benchmark ]
60+ needs : [ prep , benchmark ]
5061 runs-on : ubuntu-latest
5162 steps :
5263 - uses : actions/checkout@v6
5364 - uses : astral-sh/setup-uv@v8.1.0
5465 - uses : actions/download-artifact@v8
5566 with :
5667 pattern : benchmark-*
68+ merge-multiple : true
69+ path : benchmark-results
5770 - name : Generate report
5871 run : |
5972 uv run .github/scripts/compare_benchmarks.py \
60- --output benchmarks.md \
61- --pattern benchmark-*.json
73+ --output "benchmarks.md" \
74+ --pattern "benchmark-results/benchmark-*-PR-${{ github.event.pull_request.number }}.json"
75+ - name : PR comment
76+ uses : peter-evans/create-or-update-comment@v5
77+ with :
78+ issue-number : ${{ github.event.pull_request.number }}
79+ body-path : " benchmarks.md"
0 commit comments