name: Run benchmarks on: pull_request: branches: [master] permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: benchmark: runs-on: ubuntu-latest steps: # Base for comparison is master branch. - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: ref: master persist-credentials: false - name: Install Go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 with: go-version: 'stable' - run: | go install golang.org/x/perf/cmd/benchstat@v0.0.0-20260409210113-8e83ce0f7b1c GOBIN=$PWD go install github.com/aclements/perflock/cmd/perflock@b67f3f23152ff6883a38504154abc9ce4f20a442 sudo install ./perflock /usr/bin/perflock sudo -b perflock -daemon - run: perflock go test -run=none -bench=. -count=6 -benchtime=200ms -timeout=1h ./... > /tmp/prev - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false # Second run of benchmarks - run: perflock go test -run=none -bench=. -count=6 -benchtime=200ms -timeout=1h ./... > /tmp/curr - run: benchstat /tmp/prev /tmp/curr