Skip to content

Require Go 1.27

Require Go 1.27 #214

Workflow file for this run

name: Benchmark Gate
on:
pull_request:
paths:
- "**.go"
- "go.mod"
- "go.sum"
- ".github/workflows/bench.yml"
concurrency:
group: benchmark-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
BENCH_PACKAGES: ./pack ./packstore ./backup
BENCH_PATTERN: ^(BenchmarkPrepareAndAppendStream|BenchmarkStorePackedReads|BenchmarkStorePackedReadsRaw|BenchmarkMaintenancePackUnpack|BenchmarkBackupCaptureStream|BenchmarkRepoStreamingReads)$
BENCH_COUNT: "6"
BENCH_TIME: 5x
jobs:
benchmark:
name: Streaming benchmark regression gate
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- name: Run candidate benchmarks
run: |
read -r -a packages <<< "${BENCH_PACKAGES}"
go test -run '^$' -bench "${BENCH_PATTERN}" -benchmem \
-count "${BENCH_COUNT}" -benchtime "${BENCH_TIME}" \
"${packages[@]}" | tee "${RUNNER_TEMP}/bench-new.txt"
- name: Run merge-base benchmarks
env:
BASE_REF: ${{ github.base_ref }}
run: |
base=$(git merge-base HEAD "origin/${BASE_REF}")
git worktree add "${RUNNER_TEMP}/bench-base" "${base}"
read -r -a packages <<< "${BENCH_PACKAGES}"
(cd "${RUNNER_TEMP}/bench-base" && \
go test -run '^$' -bench "${BENCH_PATTERN}" -benchmem \
-count "${BENCH_COUNT}" -benchtime "${BENCH_TIME}" \
"${packages[@]}") > "${RUNNER_TEMP}/bench-old.txt"
- name: Compare with merge base
run: go run ./tools/benchgate -old "${RUNNER_TEMP}/bench-old.txt" -new "${RUNNER_TEMP}/bench-new.txt"