implement benchmarks in ci #96
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: Go | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
pull-requests: write | |
statuses: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "stable" | |
- name: Build | |
run: go build -v ./... | |
- name: Run Tests and Generate Test Report | |
run: | | |
mkdir -p reports | |
go test -v -json ./... > reports/report.json | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
with: | |
files: 'reports/report.json' | |
check_name: 'Go Tests' | |
comment_title: 'Go Test Results' | |
commit: ${{ github.event.pull_request.head.sha }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
hide_comments: 'all but latest' | |
deduplicate_classes_by_file_name: true | |
benchmark: | |
name: Run Go benchmarks | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.x' | |
- name: Run benchmarks | |
run: | | |
mkdir -p benchmarks | |
go test -bench . -benchmem -run=^$ ./... > benchmarks/benchmark.txt | |
- name: Post Benchmark Results | |
uses: rhysd/github-action-benchmark@v1 | |
with: | |
tool: 'go' | |
output-file-path: 'benchmarks/benchmark.txt' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
ref: 'main' | |
comment-on-alert: true | |
alert-threshold: '15%' | |
fail-on-alert: true | |
summary-always: true |