From cfc5fe29bd7faaa2f04a3cd7de2acb466ad104ec Mon Sep 17 00:00:00 2001 From: Martin Hutchinson Date: Mon, 9 Dec 2024 16:55:02 +0000 Subject: [PATCH] Set up benchmark action (#405) Towards #338. --- .github/workflows/benchmark-go.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/benchmark-go.yml diff --git a/.github/workflows/benchmark-go.yml b/.github/workflows/benchmark-go.yml new file mode 100644 index 00000000..b07517c8 --- /dev/null +++ b/.github/workflows/benchmark-go.yml @@ -0,0 +1,36 @@ +name: Benchmark Go + +on: + push: + branches: + - main + +permissions: + # deployments permission to deploy GitHub pages website + deployments: write + # contents permission to update benchmark contents in gh-pages branch + contents: write + # allow posting comments to pull request + pull-requests: write + +jobs: + benchmark: + name: Performance regression check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version-file: go.mod + - name: Run benchmark + run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1.20.4 + with: + tool: 'go' + output-file-path: output.txt + github-token: ${{ secrets.GITHUB_TOKEN }} + auto-push: true + alert-threshold: "150%" + comment-on-alert: true + fail-on-alert: true