|
| 1 | +name: Upload PR Benchmark Results |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: [Run Benchmarks] |
| 6 | + types: [completed] |
| 7 | + |
| 8 | +jobs: |
| 9 | + upload_benchmarks: |
| 10 | + if: github.event.workflow_run.conclusion == 'success' |
| 11 | + permissions: |
| 12 | + pull-requests: write |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + BENCHMARK_RESULTS: benchmark_results.json |
| 16 | + PR_EVENT: event.json |
| 17 | + steps: |
| 18 | + - name: Download Benchmark Results |
| 19 | + uses: dawidd6/action-download-artifact@v6 |
| 20 | + with: |
| 21 | + name: ${{ env.BENCHMARK_RESULTS }} |
| 22 | + run_id: ${{ github.event.workflow_run.id }} |
| 23 | + - name: Download PR Event |
| 24 | + uses: dawidd6/action-download-artifact@v6 |
| 25 | + with: |
| 26 | + name: ${{ env.PR_EVENT }} |
| 27 | + run_id: ${{ github.event.workflow_run.id }} |
| 28 | + - name: Export PR Event Data |
| 29 | + uses: actions/github-script@v6 |
| 30 | + with: |
| 31 | + script: | |
| 32 | + let fs = require('fs'); |
| 33 | + let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); |
| 34 | + core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); |
| 35 | + core.exportVariable("PR_HEAD_SHA", prEvent.pull_request.head.sha); |
| 36 | + core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); |
| 37 | + core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha); |
| 38 | + core.exportVariable("PR_NUMBER", prEvent.number); |
| 39 | + - uses: bencherdev/bencher@main |
| 40 | + - name: Track Benchmarks with Bencher |
| 41 | + run: | |
| 42 | + bencher run \ |
| 43 | + --host 'https://bencher.php.rs/api' \ |
| 44 | + --project ext-php-rs \ |
| 45 | + --token '${{ secrets.BENCHER_API_TOKEN }}' \ |
| 46 | + --branch "$PR_HEAD" \ |
| 47 | + --hash "$PR_HEAD_SHA" \ |
| 48 | + --start-point "$PR_BASE" \ |
| 49 | + --start-point-hash "$PR_BASE_SHA" \ |
| 50 | + --start-point-clone-thresholds \ |
| 51 | + --start-point-reset \ |
| 52 | + --testbed ubuntu-latest \ |
| 53 | + --err \ |
| 54 | + --adapter rust_gungraun \ |
| 55 | + --github-actions '${{ secrets.GITHUB_TOKEN }}' \ |
| 56 | + --ci-number "$PR_NUMBER" \ |
| 57 | + --file "$BENCHMARK_RESULTS" |
0 commit comments