all repos

clerk @ e0c2e3ce1d3441b86ac291687189728c2ded9125

missing tooling for ledger/hledger
1 files changed, 16 insertions(+), 19 deletions(-)
ci: fix benchmarks
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-08-19 16:01:22 +0300
Authored at: 2026-08-19 15:37:25 +0300
Change ID: tunkpyyrnyqxxkqrlpvnyztozsokwvzv
Parent: 5581d44
M .github/workflows/benchmarks.yml
ยทยทยท
        28
        28
                   go install golang.org/x/perf/cmd/benchstat@latest

      
        29
        29
                   echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

      
        30
        30
         

      
        
        31
        +      - name: Checkout base

      
        
        32
        +        if: github.event_name == 'pull_request'

      
        
        33
        +        uses: actions/checkout@v5

      
        
        34
        +        with:

      
        
        35
        +          ref: ${{ github.event.pull_request.base.sha }}

      
        
        36
        +          path: __base

      
        
        37
        +

      
        
        38
        +      - name: Run base benchmarks

      
        
        39
        +        if: github.event_name == 'pull_request'

      
        
        40
        +        working-directory: __base

      
        
        41
        +        run: go test -bench . -benchmem -run '^$' -count=10 -benchtime=200x ./... > ../bench-base.txt 2>&1

      
        
        42
        +

      
        31
        43
               - name: Run benchmarks

      
        32
        44
                 run: go test -bench . -benchmem -run '^$' -count=10 -benchtime=200x ./... > bench.txt 2>&1

      
        33
        45
         

      
        34
        46
               - name: Print benchmark numbers

      
        35
        47
                 run: benchstat bench.txt

      
        36
        48
         

      
        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
        49
               - name: Print comparison

      
        46
        
        -        if: steps.baseline.outputs.cache-hit == 'true'

      
        47
        
        -        run: benchstat bench-baseline.txt bench.txt

      
        
        50
        +        if: github.event_name == 'pull_request'

      
        
        51
        +        run: benchstat bench-base.txt bench.txt

      
        48
        52
         

      
        49
        53
               - name: Check for regressions

      
        50
        
        -        if: steps.baseline.outputs.cache-hit == 'true'

      
        
        54
        +        if: github.event_name == 'pull_request'

      
        51
        55
                 run: |

      
        52
        
        -          benchstat -format csv bench-baseline.txt bench.txt 2>/dev/null | \

      
        
        56
        +          benchstat -format csv bench-base.txt bench.txt 2>/dev/null | \

      
        53
        57
                     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 }}