Repository navigation
940 lines (809 loc) · 34.5 KB
/
Copy pathci.yml
File metadata and controls
940 lines (809 loc) · 34.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
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
# Non-PR runs get a unique suffix so queued main runs are retained too.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event_name == 'pull_request' && 'pr' || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
python:
name: Python ${{ matrix.python-version }} (${{ matrix.engine }} engine)
# The locked Playwright release does not support Ubuntu 26.04 yet.
runs-on: ubuntu-24.04
env:
UV_PYTHON: ${{ matrix.python-version }}
SQLCTX_ENGINE: ${{ matrix.engine }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
engine: [python]
include:
- python-version: "3.12"
engine: rust
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Install uv
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install core dependencies
run: uv sync --extra dev
- name: Check core import without DAX extra
run: |
uv run python - <<'PY'
import sys
from sqlctx import Dimension, Metric, Model
assert Model.__name__ == "Model"
assert Dimension.__name__ == "Dimension"
assert Metric.__name__ == "Metric"
assert "sqlctx_dax" not in sys.modules
PY
- name: Install Rust, DAX, and MCP Apps test dependencies
run: uv sync --extra dev --extra rust --extra dax --extra apps
- name: Install browser test runtime
run: uv run python -m playwright install --with-deps chromium
- name: Check version consistency
run: |
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
INIT_VERSION=$(grep '^__version__ = ' sqlctx/__init__.py | sed 's/__version__ = "\(.*\)"/\1/')
if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then
echo "Version mismatch: pyproject.toml=$PYPROJECT_VERSION, __init__.py=$INIT_VERSION"
exit 1
fi
echo "Version check passed: $PYPROJECT_VERSION"
- name: Run ruff check
run: uv run ruff check . --exclude docs/_extensions --exclude sqlctx-duckdb/extension-ci-tools --exclude sqlctx-duckdb/scripts --exclude sqlctx-duckdb/duckdb --exclude sqlctx/adapters/malloy_grammar --exclude sqlctx/adapters/holistics_grammar
- name: Run ruff format check
run: uv run ruff format --check . --exclude docs/_extensions --exclude sqlctx-duckdb/extension-ci-tools --exclude sqlctx-duckdb/scripts --exclude sqlctx-duckdb/duckdb --exclude sqlctx/adapters/malloy_grammar --exclude sqlctx/adapters/holistics_grammar
- name: Check public API types
run: |
uv run mypy
uv run mypy --config-file tests/typing/mypy.ini tests/typing/package_consumer.py
- name: Check typed package marker
run: |
uv build --wheel
unzip -l dist/*.whl | grep -q 'sqlctx/py.typed'
- name: Run Python reference suite
if: matrix.engine == 'python'
run: uv run --with adbc-driver-sqlite pytest -v --test-engine python --cov-fail-under=76 --junitxml=test-results.xml
- name: Run full shared suite against Rust
if: matrix.engine == 'rust'
run: uv run --with adbc-driver-sqlite pytest -v --test-engine rust --no-cov --junitxml=test-results.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: tests-${{ matrix.python-version }}-${{ matrix.engine }}
path: test-results.xml
- name: Run installed-wheel DAX smoke
run: |
uv build sqlctx-rs --out-dir /tmp/sqlctx-dax-dist
uv build crates/dax-pyo3 --out-dir /tmp/sqlctx-dax-dist
uv build --out-dir /tmp/sqlctx-dist
SQLCTX_WHEEL=$(realpath "$(find /tmp/sqlctx-dist -name 'sqlctx-[0-9]*.whl' -print -quit)")
cd /tmp
uv run --no-project --find-links /tmp/sqlctx-dax-dist --with "${SQLCTX_WHEEL}[dax]" -- python - <<'PY'
import sqlctx_dax
sqlctx_dax.parse_expression("1")
PY
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
dependency-compatibility:
name: Dependencies (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: minimum direct
python-version: "3.11"
resolution: lowest-direct
- name: unlocked latest
python-version: "3.14"
resolution: highest
# New Typer releases can swap the Click runtime underneath the
# CLI (Typer 0.26+ vendors it), so run the CLI contract suites
# against the newest resolution too.
cli-tests: true
env:
UV_PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Install uv
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Resolve ${{ matrix.name }} dependencies
# Early sqlglotc releases are sdist-only and fail to compile with
# current mypyc. Exercise the lowest available compiled wheel instead.
run: >-
uv sync
--extra dev
--extra rust
--extra dax
--extra charts
--extra widget
--extra lsp
--extra workbench
--upgrade
--resolution ${{ matrix.resolution }}
--no-build-package sqlglotc
- name: Exercise maintained Python surfaces
run: >-
uv run --no-sync pytest
tests/core
tests/lsp
tests/widget
tests/test_charts.py
tests/test_core_imports.py
tests/test_project.py
-q
-o addopts="-m 'not integration'"
- name: Exercise CLI contract
if: matrix.cli-tests
# A broken --format guard once let `server api` start and block.
timeout-minutes: 15
run: |
uv run --no-sync python -c "import importlib.metadata as m; print('typer', m.version('typer'), 'click', m.version('click'))"
uv run --no-sync pytest tests/test_cli_*.py tests/test_manpage.py -q -o addopts="-m 'not integration'"
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
base-install-cli:
name: Base Install CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Install uv
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Set up Python
run: uv python install 3.12
- name: Build Python distribution
run: uv build --wheel --out-dir /tmp/sqlctx-dist
- name: Smoke base CLI install
run: |
set -euo pipefail
SQLCTX_WHEEL=$(realpath "$(find /tmp/sqlctx-dist -name 'sqlctx-[0-9]*.whl' -print -quit)")
tmpdir="$(mktemp -d)"
mkdir -p "$tmpdir/models"
cat > "$tmpdir/models/models.yml" <<'YAML'
models:
- name: orders
table: orders
primary_key: id
dimensions:
- name: status
type: categorical
metrics:
- name: order_count
agg: count
YAML
cd "$tmpdir"
uv run --no-project --with "$SQLCTX_WHEEL" python -c "import importlib.metadata as m; print('typer', m.version('typer'), 'click', m.version('click'))"
uv run --no-project --with "$SQLCTX_WHEEL" sqlctx --version
uv run --no-project --with "$SQLCTX_WHEEL" sqlctx validate "$tmpdir/models"
uv run --no-project --with "$SQLCTX_WHEEL" sqlctx query "SELECT order_count, status FROM orders" --models "$tmpdir/models" --dry-run
# Subcommand help must exit 0 without an error or traceback.
uv run --no-project --with "$SQLCTX_WHEEL" sqlctx validate --help >"$tmpdir/help.out" 2>"$tmpdir/help.err"
grep -q "Usage:" "$tmpdir/help.out"
if grep -q -e "Traceback" -e "Error" "$tmpdir/help.err"; then
echo "sqlctx validate --help reported an error"
cat "$tmpdir/help.err" >&2
exit 1
fi
# Handled errors must exit 1 with a concise message and no traceback.
set +e
uv run --no-project --with "$SQLCTX_WHEEL" sqlctx query "SELECT orders.missing FROM orders" --models "$tmpdir/models" --dry-run >"$tmpdir/error.out" 2>"$tmpdir/error.err"
error_status=$?
set -e
if [ "$error_status" -ne 1 ] || ! grep -q "^Error: " "$tmpdir/error.err" || grep -q "Traceback" "$tmpdir/error.err"; then
echo "handled CLI error exited $error_status or was not concise"
cat "$tmpdir/error.err" >&2
exit 1
fi
uv run --no-project --with "$SQLCTX_WHEEL" python - <<'PYTHON'
from importlib.util import find_spec
from sqlctx import SemanticLayer, Model, Metric
from sqlctx.semantic_handoff import RustBackendUnavailableError
assert find_spec("sqlctx_rs") is None
with SemanticLayer() as layer:
layer.add_model(Model(name="orders", sql="select 1 as id", metrics=[Metric(name="count", agg="count")]))
assert layer.sql("select orders.count from orders").fetchall() == [(1,)]
assert layer.last_engine_selection == {"engine": "python", "reason": None}
try:
SemanticLayer(engine="rust")
except RustBackendUnavailableError as error:
assert "sqlctx[rust]" in str(error)
else:
raise AssertionError("Rust must require the extra")
PYTHON
set +e
timeout 10s uv run --no-project --with "$SQLCTX_WHEEL" sqlctx serve "$tmpdir/models" >"$tmpdir/serve.out" 2>"$tmpdir/serve.err"
serve_status=$?
set -e
if [ "$serve_status" -eq 0 ]; then
echo "base install unexpectedly ran sqlctx serve without the serve extra"
exit 1
fi
if [ "$serve_status" -eq 124 ]; then
echo "base install unexpectedly started sqlctx serve without the serve extra"
cat "$tmpdir/serve.out"
cat "$tmpdir/serve.err" >&2
exit 1
fi
grep -q "sqlctx\\[api\\]" "$tmpdir/serve.err"
if grep -q "Traceback" "$tmpdir/serve.err"; then
echo "missing serve extra must be reported without a traceback"
cat "$tmpdir/serve.err" >&2
exit 1
fi
- name: Build runtime distribution
run: uv build sqlctx-rs --out-dir /tmp/sqlctx-runtime-dist
- name: Smoke Rust extra install
run: |
SQLCTX_WHEEL=$(realpath "$(find /tmp/sqlctx-dist -name 'sqlctx-[0-9]*.whl' -print -quit)")
cd /tmp
uv run --no-project --find-links /tmp/sqlctx-runtime-dist --with "${SQLCTX_WHEEL}[rust]" python - <<'PYTHON'
import sqlctx_rs
from sqlctx import SemanticLayer, Model, Metric
for engine in (None, "rust"):
with SemanticLayer(engine=engine) as layer:
layer.add_model(Model(name="orders", sql="select 1 as id", metrics=[Metric(name="count", agg="count")]))
assert layer.sql("select orders.count from orders").fetchall() == [(1,)]
assert layer.last_engine_selection == {"engine": engine or "python", "reason": None}
PYTHON
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
schema-pr-state:
name: Check schema update eligibility
needs: python
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
eligible: ${{ steps.state.outputs.result }}
steps:
- uses: actions/github-script@v7
id: state
with:
script: |
const {data: pr} = await github.rest.pulls.get({
...context.repo, pull_number: context.issue.number
});
return pr.state === 'open'
&& pr.head.sha === context.payload.pull_request.head.sha
&& pr.head.repo.full_name === context.payload.repository.full_name;
update-schema:
name: Update JSON Schema
needs: schema-pr-state
if: needs.schema-pr-state.outputs.eligible == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Install uv
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --extra dev --extra dax
- name: Generate and commit schema if needed
env:
PR_BRANCH: ${{ github.head_ref }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
uv run python scripts/generate_schema.py
if ! git diff --exit-code sqlctx-schema.json; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add sqlctx-schema.json
git commit -m "Auto-update JSON schema"
git push --force-with-lease="refs/heads/$PR_BRANCH:$PR_HEAD_SHA" origin "HEAD:refs/heads/$PR_BRANCH"
fi
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
native-compat:
name: Native Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Install uv
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --extra dev
- name: Run Python native fixtures
run: uv run pytest tests/native_compat -v
- name: Install DuckDB ADBC driver
run: |
curl -L https://github.com/duckdb/duckdb/releases/download/v1.5.5/libduckdb-linux-amd64.zip -o /tmp/libduckdb.zip
unzip -q /tmp/libduckdb.zip -d /tmp/libduckdb
echo "SQLCTX_TEST_ADBC_DUCKDB_DRIVER=/tmp/libduckdb/libduckdb.so" >> "$GITHUB_ENV"
- name: Run Rust native fixtures
id: native_fixtures
working-directory: sqlctx-rs
run: |
cargo test --test native_fixtures
cargo test --features adbc-exec --test native_fixtures native_fixtures_execute_expected_results_with_duckdb_adbc
- name: Capture native fixture stack overflow
if: ${{ failure() && steps.native_fixtures.outcome == 'failure' }}
timeout-minutes: 5
working-directory: sqlctx-rs
run: |
set -euo pipefail
if ! command -v gdb >/dev/null; then
sudo apt-get update -qq
sudo apt-get install -y gdb
fi
fixture_target_dir="$(cargo metadata --no-deps --format-version 1 | jq -r .target_directory)"
fixture_binary=""
for candidate in "$fixture_target_dir"/debug/deps/native_fixtures-*; do
if [[ -f "$candidate" && -x "$candidate" && ( -z "$fixture_binary" || "$candidate" -nt "$fixture_binary" ) ]]; then
fixture_binary="$candidate"
fi
done
if [[ -z "$fixture_binary" ]]; then
echo 'No compiled native_fixtures binary found' >&2
exit 1
fi
printf 'Debugging existing binary: %s\n' "$fixture_binary"
timeout 120s gdb --batch --quiet \
-ex 'set pagination off' \
-ex 'set confirm off' \
-ex 'set debuginfod enabled off' \
-ex 'set print frame-arguments none' \
-ex 'handle SIGSEGV stop print nopass' \
-ex 'handle SIGABRT stop print nopass' \
-ex run \
-ex 'thread apply all bt 80' \
-ex 'info frame' \
-ex 'x/12i $pc' \
--args "$fixture_binary" native_fixtures_load_and_compile --exact --nocapture \
2>&1 | tee "$RUNNER_TEMP/native-fixture-backtrace.txt"
- name: Upload native fixture backtrace
if: ${{ always() && steps.native_fixtures.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: native-fixture-backtrace-${{ github.run_attempt }}
path: ${{ runner.temp }}/native-fixture-backtrace.txt
if-no-files-found: warn
retention-days: 7
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
check-rust-changes:
name: Check Rust/DuckDB changes
runs-on: ubuntu-latest
outputs:
rust_changed: ${{ steps.changes.outputs.rust }}
duckdb_changed: ${{ steps.changes.outputs.duckdb }}
dax_changed: ${{ steps.changes.outputs.dax }}
webapp_changed: ${{ steps.changes.outputs.webapp }}
widget_changed: ${{ steps.changes.outputs.widget }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
rust:
- 'sqlctx-rs/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.cargo/**'
- 'rust-toolchain*'
- '.github/workflows/ci.yml'
- '.github/actions/**'
# The installed-extension conformance job exercises Python callers,
# not just the crate. Keep its contract and fixture inputs gated.
- 'pyproject.toml'
- 'uv.lock'
- 'sqlctx/__init__.py'
- 'sqlctx/rust_bridge.py'
- 'sqlctx/rust_parity.py'
- 'sqlctx/semantic_handoff.py'
- 'sqlctx/core/**'
- 'sqlctx/sql/**'
- 'sqlctx/db/__init__.py'
- 'sqlctx/db/base.py'
- 'sqlctx/db/duckdb.py'
- 'sqlctx/db/postgres.py'
- 'sqlctx/db/unavailable.py'
- 'sqlctx/validation.py'
- 'sqlctx/validation_runner.py'
- 'sqlctx/cli.py'
- 'sqlctx/cli_contract.py'
- 'sqlctx/cli_polish.py'
- 'sqlctx/config.py'
- 'sqlctx/loaders.py'
- 'sqlctx/project.py'
- 'sqlctx/paths.py'
- 'sqlctx/formats.py'
- 'sqlctx/fidelity.py'
- 'sqlctx/yaml_compat.py'
# Imported native/Cube/Ossie fixtures are acceptance inputs too.
- 'sqlctx/adapters/__init__.py'
- 'sqlctx/adapters/base.py'
- 'sqlctx/adapters/sqlctx.py'
- 'sqlctx/adapters/cube.py'
- 'sqlctx/adapters/ossie.py'
- 'sqlctx/interchange/ossie/**'
- 'tests/conftest.py'
- 'tests/semantic_conformance/**/*.py'
- 'tests/semantic_conformance/fixtures/**'
duckdb:
- 'sqlctx-duckdb/**'
- 'sqlctx-rs/**'
# The extension links the workspace crate; host tests and their
# shared SemanticInput fixture live under the two trees above.
- 'Cargo.toml'
- 'Cargo.lock'
- '.cargo/**'
- 'rust-toolchain*'
- '.github/workflows/ci.yml'
- '.github/actions/**'
- 'pyproject.toml'
- 'uv.lock'
dax:
- '.github/actions/**'
- '.github/workflows/ci.yml'
- 'crates/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'tests/dax/fixtures/**'
webapp:
- 'webapp/**'
- 'scripts/build_webapp.py'
- 'scripts/build_ui_distribution.py'
- 'sqlctx/ui/static/**'
- 'sqlctx-rs/ui/**'
- 'plugins/sqlctx/skills/webapp-builder/assets/ui-dist/**'
- 'examples/sqlctx_wasm_demo/src/components/sqlctx/**'
widget:
- 'js/**'
- 'scripts/build_widget.py'
- 'sqlctx/widget/static/**'
- 'plugins/sqlctx/skills/webapp-builder/assets/ui-dist/**'
dax-rust:
name: Rust (DAX crates)
needs: check-rust-changes
if: needs.check-rust-changes.outputs.dax_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Run cargo fmt check
run: cargo fmt --check
- name: Run cargo clippy
run: cargo clippy -p dax-parser -p dax-pyo3 --all-targets -- -D warnings
- name: Run cargo test
run: cargo test -p dax-parser -p dax-pyo3
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
rust:
name: Rust (sqlctx-rs)
needs: check-rust-changes
if: needs.check-rust-changes.outputs.rust_changed == 'true'
runs-on: ubuntu-latest
# This job builds many feature/host combinations. Full debug symbols make
# the completed-build cache too large to duplicate into its export tar.
# Keep debug assertions and unoptimized tests, but omit symbol data.
env:
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: sqlctx
POSTGRES_PASSWORD: sqlctx
POSTGRES_DB: sqlctx
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U sqlctx"
--health-interval 10s
--health-timeout 5s
--health-retries 5
defaults:
run:
working-directory: sqlctx-rs
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}-no-debuginfo
- name: Install uv
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Run cargo fmt check
run: cargo fmt --check
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run cargo test
run: cargo test
env:
RUST_MIN_STACK: 16777216
- name: Check package metadata
run: cargo test --test package_metadata
- name: Check crate package dry run
run: cargo package --locked --no-verify
- name: Check standalone feature surfaces
run: |
cargo check --no-default-features --all-targets
cargo check --features python --lib
cargo check --features python-adbc --lib
cargo check --features mcp-server --bin sqlctx-mcp --test mcp_protocol
cargo check --features mcp-adbc --bin sqlctx-mcp
cargo check --features runtime-server --bin sqlctx-server --test http_server
cargo check --features runtime-server-adbc --bin sqlctx-server
cargo check --features runtime-lsp --bin sqlctx-lsp --test lsp_protocol_smoke
cargo check --features workbench-tui --bin sqlctx --bin sqlctx-workbench
cargo check --features workbench-adbc --bin sqlctx --bin sqlctx-workbench
- name: Install DuckDB ADBC driver
run: |
curl -L https://github.com/duckdb/duckdb/releases/download/v1.5.5/libduckdb-linux-amd64.zip -o /tmp/libduckdb.zip
unzip -q /tmp/libduckdb.zip -d /tmp/libduckdb
echo "SQLCTX_TEST_ADBC_DUCKDB_DRIVER=/tmp/libduckdb/libduckdb.so" >> "$GITHUB_ENV"
- name: Install SQLite ADBC driver
run: |
uv run --no-project --with adbc-driver-sqlite python - <<'PY' >> "$GITHUB_ENV"
import adbc_driver_sqlite
print(f"SQLCTX_TEST_ADBC_SQLITE_DRIVER={adbc_driver_sqlite._driver_path()}")
print("SQLCTX_TEST_ADBC_SQLITE_URI=:memory:")
print("SQLCTX_TEST_ADBC_REQUIRE=duckdb,sqlite")
PY
- name: Run standalone protocol and UI tests
run: |
cargo test --features mcp-server --test mcp_protocol
cargo test --features runtime-server --test http_server
cargo test --features runtime-lsp --test lsp_protocol_smoke
cargo test --features workbench-tui --test cli_smoke workbench
cargo test --features workbench-adbc --test cli_smoke workbench
cargo test --features workbench-tui --test workbench_pty_smoke
cargo test --features workbench-adbc --test workbench_pty_smoke
cargo test --features workbench-adbc --bin sqlctx
cargo test --features adbc-exec --test adbc_driver_matrix
cargo test --features mcp-adbc,runtime-server-adbc --test adbc_duckdb_e2e
- name: Smoke C ABI header and static library
run: |
cargo build --release --lib
SQLCTX_STATICLIB="$(cargo metadata --no-deps --format-version 1 | python3 -c 'import json, sys; print(json.load(sys.stdin)["target_directory"])')/release/libsqlctx.a"
cc -std=c11 -Wall -Wextra -I include tests/c_abi_smoke.c "$SQLCTX_STATICLIB" -lpthread -ldl -lm -lrt -o /tmp/sqlctx_c_abi_smoke
/tmp/sqlctx_c_abi_smoke
- name: Build WASM host module
run: cargo build --no-default-features --features wasm --target wasm32-unknown-unknown --lib
- name: Install wasm-bindgen test runner
run: |
WASM_BINDGEN_VERSION="$(cargo metadata --format-version 1 | python3 -c 'import json, sys; print(next(pkg["version"] for pkg in json.load(sys.stdin)["packages"] if pkg["name"] == "wasm-bindgen"))')"
cargo install wasm-bindgen-cli --version "$WASM_BINDGEN_VERSION"
- name: Run WASM runtime tests
run: CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner cargo test --target wasm32-unknown-unknown --features wasm --test wasm_bindgen_runtime
- name: Execute SemanticInput through the public WASM module
run: |
wasm-bindgen ../target/wasm32-unknown-unknown/debug/sqlctx.wasm --target nodejs --out-dir ../target/semantic-host
SQLCTX_WASM_MODULE="$PWD/../target/semantic-host/sqlctx.js" uv run --no-project tests/test_wasm_semantic_host.py
- name: Check Python extension build
run: uvx maturin build --out dist
- name: Smoke Python extension wheel
run: uv run --no-project --with dist/*.whl tests/python_wheel_smoke.py
- name: Check lightweight Python extension build
env:
MBX_VERIFY: "1"
run: uvx maturin build --no-default-features --features python --out dist-python
- name: Smoke lightweight Python extension wheel
run: uv run --no-project --with dist-python/*.whl tests/python_wheel_python_smoke.py
- name: Run semantic compiler conformance with the built extension
working-directory: .
env:
SQLCTX_TEST_POSTGRES_DSN: postgresql://sqlctx:sqlctx@localhost:5432/sqlctx
run: |
uv run --extra dev --with "psycopg[binary]" --with ./sqlctx-rs/dist-python/*.whl python - <<'PY'
import pytest
import sqlctx_rs
assert callable(sqlctx_rs.compile_with_semantic_input)
assert callable(sqlctx_rs.validate_with_semantic_input)
assert callable(sqlctx_rs.rewrite_with_semantic_input)
raise SystemExit(pytest.main(["--no-cov", "-q", "tests/semantic_conformance"]))
PY
- name: Check Python extension ADBC build
run: uvx maturin build --no-default-features --features python-adbc --out dist-adbc
- name: Smoke Python extension ADBC wheel
run: uv run --no-project --with dist-adbc/*.whl tests/python_wheel_adbc_smoke.py
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
duckdb-extension:
name: DuckDB Extension (${{ matrix.duckdb }})
needs: check-rust-changes
if: needs.check-rust-changes.outputs.duckdb_changed == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
duckdb: [v1.5.6, v2.0-cyanoptera]
env:
GEN: ninja
DUCKDB_VERSION: ${{ matrix.duckdb }}
SQLCTX_NATIVE_PEG: ${{ matrix.duckdb == 'v2.0-cyanoptera' && '1' || '' }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust compilation
id: rust-cache
uses: ./.github/actions/setup-rust-cache
with:
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Fetch DuckDB dependencies
working-directory: sqlctx-duckdb
run: make deps
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Build DuckDB extension
working-directory: sqlctx-duckdb
run: make
- name: Run extension tests
working-directory: sqlctx-duckdb
run: make test
- name: Install uv for SQL host acceptance
id: uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
suffix: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index || 0 }}
- name: Execute SemanticInput in the loaded DuckDB extension
env:
SQLCTX_DUCKDB_BINARY: sqlctx-duckdb/build/release/duckdb
SQLCTX_DUCKDB_EXTENSION: sqlctx-duckdb/build/release/extension/sqlctx/sqlctx.duckdb_extension
run: |
uv run sqlctx-duckdb/test/test_semantic_input_host.py
uv run sqlctx-duckdb/test/test_catalog_host.py
- name: Save completed build caches
if: ${{ !cancelled() }}
uses: ./.github/actions/save-build-caches
with:
rust-key: ${{ steps.rust-cache.outputs.key }}
uv-key: ${{ steps.uv.outputs.cache-key }}
webapp:
name: Webapp (types + unit)
needs: check-rust-changes
if: needs.check-rust-changes.outputs.webapp_changed == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: webapp
steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Unit tests
run: bun test src
- name: Check committed bundles
run: |
python ../scripts/build_webapp.py --check
python ../scripts/build_ui_distribution.py --check
widget:
name: AnyWidget bundle
needs: check-rust-changes
if: needs.check-rust-changes.outputs.widget_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version
- name: Install dependencies
working-directory: js
run: bun install --frozen-lockfile
- name: Check committed bundle
run: python scripts/build_widget.py --check