|
1 | 1 | name: Benchmark |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request_target: |
| 4 | + pull_request: |
5 | 5 | branches: [main] |
6 | 6 |
|
7 | | -permissions: |
8 | | - pull-requests: write |
9 | | - issues: write |
| 7 | +concurrency: |
| 8 | + group: benchmark-${{ github.event.pull_request.number }} |
| 9 | + cancel-in-progress: true |
10 | 10 |
|
11 | 11 | jobs: |
12 | 12 | benchmark: |
@@ -39,38 +39,20 @@ jobs: |
39 | 39 | run: | |
40 | 40 | git checkout ${{ github.event.pull_request.head.sha }} |
41 | 41 | 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=dots | tee benchmark-result.txt || true |
43 | 43 |
|
44 | | - - name: Read benchmark result |
45 | | - id: bench |
| 44 | + - name: Prepare artifact |
46 | 45 | 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 |
63 | 56 | 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/ |
0 commit comments