Repository navigation
67 lines (63 loc) · 2.47 KB
/
Copy pathbench-devloop.yml
File metadata and controls
67 lines (63 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Dev-loop timings on a CI-shaped runner (`make bench-devloop` with cold and
# warm caches): build, generate, lint per linter, probes, tests per package
# with and without -race, and an A/B of the CI test run against a base ref on
# the same machine (separate runs land on different machines; their noise
# hides changes of tens of percent). The report is the run's summary page.
# Run it by hand (Actions > Bench dev loop), or push a branch to bench/<name>
# to compare it with the branch work lands on (dev, or main without one:
# scripts/branches.sh).
name: Bench dev loop
on:
workflow_dispatch:
inputs:
base:
description: Ref to compare against (A/B of the test run on the same machine; empty = origin/dev, else origin/main)
default: ''
rounds:
description: Alternating A/B rounds (the median is compared)
default: '3'
push:
branches: ['bench/**']
permissions:
contents: read
concurrency:
group: bench-${{ github.ref }}
cancel-in-progress: true
jobs:
bench:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable
BENCH_BASE: ${{ inputs.base }}
BENCH_ROUNDS: ${{ inputs.rounds || '3' }}
steps:
# Same Postgres as CI's db shard.
- name: Start Postgres
run: |
docker run -d --name pg -p 5432:5432 -e POSTGRES_PASSWORD=postgres \
--tmpfs /var/lib/postgresql postgres:18-alpine \
-c fsync=off -c synchronous_commit=off -c full_page_writes=off -c max_connections=200
- uses: actions/checkout@v7
with:
fetch-depth: 0 # the A/B base ref
# Read-only: the module cache CI saves. Build and lint caches start
# empty on purpose; the bench measures cold and warm itself.
- uses: actions/cache/restore@v6
with:
path: ~/go/pkg/mod
key: v7-gomod-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: v7-gomod-${{ runner.os }}-
- name: Go toolchain and modules
run: |
go version
go mod download
go mod download -modfile=tools/go.mod
- name: Wait for Postgres
run: |
for _ in $(seq 1 120); do docker exec pg pg_isready -q -h 127.0.0.1 -U postgres && exit 0; sleep 0.5; done
docker logs pg; exit 1
- name: Bench
run: |
. scripts/branches.sh
BENCH_BASE=${BENCH_BASE:-$(landing_ref)} make bench-devloop BENCH_COLD=1