Repository navigation
1638 lines (1596 loc) · 67.5 KB
/
Copy pathverify.yml
File metadata and controls
1638 lines (1596 loc) · 67.5 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Verify
on:
pull_request:
# Labelling a pull request `full-verify` (or removing the label) changes how much it runs.
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
merge_group:
# Nightly, main also runs the 5k and 10k-model compile jobs that pull requests and merge groups
# leave out, and opens or updates an issue when it fails.
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
permissions:
contents: read
# Each merge group has its own gh-readonly-queue ref, so queued groups never cancel each other; the
# queue itself discards a group's run when it rebuilds the group. A push to a pull request cancels
# its older run. Adding or removing any label other than `full-verify` starts a run in a group of its
# own that verifies nothing, so it never cancels the pull request's real run. The nightly run has
# its own group, so a manual run on main and the nightly never cancel each other.
concurrency:
group: >-
verify-${{ github.workflow }}-${{ github.event.merge_group.head_ref || github.ref }}${{
(github.event.action == 'labeled' || github.event.action == 'unlabeled')
&& github.event.label.name != 'full-verify' && format('-label-{0}', github.run_id) || '' }}${{
github.event_name == 'schedule' && '-nightly' || '' }}
cancel-in-progress: ${{ github.event_name != 'merge_group' }}
jobs:
changes:
name: Classify verification scope
# A label other than `full-verify` changes nothing this workflow verifies.
if: ${{ !((github.event.action == 'labeled' || github.event.action == 'unlabeled') && github.event.label.name != 'full-verify') }}
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
outputs:
full: ${{ steps.depth.outputs.full }}
partial: ${{ steps.depth.outputs.partial }}
checks: ${{ steps.scope.outputs.checks }}
compiler_differential: ${{ steps.scope.outputs.compiler_differential }}
duckdb: ${{ steps.scope.outputs.duckdb }}
postgres: ${{ steps.scope.outputs.postgres }}
clickhouse: ${{ steps.scope.outputs.clickhouse }}
performance: ${{ steps.scope.outputs.performance }}
format_performance: ${{ steps.scope.outputs.format_performance }}
rules_performance: ${{ steps.scope.outputs.rules_performance }}
wheels: ${{ steps.scope.outputs.wheels }}
recovery: ${{ steps.scope.outputs.recovery }}
ui: ${{ steps.scope.outputs.ui }}
podman: ${{ steps.scope.outputs.podman }}
cold_models: ${{ steps.tiers.outputs.cold_models }}
dense_models: ${{ steps.tiers.outputs.dense_models }}
cache_models: ${{ steps.tiers.outputs.cache_models }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Select relevant suites
id: scope
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
run: |
write_scope() {
{
echo "duckdb=$1"
echo "postgres=$2"
echo "performance=$3"
echo "format_performance=$4"
echo "rules_performance=$5"
echo "checks=$6"
echo "wheels=$7"
echo "compiler_differential=$8"
echo "clickhouse=$9"
echo "recovery=${10}"
echo "ui=${11}"
echo "podman=${12}"
} >> "${GITHUB_OUTPUT}"
}
if [[ "${EVENT_NAME}" != "pull_request" && "${EVENT_NAME}" != "merge_group" ]]; then
write_scope true true true true true true true true true true true true
exit 0
fi
# A merge group's head is its base plus every queued pull request ahead of and including
# this one, so the base..head diff covers the whole group. Anything that prevents an exact
# diff runs everything rather than risk skipping a suite. Three dots compare with the merge
# base, so changes that landed on main after a branch started are not counted as its own.
changed_paths="${RUNNER_TEMP}/changed-paths"
if [[ -z "${BASE_SHA}" || -z "${HEAD_SHA}" ]] || \
! git diff --name-only -z "${BASE_SHA}...${HEAD_SHA}" > "${changed_paths}"; then
echo "Could not diff ${BASE_SHA:-<none>}...${HEAD_SHA:-<none>}; running every suite" >&2
write_scope true true true true true true true true true true true true
exit 0
fi
# Succeeds when every change is a release metadata change: the manifest, the changelog,
# or version lines of the package and lock files, so no dependency or build setting
# moves. Keep the file list in sync with the release checks in release-please.yml.
release_metadata_only() {
local path diff offending changed_any=false
local metadata_paths="${RUNNER_TEMP}/release-metadata-paths"
local version='[0-9]+\.[0-9]+\.[0-9]+'
local version_line="^[-+](version = \"${version}\""
version_line+="| \"[a-z0-9_-]+==${version}\", # x-release-please-version)\$"
git diff --name-only --no-renames -z "${BASE_SHA}...${HEAD_SHA}" > "${metadata_paths}" \
|| return 1
while IFS= read -r -d '' path; do
changed_any=true
case "${path}" in
.release-please-manifest.json|CHANGELOG.md) ;;
crates/sqlbuild-cli/Cargo.toml|crates/sqlbuild-python/Cargo.toml|Cargo.lock|pyproject.toml|uv.lock)
diff="$(git diff -U0 --text --no-color --no-renames "${BASE_SHA}...${HEAD_SHA}" -- "${path}")" \
|| return 1
offending="$(awk '/^@@/ { hunk = 1; next } hunk && /^[-+]/' <<< "${diff}" \
| grep -Ev "${version_line}" || true)"
if [[ -n "${offending}" ]]; then
echo "${path} changes more than version lines:" >&2
echo "${offending}" >&2
return 1
fi
;;
*) return 1 ;;
esac
done < "${metadata_paths}"
[[ "${changed_any}" == "true" ]]
}
# Release Please pull requests change only release metadata on top of product code that
# already passed every suite before it reached main, so the suites are skipped. Their
# required Verify status is posted only by the trusted release checks in
# release-please.yml after the metadata, version and distribution checks pass; the
# verify job below reports under another name on Release Please branches.
# A merge group is judged by its content alone: one whose whole diff is release metadata
# carries only a release pull request whose product code already passed on main.
if { [[ "${EVENT_NAME}" == "merge_group" ]] \
|| [[ "${EVENT_NAME}" == "pull_request" \
&& "${HEAD_REPOSITORY}" == "${GITHUB_REPOSITORY}" \
&& "${HEAD_REF}" == release-please--branches--* ]]; } && release_metadata_only; then
echo "The change is only release metadata; skipping the suites" \
| tee -a "${GITHUB_STEP_SUMMARY}"
write_scope false false false false false false false false false false false false
exit 0
fi
duckdb=false
postgres=false
clickhouse=false
performance=false
format_performance=false
rules_performance=false
wheels=false
compiler_differential=false
recovery=false
ui=false
podman=false
broad=false
changed=false
# A change that only touches the website, root-level Markdown, the README demo GIFs or the
# skill pages generated from the website docs skips the Python checks and test suites.
# The website builds in its own workflow.
docs_only=true
# A change that only touches the web UI (and documentation) runs the UI checks and the
# wheels that embed its build, but not the Python and native checks it cannot affect.
ui_only=true
while IFS= read -r -d '' path; do
changed=true
case "${path}" in
website/*|.github/workflows/website.yml|.github/demos/*) ;;
src/sqlbuild/.agents/skills/sqlbuild/references/docs/*.md) ;;
*/*) docs_only=false ;;
*.md) ;;
*) docs_only=false ;;
esac
case "${path}" in
ui/*|website/*|.github/workflows/website.yml|.github/demos/*) ;;
src/sqlbuild/.agents/skills/sqlbuild/references/docs/*.md) ;;
*/*) ui_only=false ;;
*.md) ;;
*) ui_only=false ;;
esac
case "${path}" in
# Rust test crates and modules that only `cargo test` compiles; they are not in the
# native build identity and never reach a wheel.
crates/sqlbuild-cli/tests/*|crates/sqlbuild-orchestration/tests/*) ;;
crates/*|ui/*|Cargo.toml|Cargo.lock|pyproject.toml|.github/workflows/verify.yml|.github/workflows/build-distributions.yml|deploy/Dockerfile|deploy/project/*|deploy/compose*|compose.yml|.dockerignore|Makefile|tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_compose.py|tests/integration/src/sqlbuild/compiler/compiled_project/publication/docker/compose/*|benchmarks/duckshop/edge_cases/orchestration/container_deployment.json)
wheels=true
;;
esac
case "${path}" in
ui/*|clients/typescript/*|.github/workflows/verify.yml|website/src/assets/logo-light.png|website/src/assets/logo-dark.png|website/public/favicon.png)
# The web UI's own checks and unit tests; the wheels embed its build. It compiles
# against the generated control client, so client changes run them too, and it
# imports the website's logos and favicon, so moving them fails its build.
ui=true
;;
esac
case "${path}" in
crates/sqlbuild-orchestration/*|crates/sqlbuild-process-ownership/*|crates/sqlbuild-cli/*|Cargo.toml|Cargo.lock|.github/workflows/verify.yml)
recovery=true
;;
esac
case "${path}" in
# The reference stack and the Docker launcher, which Podman serves through its
# Docker-compatible API.
# Every path here also selects the wheels the job installs.
deploy/Dockerfile|deploy/project/*|deploy/compose*|compose.yml|.dockerignore|crates/sqlbuild-cli/src/workers/*|crates/sqlbuild-cli/src/server_config/*|tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_compose.py|tests/integration/src/sqlbuild/compiler/compiled_project/publication/docker/compose/*|.github/workflows/verify.yml)
podman=true
;;
esac
case "${path}" in
scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|tests/goldens/*|tests/e2e/fixtures/*|website/examples/*|.github/workflows/verify.yml|Makefile)
compiler_differential=true
;;
esac
case "${path}" in
crates/sqlbuild-cli/tests/*|crates/sqlbuild-orchestration/tests/*)
# Native checks and the scheduler recovery suite run these tests; the Python,
# warehouse, wheel and timing suites cannot see them.
;;
crates/*|Cargo.toml|Cargo.lock|pyproject.toml|uv.lock)
broad=true
performance=true
format_performance=true
rules_performance=true
;;
src/sqlbuild/compiler/*|src/sqlbuild/adapter/type_system/*)
broad=true
performance=true
rules_performance=true
;;
benchmarks/duckshop-10k/*|src/sqlbuild/executor/testing/*|scripts/cold_compile_performance/*|scripts/compile_performance_ratio/*|scripts/compare_compile_performance.py|tests/e2e/src/sqlbuild/cli/commands/main/compile/*)
broad=true
performance=true
;;
src/sqlbuild/executor/build/*|src/sqlbuild/executor/run/*|src/sqlbuild/presentation/*)
# Inspection, plan, and build guards run inside the fresh-process compile jobs.
broad=true
performance=true
;;
src/sqlbuild/rule_engine/*|src/sqlbuild/lint/*|scripts/rules_benchmark/*|scripts/benchmark_rules_ci.py)
broad=true
performance=true
format_performance=true
rules_performance=true
;;
tests/e2e/src/sqlbuild/cli/commands/main/format/*)
duckdb=true
format_performance=true
;;
tests/e2e/src/sqlbuild/cli/commands/main/postgres/*|tests/integration/src/sqlbuild/adapters/postgres/*|tests/integration/src/sqlbuild/runtime/execution_history/*)
postgres=true
;;
src/sqlbuild/adapters/clickhouse/*|tests/e2e/src/sqlbuild/cli/commands/main/clickhouse/*|tests/integration/src/sqlbuild/adapters/clickhouse/*)
clickhouse=true
;;
tests/e2e/*)
duckdb=true
;;
tests/unit/*|tests/integration/*)
;;
ui/*)
;;
.github/workflows/verify.yml|Makefile)
performance=true
format_performance=true
rules_performance=true
;;
.github/*|docs/*|website/*|*.md|.gitignore|LICENSE)
;;
*)
broad=true
;;
esac
done < "${changed_paths}"
if [[ "${changed}" != "true" ]]; then
write_scope true true true true true true true true true true true true
exit 0
fi
checks=true
if [[ "${docs_only}" == "true" || "${ui_only}" == "true" ]]; then
checks=false
fi
if [[ "${broad}" == "true" ]]; then
duckdb=true
postgres=true
clickhouse=true
format_performance=true
compiler_differential=true
fi
write_scope \
"${duckdb}" \
"${postgres}" \
"${performance}" \
"${format_performance}" \
"${rules_performance}" \
"${checks}" \
"${wheels}" \
"${compiler_differential}" \
"${clickhouse}" \
"${recovery}" \
"${ui}" \
"${podman}"
# Pull requests and merge groups run the 3k-model compile jobs and the 1k dense job; the
# nightly run and manual runs add 5k and 10k. Budgets and ratio gates are the same in both.
- name: Choose the compile-performance model counts
id: tiers
env:
ALL: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
run: |
if [[ "${ALL}" == "true" ]]; then
echo "cold_models=[3000, 5000, 10000]"
echo "dense_models=[1000, 3000, 5000, 10000]"
echo "cache_models=[3000, 5000, 10000]"
else
echo "cold_models=[3000]"
echo "dense_models=[1000, 3000]"
echo "cache_models=[3000]"
fi >> "${GITHUB_OUTPUT}"
# Pull requests run the fast Linux core: static checks, unit and integration tests, native
# workspace checks and the UI checks. The rest of the matrix (wheels, Compose, Windows, macOS,
# DuckDB E2E, warehouse, compiler-golden and timing jobs) runs only once a pull request is
# labelled `full-verify` and is not a draft, and always on merge groups and manual runs. A
# run that leaves out suites its change needs reports under another name, so the required
# Verify stays missing and blocks the merge until the full matrix has passed. When the
# repository variable SQLBUILD_MERGE_QUEUE is true, the merge queue runs the full matrix on
# every group before it merges, so a passing fast core reports as Verify and each pull
# request runs the heavy suites once, in the queue. Unsetting the variable restores the old
# behaviour.
# GitHub takes the required Verify from the newest Verify check suite on the head. Re-running
# an older suite never repaints it: to recover a head whose newest suite reported another
# name, start a new suite (push, or remove and re-add full-verify), not a rerun.
# The label and draft state come from the pull request as it is now, not the event payload:
# `gh pr create --label` can deliver `labeled` before `opened`, and the later run cancels the
# earlier one, so the surviving run must still see the label.
- name: Choose the fast core or the full matrix
id: depth
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAVY_SELECTED: >-
${{ steps.scope.outputs.duckdb == 'true' || steps.scope.outputs.postgres == 'true' || steps.scope.outputs.clickhouse == 'true' || steps.scope.outputs.performance == 'true' || steps.scope.outputs.format_performance == 'true' || steps.scope.outputs.rules_performance == 'true' || steps.scope.outputs.wheels == 'true' || steps.scope.outputs.compiler_differential == 'true' || steps.scope.outputs.recovery == 'true' }}
run: |
FULL=true
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
FULL="$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" \
--jq 'any(.labels[]; .name == "full-verify") and (.draft | not)')"
fi
partial=false
if [[ "${FULL}" != "true" && "${HEAVY_SELECTED}" == "true" ]]; then
partial=true
echo "Fast core only: the full-verify label, or the merge queue when it verifies groups, runs the full matrix" \
| tee -a "${GITHUB_STEP_SUMMARY}"
fi
{
echo "full=${FULL}"
echo "partial=${partial}"
} >> "${GITHUB_OUTPUT}"
lockfile:
name: Lockfile consistency
if: ${{ !((github.event.action == 'labeled' || github.event.action == 'unlabeled') && github.event.label.name != 'full-verify') }}
runs-on: ubuntu-24.04
steps:
# Release Please pushes its version bump before release-please.yml refreshes Cargo.lock and
# uv.lock in a commit of its own, so a bump head always disagrees with its lockfiles. That
# head waits for the refresh commit, whose run checks the lockfiles. The refresh step itself
# runs cargo metadata --locked and uv sync --locked before it commits, and the merge queue
# always checks the lockfiles.
- name: Wait for the release lockfile refresh
id: release
if: >-
github.event_name == 'pull_request'
&& github.event.pull_request.head.repo.full_name == github.repository
&& startsWith(github.event.pull_request.head.ref, 'release-please--branches--')
env:
GH_TOKEN: ${{ github.token }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
subject="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${HEAD_SHA}" \
--jq '.commit.message | split("\n")[0]')"
if [[ "${subject}" != "chore: refresh release lockfiles" ]]; then
echo "pending=true" >> "${GITHUB_OUTPUT}"
echo "Version bump ${HEAD_SHA}: the lockfile refresh commit's run checks the lockfiles" \
| tee -a "${GITHUB_STEP_SUMMARY}"
fi
- uses: actions/checkout@v4
if: steps.release.outputs.pending != 'true'
- uses: ./.github/actions/setup-uv
if: steps.release.outputs.pending != 'true'
with:
version: "0.12.3"
- uses: dtolnay/rust-toolchain@master
if: steps.release.outputs.pending != 'true'
with:
toolchain: stable
- name: Install Python
if: steps.release.outputs.pending != 'true'
run: uv python install 3.12
- name: Verify lockfile
if: steps.release.outputs.pending != 'true'
run: uv lock --check --python 3.12
- name: Verify native workspace lockfile
if: steps.release.outputs.pending != 'true'
run: cargo metadata --locked --format-version 1 > /dev/null
# The extension and CLI build once here; the static job and every test shard install these
# wheels instead of compiling them again.
native_build:
name: Build the extension and CLI wheels
needs: [changes, lockfile]
if: needs.changes.outputs.checks == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
# Restores the native dependency builds that rust-cache.yml saves on main; workspace crates
# always build from source. Verify never saves: a pull request or merge queue cache is
# visible only to its own ref. Jobs that run the same cargo builds share a key.
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-checks
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install the build tools without building the packages
run: uv sync --locked --all-groups --all-extras --no-install-package sqlbuild --no-install-package sqlbuild-cli
- name: Build the extension and CLI wheels
run: |
uv run --no-sync maturin build --release --compatibility linux --out dist
uv run --no-sync maturin build --manifest-path crates/sqlbuild-cli/Cargo.toml --release --compatibility linux --out dist
- uses: actions/upload-artifact@v4
with:
name: verify-native-wheels
path: dist/*.whl
if-no-files-found: error
compression-level: 0
# Long enough for "Re-run failed jobs" on a shard, which reuses this run's wheels.
retention-days: 3
overwrite: true
checks:
name: Static checks
needs: [changes, lockfile, native_build]
if: needs.changes.outputs.checks == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
# A syncing `uv run` would replace the installed wheels with a fresh editable build.
UV_NO_SYNC: "1"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
# Clippy in check-ci builds its own check artifacts from the same cache as the native checks.
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-checks
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install dependencies without building the packages
run: uv sync --locked --all-groups --all-extras --no-install-package sqlbuild --no-install-package sqlbuild-cli
- uses: actions/download-artifact@v4
with:
name: verify-native-wheels
path: dist
- name: Install the prebuilt extension and CLI
run: uv pip install --no-deps dist/*.whl
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: clients/typescript/package-lock.json
- name: Fetch the base for the new-duplicate check
run: git fetch --no-tags --depth=1 origin "$BASE_REF"
env:
BASE_REF: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || 'main:refs/remotes/origin/main' }}
- name: Run static checks
run: make check-ci
env:
DUPES_BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || 'origin/main' }}
tests:
# check-test-shards, part of the static checks, proves that the TEST_SHARD_*_PATHS lists in
# the Makefile run every test once; each of those lists needs an entry here.
name: Unit + integration tests (${{ matrix.name }})
needs: [changes, lockfile, native_build]
if: needs.changes.outputs.checks == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: core
target: test-shard-core
workers: "4"
- name: publication
target: test-shard-publication
workers: "2"
- name: warehouse history
target: test-shard-history
workers: "4"
env:
UV_NO_SYNC: "1"
PYTEST_XDIST_AUTO_NUM_WORKERS: ${{ matrix.workers }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
- name: Install Python
run: uv python install 3.12
- name: Install dependencies without building the packages
run: uv sync --locked --all-groups --all-extras --no-install-package sqlbuild --no-install-package sqlbuild-cli
- uses: actions/download-artifact@v4
with:
name: verify-native-wheels
path: dist
- name: Install the prebuilt extension and CLI
run: uv pip install --no-deps dist/*.whl
- name: Prepare Docker worker tests
run: |
docker info > /dev/null
docker pull alpine:3.23
- name: Run unit and integration tests
env:
SQLBUILD_REQUIRE_DOCKER_TESTS: "1"
run: make ${{ matrix.target }}
native_checks:
name: Native workspace checks
needs: [changes, lockfile]
if: needs.changes.outputs.checks == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-checks
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install native test dependencies without rebuilding the packages
run: uv sync --locked --all-groups --all-extras --no-install-package sqlbuild --no-install-package sqlbuild-cli
- name: Run native checks
env:
UV_NO_SYNC: "1"
PYO3_PYTHON: ${{ github.workspace }}/.venv/bin/python
run: make rust-check
e2e_shards:
name: DuckDB E2E (${{ matrix.name }})
needs: [changes, lockfile]
if: needs.changes.outputs.duckdb == 'true' && needs.changes.outputs.full == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- name: build core
target: test-e2e-duckdb-build-core
- name: build incremental
target: test-e2e-duckdb-build-incremental
- name: CLI data
target: test-e2e-duckdb-cli-data
- name: CLI commands
target: test-e2e-duckdb-cli
- name: CLI inspection
target: test-e2e-duckdb-inspection
- name: integrations
target: test-e2e-duckdb-integrations
env:
PYTEST_XDIST_AUTO_NUM_WORKERS: "4"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-linux
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --locked --all-groups --all-extras
- name: Report runner CPU topology
run: |
echo "nproc=$(nproc)"
echo "online_processors=$(getconf _NPROCESSORS_ONLN)"
lscpu
uv run python - <<'PY'
import os
print(f"os.cpu_count={os.cpu_count()}")
print(f"sched_getaffinity={sorted(os.sched_getaffinity(0))}")
print(
"PYTEST_XDIST_AUTO_NUM_WORKERS="
f"{os.environ.get('PYTEST_XDIST_AUTO_NUM_WORKERS', '<unset>')}"
)
PY
- name: Validate diagnostic encryption recipient
if: matrix.target == 'test-e2e-duckdb-cli'
run: openssl x509 -in .github/diagnostics-recipient.pem -noout
- name: Run DuckDB E2E shard
env:
SQLBUILD_COMPARISON_ENCRYPTED_DIR: ${{ matrix.target == 'test-e2e-duckdb-cli' && format('{0}/comparison-encrypted', runner.temp) || '' }}
SQLBUILD_COMPARISON_RECIPIENT: ${{ github.workspace }}/.github/diagnostics-recipient.pem
run: make ${{ matrix.target }}
- name: Retain encrypted comparison failures
if: failure() && matrix.target == 'test-e2e-duckdb-cli'
uses: actions/upload-artifact@v4
with:
name: encrypted-comparison-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/comparison-encrypted/failure-*/failure.cms
if-no-files-found: warn
compression-level: 0
retention-days: 7
compiler_differential:
name: Compiler golden outputs
needs: [changes, lockfile]
if: needs.changes.outputs.compiler_differential == 'true' && needs.changes.outputs.full == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-linux
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --locked --all-groups --all-extras
- name: Check fixtures, examples, generated seeds and the failure corpus against the goldens
run: >-
make compiler-differential
COMPILER_DIFFERENTIAL_ARGS="--stage-captures --require-discovery-coverage
--require-render-coverage --require-analysis-coverage
--evidence-dir ${{ runner.temp }}/compiler-differential-evidence"
- name: Upload failing projects' targets, stderr and compiled-test stats
if: failure()
uses: actions/upload-artifact@v4
with:
name: compiler-differential-evidence-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/compiler-differential-evidence
if-no-files-found: warn
retention-days: 30
compiler_differential_python_versions:
name: Native compiler on Python ${{ matrix.python }}
needs: [changes, lockfile]
if: needs.changes.outputs.compiler_differential == 'true' && needs.changes.outputs.full == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
python: ["3.13", "3.14"]
env:
UV_PYTHON: ${{ matrix.python }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-linux
save-if: false
- name: Install Python
run: uv python install ${{ matrix.python }}
- name: Install dependencies
run: uv sync --locked --all-groups --all-extras --python ${{ matrix.python }}
- name: Check fixtures, examples, the failure corpus and a few seeds against the goldens
env:
PYTHONUNBUFFERED: "1"
run: >-
uv run --no-sync python -m scripts.run_compiler_differential
--goldens check
--corpus fixtures examples failures seeds --seeds 4 --jobs 4
native_discovery_windows:
name: Native compiler on Windows
needs: [changes, lockfile]
if: needs.changes.outputs.compiler_differential == 'true' && needs.changes.outputs.full == 'true'
runs-on: windows-2025
timeout-minutes: 45
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-windows
save-if: false
- name: Test the native discovery crate (walk, junctions, ordering, read errors)
run: cargo test --locked -p sqlbuild-discovery
- name: Install Python
run: uv python install 3.12
- name: Install SQLBuild and pytest
run: |
uv sync --locked --no-dev --python 3.12
uv pip install "pytest>=8.4.2" "pytest-xdist>=3.8.0"
- name: Check the native YAML and TOML readers and the lineage fingerprint with this Python
run: >-
uv run --no-sync pytest
tests/integration/src/sqlbuild/compiler/discovery/test_native_yaml_oracle.py
tests/integration/src/sqlbuild/compiler/discovery/test_native_toml_oracle.py
tests/unit/src/sqlbuild/cli/commands/_helpers/lineage/test_cache.py
-n auto --dist loadfile
- name: Compile and build playground projects
run: |
project="${RUNNER_TEMP}/waffle-shop"
uv run --no-sync sqb playground "${project}"
uv run --no-sync sqb --project-dir "${project}" --no-color compile
if ! test -f "${project}/target/cache/compiler-native-v1/macro-calls.bin"; then
echo "The compile did not write the macro-call store; macro bridge debug log:"
rm -rf "${project}/target"
uv run --no-sync sqb --project-dir "${project}" --no-color --debug compile 2>&1 \
| grep "macro_bridge" || true
exit 1
fi
uv run --no-sync sqb --project-dir "${project}" --no-color build
nodes="${RUNNER_TEMP}/python-nodes"
uv run --no-sync sqb playground --template python_nodes "${nodes}"
uv run --no-sync sqb --project-dir "${nodes}" --no-color compile
scheduler_recovery:
name: Scheduler recovery (${{ matrix.name }})
needs: [changes, lockfile]
if: needs.changes.outputs.recovery == 'true' && needs.changes.outputs.full == 'true'
runs-on: ${{ matrix.runner }}
timeout-minutes: 75
strategy:
fail-fast: false
matrix:
include:
- name: macOS
runner: macos-15
test_threads: 3
- name: Windows
runner: windows-2025
test_threads: 2
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-recovery-${{ matrix.name }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Start a native PostgreSQL server
run: |
if [[ "${RUNNER_OS}" == "macOS" ]]; then
brew install --quiet postgresql@16
bin="$(brew --prefix postgresql@16)/bin"
else
bin="$(cygpath -u "${PGBIN}")"
fi
data="${RUNNER_TEMP}/postgres-data"
"${bin}/initdb" -D "${data}" -U postgres --auth=trust -E UTF8 > /dev/null
"${bin}/pg_ctl" -D "${data}" -o "-p 5433 -c listen_addresses=127.0.0.1" \
-l "${RUNNER_TEMP}/postgres.log" -w start
- name: Worker claim ownership, recovery and stop
run: cargo test --locked -p sqlbuild-process-ownership
- name: sqlbuild forwarder arguments, exit codes, streams, signals and missing sqb
run: cargo test --locked -p sqlbuild-cli --test launcher
- name: Control store, scheduler and recovery contracts on SQLite and PostgreSQL
env:
SQLBUILD_TEST_CONTROL_POSTGRES_URL: postgresql://[email protected]:5433/postgres
run: cargo test --locked -p sqlbuild-orchestration --lib -- --test-threads=${{ matrix.test_threads }}
- name: PostgreSQL server log
if: failure()
run: cat "${RUNNER_TEMP}/postgres.log" || true
format_performance:
name: Formatter performance guards
needs: [changes, lockfile]
if: needs.changes.outputs.format_performance == 'true' && needs.changes.outputs.full == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-linux
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --locked --all-groups --all-extras --python 3.12
- name: Run formatter performance guards
timeout-minutes: 10
run: >-
uv run pytest
tests/e2e/src/sqlbuild/cli/commands/main/format/test_format_performance.py
-n auto --dist loadfile -m performance
performance:
name: Performance guards
needs: [changes, lockfile]
# Temporarily disabled while the Blacksmith runner allowance is unavailable.
# These budgets are calibrated for the 8-vCPU Blacksmith runner.
if: false
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-linux
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --locked --all-groups --all-extras
- name: Run performance guards
run: make test-e2e-performance
cold_compile_performance:
name: Fresh-process compile (${{ matrix.models }} models)
needs: [changes, lockfile]
if: needs.changes.outputs.performance == 'true' && needs.changes.outputs.full == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
models: ${{ fromJSON(needs.changes.outputs.cold_models) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: verify-linux
save-if: false
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --locked --all-groups --all-extras
- name: Run fresh-process compile guard under 4 GiB
env:
BENCHMARK_MODELS: ${{ matrix.models }}
MEMORY_LIMIT_BYTES: "4294967296"
run: |
sudo systemd-run \
--unit="sqlbuild-cold-${BENCHMARK_MODELS}-${GITHUB_RUN_ID}" \
--uid="$(id -u)" \
--gid="$(id -g)" \
--same-dir \
--setenv="HOME=${HOME}" \
--setenv="PATH=${PATH}" \
--setenv="SQLBUILD_REQUIRE_MEMORY_LIMIT_BYTES=${MEMORY_LIMIT_BYTES}" \
--property="MemoryMax=${MEMORY_LIMIT_BYTES}" \
--property="MemorySwapMax=0" \
--wait \
--collect \
--pipe \
make test-e2e-cold-compile-performance \
SQLBUILD_BENCHMARK_MODELS="${BENCHMARK_MODELS}"
dense_compile_performance:
name: Dense all-rules compile (${{ matrix.models }} models)
needs: [changes, lockfile]
if: needs.changes.outputs.performance == 'true' && needs.changes.outputs.full == 'true'
runs-on: ubuntu-24.04
# The 3k and 10k cells also run the delta edit-loop guard, about five minutes at 10k.
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
models: ${{ fromJSON(needs.changes.outputs.dense_models) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
with:
version: "0.12.3"
enable-cache: true
cache-dependency-glob: |
uv.lock
Cargo.lock
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable