11name : Benchmark
22
33on :
4- pull_request_target :
4+ pull_request :
55 branches : [main]
66
7- permissions :
8- pull-requests : write
9- issues : write
7+ concurrency :
8+ group : benchmark-${{ github.event.pull_request.number }}
9+ cancel-in-progress : true
1010
1111jobs :
1212 benchmark :
@@ -33,44 +33,27 @@ jobs:
3333 run : |
3434 git checkout ${{ github.event.pull_request.base.sha }}
3535 composer install --no-interaction --prefer-dist --quiet
36- vendor/bin/phpbench run --tag=base --store --progress=dots
36+ vendor/bin/phpbench run --tag=base --store --progress=none
3737
3838 - name : Benchmark PR branch
3939 run : |
4040 git checkout ${{ github.event.pull_request.head.sha }}
4141 composer install --no-interaction --prefer-dist --quiet
42- vendor/bin/phpbench run --tag=pr --store --ref=base --report=aggregate --progress=dots > benchmark-result.txt 2>&1 || true
42+ vendor/bin/phpbench run --tag=pr --store --ref=base --report=aggregate --progress=none 2>&1 | tee benchmark-result.txt || true
4343
44- - name : Read benchmark result
45- id : bench
44+ - name : Prepare artifact
4645 run : |
47- {
48- echo "result<<BENCH_EOF"
49- cat benchmark-result.txt
50- echo "BENCH_EOF"
51- } >> "$GITHUB_OUTPUT"
52-
53- - name : Find existing comment
54- uses : peter-evans/find-comment@v4
55- id : find-comment
56- with :
57- issue-number : ${{ github.event.pull_request.number }}
58- comment-author : github-actions[bot]
59- body-includes : " ## Benchmark Results"
60-
61- - name : Post benchmark results
62- uses : peter-evans/create-or-update-comment@v5
46+ mkdir -p benchmark-artifact
47+ cp benchmark-result.txt benchmark-artifact/
48+ echo "${{ github.event.pull_request.number }}" > benchmark-artifact/pr-number.txt
49+ echo "${{ github.head_ref }}" > benchmark-artifact/head-ref.txt
50+ echo "${{ github.base_ref }}" > benchmark-artifact/base-ref.txt
51+ echo "${{ github.event.pull_request.base.sha }}" > benchmark-artifact/base-sha.txt
52+ echo "${{ github.event.pull_request.head.sha }}" > benchmark-artifact/head-sha.txt
53+
54+ - name : Upload benchmark artifact
55+ uses : actions/upload-artifact@v6
6356 with :
64- issue-number : ${{ github.event.pull_request.number }}
65- comment-id : ${{ steps.find-comment.outputs.comment-id }}
66- edit-mode : replace
67- body : |
68- ## Benchmark Results
69-
70- Comparison of `${{ github.head_ref }}` against `${{ github.base_ref }}` (`${{ github.event.pull_request.base.sha }}`).
71-
72- ```
73- ${{ steps.bench.outputs.result }}
74- ```
75-
76- <sub>Generated by phpbench against commit ${{ github.event.pull_request.head.sha }}</sub>
57+ name : benchmark-result
58+ path : benchmark-artifact/
59+ retention-days : 1
0 commit comments