| 1 |
name: Run benchmarks |
| 2 |
on: |
| 3 |
pull_request: |
| 4 |
branches: [master] |
| 5 |
|
| 6 |
permissions: |
| 7 |
contents: read |
| 8 |
|
| 9 |
concurrency: |
| 10 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 11 |
cancel-in-progress: true |
| 12 |
|
| 13 |
jobs: |
| 14 |
benchmark: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
steps: |
| 17 |
|
| 18 |
- name: Checkout code |
| 19 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 20 |
with: |
| 21 |
ref: master |
| 22 |
persist-credentials: false |
| 23 |
- name: Install Go |
| 24 |
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 |
| 25 |
with: |
| 26 |
go-version: 'stable' |
| 27 |
- run: | |
| 28 |
go install golang.org/x/perf/cmd/[email protected] |
| 29 |
GOBIN=$PWD go install github.com/aclements/perflock/cmd/perflock@b67f3f23152ff6883a38504154abc9ce4f20a442 |
| 30 |
sudo install ./perflock /usr/bin/perflock |
| 31 |
sudo -b perflock -daemon |
| 32 |
- run: perflock go test -run=none -bench=. -count=6 -benchtime=200ms -timeout=1h ./... > /tmp/prev |
| 33 |
- name: Checkout code |
| 34 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 35 |
with: |
| 36 |
persist-credentials: false |
| 37 |
|
| 38 |
- run: perflock go test -run=none -bench=. -count=6 -benchtime=200ms -timeout=1h ./... > /tmp/curr |
| 39 |
|
| 40 |
- run: benchstat /tmp/prev /tmp/curr |