.github: fix security vuln #93
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: Benchmark | |
"on": | |
- pull_request | |
jobs: | |
benchmark: | |
strategy: | |
matrix: | |
ref: | |
- master | |
- ${{ github.sha }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.21" | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ matrix.ref }} | |
- name: Run Benchmarks | |
# Without 6 iterations, benchstat will claim statistical insignificance. | |
run: go test -v -run '^$' -bench '(Marshal|Unmarshal)$/codeResponse' -benchmem -benchtime 3s -cpu 1 -count 6 ./json | tee bench.txt | |
- name: Upload Benchmarks | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.ref }} | |
path: bench.txt | |
benchstat: | |
needs: [benchmark] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Steup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.21" | |
- name: Setup Benchstat | |
run: go install golang.org/x/perf/cmd/benchstat@latest | |
- name: Download Benchmark Results | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
- name: Run Benchstat | |
run: benchstat ./master/bench.txt ./${{ github.sha }}/bench.txt | tee benchstat.txt | |
- name: Upload Benchstat Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchstat | |
path: benchstat.txt |