Add PR benchmarking #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Benchmarks on AMD64 | |
permissions: read-all | |
on: [pull_request] | |
jobs: | |
benchmark-pull-request: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
with: | |
fetch-depth: 0 | |
- id: goversion | |
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ steps.goversion.outputs.goversion }} | |
- name: Install Benchstat | |
run: make install-benchstat | |
- name: Run Benchmarks | |
run: | | |
BENCHSTAT_FORMAT=csv BENCHSTAT_OUTPUT_FILE=result.csv make test-benchmark-compare REF=${{ github.event.pull_request.head.sha }} | |
echo "$(head -n1 result.csv),,," > output.csv # Add three missing cols from header | |
tail -n+2 result.csv >> output.csv | |
- name: Read CSV | |
id: read-csv | |
uses: juliangruber/read-file-action@b549046febe0fe86f8cb4f93c24e284433f9ab58 # v1.1.7 | |
with: | |
path: ./output.csv | |
- name: Create Markdown Table | |
uses: petems/csv-to-md-table-action@401501a2cdf2512164c1be3b70411976a2b838b9 # v4.0.0 | |
id: csv-table-output | |
with: | |
csvinput: ${{ steps.read-csv.outputs.content }} | |
- run: | | |
echo "${{ steps.csv-table-output.outputs.markdown-table }}" >> "$GITHUB_STEP_SUMMARY" | |
echo "<hr />" >> "$GITHUB_STEP_SUMMARY" | |
echo "This section contains three tables generated by benchstat:" >> "$GITHUB_STEP_SUMMARY" | |
echo "1. Seconds per operation" >> "$GITHUB_STEP_SUMMARY" | |
echo "2. Bytes per operation" >> "$GITHUB_STEP_SUMMARY" | |
echo "3. Allocations per operation" >> "$GITHUB_STEP_SUMMARY" | |
echo "" >> "$GITHUB_STEP_SUMMARY" | |
echo 'The tables"show the median and 70% confidence interval (CI) summaries for each benchmark comparing the HEAD and the BASE of the Pull Request, and an A/B comparison under "vs base". The last column shows the statistical p-value with three runs (n=3).' >> "$GITHUB_STEP_SUMMARY" | |
echo "The last row has the Geometric Mean (geomean) for the given table." >> "$GITHUB_STEP_SUMMARY" | |
echo "Refer to [benchstat's help](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat) for more help." >> "$GITHUB_STEP_SUMMARY" |