2023-01-17 15:04:22 +00:00
|
|
|
name: "Benchmark testing"
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
Benchmark-Test:
|
|
|
|
name: "Benchmark tests"
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
# note: we want benchmarks to run on pull_request events in order to publish results to a sticky comment, and
|
|
|
|
# we also want to run on push such that merges to main are recorded to the cache. For this reason we don't filter
|
|
|
|
# the job by event.
|
|
|
|
steps:
|
2023-09-07 13:57:51 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-17 15:04:22 +00:00
|
|
|
|
|
|
|
- name: Bootstrap environment
|
|
|
|
uses: ./.github/actions/bootstrap
|
|
|
|
|
|
|
|
- name: Restore base benchmark result
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: test/results/benchmark-main.txt
|
|
|
|
# use base sha for PR or new commit hash for main push in benchmark result key
|
|
|
|
key: ${{ runner.os }}-bench-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
|
|
|
|
|
|
|
|
- name: Run benchmark tests
|
|
|
|
id: benchmark
|
|
|
|
run: |
|
|
|
|
REF_NAME=${GITHUB_REF##*/} make benchmark
|
|
|
|
OUTPUT=$(make show-benchstat)
|
|
|
|
OUTPUT="${OUTPUT//'%'/'%25'}" # URL encode all '%' characters
|
|
|
|
OUTPUT="${OUTPUT//$'\n'/'%0A'}" # URL encode all '\n' characters
|
|
|
|
OUTPUT="${OUTPUT//$'\r'/'%0D'}" # URL encode all '\r' characters
|
2023-04-03 13:36:11 +00:00
|
|
|
echo "result=$OUTPUT" >> $GITHUB_OUTPUT
|
2023-01-17 15:04:22 +00:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: benchmark-test-results
|
|
|
|
path: test/results/**/*
|
|
|
|
|
|
|
|
- name: Update PR benchmark results comment
|
|
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
header: benchmark
|
|
|
|
message: |
|
|
|
|
### Benchmark Test Results
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>Benchmark results from the latest changes vs base branch</summary>
|
|
|
|
|
|
|
|
```
|
|
|
|
${{ steps.benchmark.outputs.result }}
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|