Repository navigation
355 lines (328 loc) · 13 KB
/
Copy pathci.yml
File metadata and controls
355 lines (328 loc) · 13 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# The merge queue tests each pull request merged onto the queue ahead of it.
merge_group:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
env:
# DuckDB is a CGO dependency.
CGO_ENABLED: "1"
jobs:
duckdb:
name: DuckDB 2 (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm, macos-15, macos-15-intel]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Verify pinned engine, typed Parquet and SQL boundary
run: >-
bash scripts/with-duckdb.sh go test ./internal/engine ./internal/telemetry ./internal/observability ./internal/ingest
-run 'TestPinnedEngine|TestSQLBoundary|TestLogicalType|TestVariant|TestUnsupportedFormat|TestCommitBatchAllocation|TestDependencies|TestExportsBound|TestMaximumAttributeNesting|TestHTTPRejectsExcessiveAttributeNesting'
-count=1
# Every step below runs a justfile recipe, named after it. Reproduce any
# failure locally with the command in the step name — nothing about the gate
# lives only in this file. `just check` is check-static plus the Go and UI
# unit suites; CI runs those three in parallel and adds the race suite.
static:
name: Static checks
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
# Pinned rather than `latest`: the embedded browser bundles are committed
# byte-for-byte and `just ui-check` fails if they drift, so a bun upgrade
# must be a deliberate commit rather than a surprise from a CI run.
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
# The documentation site is npm rather than bun: Astro and Starlight are
# exercised on npm upstream, and the lockfile is what `just site-build`
# installs from.
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.19.0
cache: npm
cache-dependency-path: site/package-lock.json
# `--help` installs the pinned binary without linting; `just check-static`
# runs the real thing, so local and CI share one invocation.
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.14.0
args: --help
- name: just ui-deps
run: just ui-deps
# check-static ends with site-build, which cannot run without these.
# Without it the job fails as exit 127 — `astro: not found` — which reads
# like a broken runner rather than a missing install.
- name: just site-deps
run: just site-deps
# fmt-check, lint, dependency audit, UI asset freshness, docs and site.
- name: just check-static
run: just check-static
- name: just ui-test
run: just ui-test
# The plain suite keeps the allocation and memory ceilings that only build
# without the race detector (`//go:build !race`).
go-test:
name: Go tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
- name: just test
run: just test
- name: Compile opt-in read benchmarks
run: just readbench-check
race-shards:
name: Race shards
runs-on: ubuntu-24.04
outputs:
shards: ${{ steps.shards.outputs.shards }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: shards
run: echo "shards=$(bash scripts/go-race-shards.sh json)" >> "$GITHUB_OUTPUT"
# The slowest packages each get a runner; scripts/go-race-shards.sh owns the
# split, and its "rest" shard takes every other package.
go-race:
name: Go race (${{ matrix.shard }})
needs: race-shards
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
shard: ${{ fromJSON(needs.race-shards.outputs.shards) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
- name: just test-race $(scripts/go-race-shards.sh ${{ matrix.shard }})
env:
SHARD: ${{ matrix.shard }}
run: |
set -euo pipefail
packages=$(bash scripts/go-race-shards.sh "$SHARD")
# shellcheck disable=SC2086 # one argument per package
just test-race $packages
# The required check. A required job that is skipped counts as passed, so
# this one always runs and fails unless every part succeeded.
gate:
name: Gate
needs: [static, go-test, race-shards, go-race]
if: always()
runs-on: ubuntu-24.04
steps:
- env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
echo "results: ${RESULTS}"
for result in ${RESULTS}; do
[ "${result}" = success ] || exit 1
done
# The performance spec runs in its own job so neither group nears Playwright's
# 12-minute global timeout; one worker keeps its timings uncontended.
e2e:
name: Browser ${{ matrix.group }}
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
# The suite runs on one worker, and most of its time is the 1100
# viewport's accessibility and smoke specs, so each 1100 scheme gets a
# runner and the 1440 viewport shares one with the short MCP specs.
- group: smoke and accessibility (1100 light)
slug: smoke-1100-light
skip_performance: "1"
args: --project=app-1100-light
- group: smoke and accessibility (1100 dark)
slug: smoke-1100-dark
skip_performance: "1"
args: --project=app-1100-dark
- group: smoke and accessibility (1440, MCP)
slug: smoke-1440-mcp
skip_performance: "1"
args: --project=app-1440-light --project=app-1440-dark --project=mcp
- group: performance
slug: performance
skip_performance: ""
args: e2e/specs/app/performance.spec.ts
# The local Storybook catalog runs in its own job so the smoke group
# stays inside its timeout; `just check` stays browser-free.
- group: catalog
slug: catalog
skip_performance: "1"
args: ""
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.19.0
- name: just ui-deps
run: just ui-deps
- name: just e2e-browsers
if: startsWith(matrix.slug, 'smoke') || matrix.slug == 'catalog'
run: just e2e-browsers
- name: just design-check
if: matrix.slug == 'catalog'
run: just design-check
- name: just e2e
if: matrix.slug != 'catalog'
run: just e2e ${{ matrix.args }}
env:
PITOT_E2E_SKIP_PERFORMANCE: ${{ matrix.skip_performance }}
- name: Upload browser evidence
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: browser-evidence-${{ matrix.slug }}
path: |
ui/host/playwright-report/
ui/host/test-results/
if-no-files-found: ignore
retention-days: 7
visual:
name: Browser visual
runs-on: ubuntu-24.04
timeout-minutes: 10
container:
image: mcr.microsoft.com/playwright:v1.65.0-noble@sha256:9beb546099e11f52d62e505537914870e01a67e0e6b00ae41da4775324e73dbe
options: --ipc=host
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The browser image lacks unzip, which setup-bun needs.
- name: Install Bun
run: npm install --global bun@1.4.2
- name: Install UI dependencies
run: cd ui/host && bun install --frozen-lockfile
- name: Check image driver version
run: node scripts/playwright-image-check.mjs
- name: Visual comparisons
run: cd ui/host && bun run e2e --project visual
- name: Upload browser evidence and Linux baselines
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: browser-evidence-visual
path: |
ui/host/playwright-report/
ui/host/test-results/
ui/host/e2e/__screenshots__/visual/linux/
if-no-files-found: ignore
retention-days: 7
# Build the exact runtime image on pull requests and in the merge queue, and
# reject high/critical OS, Go-binary, or embedded-secret findings before
# merge. It runs beside Gate rather than after it; both are required.
container-scan:
name: Container scan
if: github.event_name != 'push'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: Build the runtime image
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
load: true
push: false
tags: pitot:ci
build-args: VERSION=sha-${{ github.event.pull_request.head.sha || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Scan the runtime image
uses: aquasecurity/trivy-action@a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 # v0.36.0
with:
image-ref: pitot:ci
version: v0.74.0
scanners: vuln,secret
severity: HIGH,CRITICAL
exit-code: 1
format: table
# Publishes the moving main and commit tags. CalVer images are built natively
# for both architectures by release.yml; pull requests publish nothing.
image:
name: Image
if: github.event_name == 'push'
needs: gate
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Docker meta
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ghcr.io/labstack/pitot
tags: |
type=ref,event=branch
type=sha,prefix=sha-
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# linux/amd64 only: DuckDB needs CGO and the build stage has no cross
# toolchain, so another architecture needs a native runner or QEMU rather
# than an added platform here.
- name: Build and push
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
platforms: linux/amd64
push: true
build-args: |
VERSION=${{ steps.meta.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max