all repos

clerk @ 122b384

missing tooling for ledger/hledger

clerk/.github/workflows/benchmarks.yml (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ci: report benchstats, 1 month ago
1
name: benchmarks
2
3
on:
4
  push:
5
    branches: [master]
6
  pull_request:
7
  workflow_dispatch:
8
9
concurrency:
10
  group: benchmarks-${{ github.ref }}
11
  cancel-in-progress: true
12
13
permissions:
14
  contents: read
15
16
jobs:
17
  bench:
18
    runs-on: ubuntu-latest
19
    timeout-minutes: 30
20
    steps:
21
      - uses: actions/checkout@v5
22
      - uses: actions/setup-go@v6
23
        with:
24
          go-version-file: go.mod
25
26
      - name: Install benchstat
27
        run: |
28
          go install golang.org/x/perf/cmd/benchstat@latest
29
          echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
30
31
      - name: Run benchmarks
32
        run: go test -bench . -benchmem -run '^$' -count=10 -benchtime=200x ./... > bench.txt 2>&1
33
34
      - name: Print benchmark numbers
35
        run: benchstat bench.txt
36
37
      - name: Restore baseline
38
        id: baseline
39
        uses: actions/cache/restore@v5
40
        with:
41
          path: bench-baseline.txt
42
          key: bench-${{ runner.os }}-${{ github.sha }}
43
          restore-keys: bench-${{ runner.os }}-
44
45
      - name: Print comparison
46
        if: steps.baseline.outputs.cache-hit == 'true'
47
        run: benchstat bench-baseline.txt bench.txt
48
49
      - name: Check for regressions
50
        if: steps.baseline.outputs.cache-hit == 'true'
51
        run: |
52
          benchstat -format csv bench-baseline.txt bench.txt 2>/dev/null | \
53
            python3 .github/scripts/check-bench-regression.py
54
55
      - name: Save baseline
56
        if: github.ref == 'refs/heads/master'
57
        uses: actions/cache/save@v5
58
        with:
59
          path: bench.txt
60
          key: bench-${{ runner.os }}-${{ github.sha }}