Repository navigation
665 lines (645 loc) · 22.8 KB
/
Copy pathpr.yaml
File metadata and controls
665 lines (645 loc) · 22.8 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
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: pr-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read
# ubuntu-latest is Ubuntu 26.04. That image drops Python 3.9, installs OpenJDK 25
# (Spark/Hadoop calls the removed Subject.getSubject), and has no Playwright Chromium.
jobs:
changes:
runs-on: ubuntu-24.04
outputs:
python: ${{ steps.filter.outputs.python }}
client: ${{ steps.filter.outputs.client }}
vscode: ${{ steps.filter.outputs.vscode }}
lsp: ${{ steps.filter.outputs.lsp }}
ci: ${{ steps.filter.outputs.ci }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
python:
- 'sqlmesh/**'
- 'tests/**'
- 'examples/**'
- 'web/server/**'
- 'pytest.ini'
- 'setup.cfg'
- 'setup.py'
- 'pyproject.toml'
client:
- 'web/client/**'
vscode:
- 'vscode/**'
lsp:
- 'sqlmesh/lsp/**'
ci:
- '.github/**'
- 'Makefile'
- '.pre-commit-config.yaml'
docs:
- 'docs/**'
- 'mkdocs.yml'
- '.readthedocs.yaml'
doc-tests:
needs: changes
if:
needs.changes.outputs.python == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
env:
UV: '1'
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv venv .venv
source .venv/bin/activate
make install-dev install-doc
- name: Run doc tests
run: |
source .venv/bin/activate
make doc-test
docs-build:
needs: changes
if:
needs.changes.outputs.docs == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
UV: '1'
steps:
- uses: actions/checkout@v7
- name: Set up Python
# Match the Python version Read the Docs builds with (.readthedocs.yaml)
uses: actions/setup-python@v7
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv venv .venv
source .venv/bin/activate
make install-doc
- name: Build docs
run: |
source .venv/bin/activate
mkdocs build --strict
style-and-cicd-tests:
needs: changes
if:
needs.changes.outputs.python == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
env:
PYTEST_XDIST_AUTO_NUM_WORKERS: 2
UV: '1'
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install OpenJDK and ODBC
run:
sudo apt-get update && sudo apt-get install -y default-jdk
unixodbc-dev
- name: Install SQLMesh dev dependencies
run: |
uv venv .venv
source .venv/bin/activate
make install-dev
- name: Fix Git URL override
run:
git config --global --unset url."ssh://git@github.com".insteadOf ||
true
- name: Run linters and code style checks
run: |
source .venv/bin/activate
make py-style
- name: Exercise the benchmarks
if: matrix.python-version != '3.9'
run: |
source .venv/bin/activate
make benchmark-ci
- name: Run cicd tests
run: |
source .venv/bin/activate
make cicd-test
- name: Upload test results
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: test-results-style-cicd-${{ matrix.python-version }}
path: test-results/
retention-days: 7
cicd-tests-windows:
needs: changes
if:
needs.changes.outputs.python == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: windows-latest
steps:
- name: Enable symlinks in git config
run: git config --global core.symlinks true
- uses: actions/checkout@v7
- name: Install make
run: choco install make which -y
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install SQLMesh dev dependencies
run: |
python -m venv venv
. ./venv/Scripts/activate
python.exe -m pip install --upgrade pip
make install-dev
- name: Install DuckLake extension
run: |
. ./venv/Scripts/activate
python -c "import duckdb; duckdb.connect().install_extension('ducklake')"
- name: Run fast unit tests
run: |
. ./venv/Scripts/activate
which python
python --version
make fast-test
- name: Upload test results
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: test-results-windows
path: test-results/
retention-days: 7
migration-test:
needs: changes
if:
needs.changes.outputs.python == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
env:
SQLMESH__DISABLE_ANONYMIZED_ANALYTICS: '1'
UV: '1'
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Run migration test - sushi
run:
./.github/scripts/test_migration.sh sushi "--gateway
duckdb_persistent"
- name: Run migration test - sushi_dbt
run:
./.github/scripts/test_migration.sh sushi_dbt "--config
migration_test_config"
ui-style:
needs: [changes]
if:
needs.changes.outputs.client == 'true' || needs.changes.outputs.vscode ==
'true' || needs.changes.outputs.ci == 'true' || github.ref ==
'refs/heads/main'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
- uses: pnpm/action-setup@v6
with:
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "store=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v6
with:
path: ${{ steps.pnpm-cache.outputs.store }}
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Run linters and code style checks
run: pnpm run lint
ui-test:
needs: changes
if:
needs.changes.outputs.client == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.54.1-jammy
steps:
- uses: actions/checkout@v7
- name: Install pnpm via corepack
run: |
npm install --global corepack@latest
corepack enable
corepack prepare pnpm@latest-10 --activate
pnpm config set store-dir .pnpm-store
- name: Install dependencies
run: pnpm install
- name: Build UI
run: npm --prefix web/client run build
- name: Run unit tests
run: npm --prefix web/client run test:unit
- name: Run e2e tests
run: npm --prefix web/client run test:e2e
env:
PLAYWRIGHT_SKIP_BUILD: '1'
HOME: /root
engine-tests-docker:
needs: changes
if:
needs.changes.outputs.python == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
engine:
[
duckdb,
postgres,
mysql,
mssql,
trino,
spark,
clickhouse,
clickhouse-datalake,
risingwave,
starrocks,
]
env:
PYTEST_XDIST_AUTO_NUM_WORKERS: 2
SQLMESH__DISABLE_ANONYMIZED_ANALYTICS: '1'
UV: '1'
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install SQLMesh dev dependencies
run: |
uv venv .venv
source .venv/bin/activate
make install-dev
- name: Install OS-level dependencies
run: ./.github/scripts/install-prerequisites.sh "${{ matrix.engine }}"
- name: Run tests
run: |
source .venv/bin/activate
make ${{ matrix.engine }}-test
- name: Stop DataLake services
if: ${{ always() && matrix.engine == 'clickhouse-datalake' }}
run: make clickhouse-datalake-down
- name: Upload test results
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: test-results-docker-${{ matrix.engine }}
path: test-results/
retention-days: 7
engine-tests-cloud:
needs: engine-tests-docker
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
engine:
[
snowflake,
databricks,
redshift,
bigquery,
clickhouse-cloud,
athena,
fabric,
gcp-postgres,
]
env:
PYTEST_XDIST_AUTO_NUM_WORKERS: 4
SQLMESH__DISABLE_ANONYMIZED_ANALYTICS: '1'
UV: '1'
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
SNOWFLAKE_AUTHENTICATOR: SNOWFLAKE_JWT
DATABRICKS_SERVER_HOSTNAME: ${{ secrets.DATABRICKS_SERVER_HOSTNAME }}
DATABRICKS_HOST: ${{ secrets.DATABRICKS_SERVER_HOSTNAME }}
DATABRICKS_HTTP_PATH: ${{ secrets.DATABRICKS_HTTP_PATH }}
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
DATABRICKS_CONNECT_VERSION: ${{ secrets.DATABRICKS_CONNECT_VERSION }}
REDSHIFT_HOST: ${{ secrets.REDSHIFT_HOST }}
REDSHIFT_PORT: ${{ secrets.REDSHIFT_PORT }}
REDSHIFT_USER: ${{ secrets.REDSHIFT_USER }}
REDSHIFT_PASSWORD: ${{ secrets.REDSHIFT_PASSWORD }}
BIGQUERY_KEYFILE: ${{ secrets.BIGQUERY_KEYFILE }}
BIGQUERY_KEYFILE_CONTENTS: ${{ secrets.BIGQUERY_KEYFILE_CONTENTS }}
CLICKHOUSE_CLOUD_HOST: ${{ secrets.CLICKHOUSE_CLOUD_HOST }}
CLICKHOUSE_CLOUD_USERNAME: ${{ secrets.CLICKHOUSE_CLOUD_USERNAME }}
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.CLICKHOUSE_CLOUD_PASSWORD }}
GCP_POSTGRES_KEYFILE_JSON: ${{ secrets.GCP_POSTGRES_KEYFILE_JSON }}
GCP_POSTGRES_INSTANCE_CONNECTION_STRING:
${{ secrets.GCP_POSTGRES_INSTANCE_CONNECTION_STRING }}
GCP_POSTGRES_USER: ${{ secrets.GCP_POSTGRES_USER }}
GCP_POSTGRES_PASSWORD: ${{ secrets.GCP_POSTGRES_PASSWORD }}
ATHENA_S3_WAREHOUSE_LOCATION: ${{ secrets.ATHENA_S3_WAREHOUSE_LOCATION }}
ATHENA_WORK_GROUP: ${{ secrets.ATHENA_WORK_GROUP }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
FABRIC_HOST: ${{ secrets.FABRIC_HOST }}
FABRIC_CLIENT_ID: ${{ secrets.FABRIC_CLIENT_ID }}
FABRIC_CLIENT_SECRET: ${{ secrets.FABRIC_CLIENT_SECRET }}
FABRIC_TENANT_ID: ${{ secrets.FABRIC_TENANT_ID }}
FABRIC_WORKSPACE_ID: ${{ secrets.FABRIC_WORKSPACE_ID }}
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install OS-level dependencies
run: ./.github/scripts/install-prerequisites.sh "${{ matrix.engine }}"
- name: Install SQLMesh dev dependencies
run: |
uv venv .venv
source .venv/bin/activate
make install-dev
- name: Generate database name and setup credentials
run: |
UUID=$(cat /proc/sys/kernel/random/uuid)
TEST_DB_NAME="ci_${UUID:0:8}"
echo "TEST_DB_NAME=$TEST_DB_NAME" >> $GITHUB_ENV
echo "SNOWFLAKE_DATABASE=$TEST_DB_NAME" >> $GITHUB_ENV
echo "DATABRICKS_CATALOG=$TEST_DB_NAME" >> $GITHUB_ENV
echo "REDSHIFT_DATABASE=$TEST_DB_NAME" >> $GITHUB_ENV
echo "GCP_POSTGRES_DATABASE=$TEST_DB_NAME" >> $GITHUB_ENV
echo "FABRIC_DATABASE=$TEST_DB_NAME" >> $GITHUB_ENV
echo "$SNOWFLAKE_PRIVATE_KEY_RAW" | base64 -d > /tmp/snowflake-keyfile.p8
echo "SNOWFLAKE_PRIVATE_KEY_FILE=/tmp/snowflake-keyfile.p8" >> $GITHUB_ENV
env:
SNOWFLAKE_PRIVATE_KEY_RAW: ${{ secrets.SNOWFLAKE_PRIVATE_KEY_RAW }}
- name: Create test database
run:
./.github/scripts/manage-test-db.sh "${{ matrix.engine }}"
"$TEST_DB_NAME" up
- name: Run tests
env:
# Temporary BigQuery diagnostics: since 2026-10-31 the BigQuery runner either shuts
# down or stops responding mid-pytest, and its log is never uploaded. Keep the
# evidence in files, stop pytest before the job limit so the runner can recover,
# and upload the files in the steps below. Remove once fixed.
PYTHONUNBUFFERED: ${{ matrix.engine == 'bigquery' && '1' || '' }}
PYTEST_ADDOPTS: ${{ matrix.engine == 'bigquery' && '-v' || '' }}
run: |
source .venv/bin/activate
if [ "${{ matrix.engine }}" != "bigquery" ]; then
make ${{ matrix.engine }}-test
exit
fi
mkdir -p test-results
(
while true; do
echo "[resources $(date -u +%T)] $(free -m | awk '/Mem:/{print "mem_used="$3"MB mem_avail="$7"MB"}') $(free -m | awk '/Swap:/{print "swap_used="$3"MB"}') $(df -h / | awk 'NR==2{print "disk_used="$5}')"
ps -eo rss=,args= --sort=-rss | head -4 | awk '{rss=$1; $1=""; printf " rss=%dMB %.120s\n", rss/1024, $0}'
sleep 5
done
) >> test-results/bigquery-resources.log 2>&1 &
trap "kill $! 2>/dev/null || true" EXIT
make engine-bigquery-install
uv pip install -e ".[bigframes]"
# Same commands as the Makefile's bigquery-test target, under a timeout so
# pytest itself (not just make) is stopped before the 25 minute job limit.
set -o pipefail
timeout --kill-after=60s 18m pytest -n auto -m "bigquery" --reruns 3 \
--junitxml=test-results/junit-bigquery.xml 2>&1 | tee test-results/bigquery-pytest.log
- name: Collect BigQuery diagnostics
if: ${{ always() && matrix.engine == 'bigquery' }}
run: |
mkdir -p test-results
sudo dmesg -T | grep -iE 'out of memory|oom|killed process' > test-results/bigquery-dmesg.log || true
echo "== kernel OOM messages"; cat test-results/bigquery-dmesg.log
echo "== last resource samples"; tail -n 60 test-results/bigquery-resources.log || true
echo "== last pytest output"; tail -n 60 test-results/bigquery-pytest.log || true
- name: Tear down test database
if: always()
run:
./.github/scripts/manage-test-db.sh "${{ matrix.engine }}"
"$TEST_DB_NAME" down
- name: Upload test results
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: test-results-cloud-${{ matrix.engine }}
path: test-results/
retention-days: 7
test-vscode:
needs: changes
if:
needs.changes.outputs.vscode == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
- uses: pnpm/action-setup@v6
with:
version: latest
- name: Install dependencies
run: pnpm install
- name: Run CI
run: pnpm run ci
test-vscode-e2e:
needs: changes
if:
needs.changes.outputs.vscode == 'true' || needs.changes.outputs.lsp ==
'true' || needs.changes.outputs.ci == 'true' || github.ref ==
'refs/heads/main'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
- uses: pnpm/action-setup@v6
with:
version: latest
- name: Install dependencies
run: pnpm install
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install python dependencies
run: |
python -m venv .venv
source .venv/bin/activate
make install-dev
- name: Install code-server
# Pinned so that a code-server release cannot change the editor UI the
# tests drive without the change showing up here first.
# The installer curls the .deb once. A reset (curl exit 56) fails the
# job. A repeat resumes the partial file the installer leaves behind.
run: |
set -euo pipefail
for attempt in 1 2 3 4 5; do
if curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.137.0; then
exit 0
fi
echo "code-server install failed (attempt ${attempt}); retrying"
sleep $((attempt * 5))
done
echo "code-server install failed after 5 attempts"
exit 1
- name: Install Playwright browsers
working-directory: ./vscode/extension
run: pnpm exec playwright install
- name: Run e2e tests
working-directory: ./vscode/extension
# CI runs one worker. That needs a longer cap than the old 30 minutes.
timeout-minutes: 60
run: |
source ../../.venv/bin/activate
pnpm run test:e2e
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report
path: vscode/extension/playwright-report/
retention-days: 30
test-dbt-versions:
needs: changes
if:
needs.changes.outputs.python == 'true' || needs.changes.outputs.ci ==
'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
dbt-version:
[
'1.3',
'1.4',
'1.5',
'1.6',
'1.7',
'1.8',
'1.9',
'1.10',
'1.11',
'1.12',
]
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install SQLMesh dev dependencies
run: |
uv venv .venv
source .venv/bin/activate
UV=1 make install-dev-dbt-${{ matrix.dbt-version }}
- name: Run dbt tests
# We can't run slow tests across all engines due to tests requiring DuckDB and old versions
# of DuckDB require a version of DuckDB we no longer support
run: |
source .venv/bin/activate
# Remove semantic_models and metrics sections for DBT versions < 1.6.0
# Using explicit list to avoid version comparison issues
if [[ "${{ matrix.dbt-version }}" == "1.3" ]] || \
[[ "${{ matrix.dbt-version }}" == "1.4" ]] || \
[[ "${{ matrix.dbt-version }}" == "1.5" ]]; then
echo "DBT version is ${{ matrix.dbt-version }} (< 1.6.0), removing semantic_models and metrics sections..."
schema_file="tests/fixtures/dbt/sushi_test/models/schema.yml"
if [[ -f "$schema_file" ]]; then
echo "Modifying $schema_file..."
# Create a temporary file
temp_file=$(mktemp)
# Use awk to remove semantic_models and metrics sections
awk '
/^semantic_models:/ { in_semantic=1; next }
/^metrics:/ { in_metrics=1; next }
/^[^ ]/ && (in_semantic || in_metrics) {
in_semantic=0;
in_metrics=0
}
!in_semantic && !in_metrics { print }
' "$schema_file" > "$temp_file"
# Move the temp file back
mv "$temp_file" "$schema_file"
echo "Successfully removed semantic_models and metrics sections"
else
echo "Schema file not found at $schema_file, skipping..."
fi
else
echo "DBT version is ${{ matrix.dbt-version }} (>= 1.6.0), keeping semantic_models and metrics sections"
fi
# dbt 1.6 installs without web/lsp (pydantic conflict); skip collecting those tests
if [[ "${{ matrix.dbt-version }}" == "1.6" ]]; then
pytest -n auto -m "dbt and fast" --reruns 3 --ignore=tests/lsp --ignore=tests/web
else
make dbt-fast-test
fi
- name: Test SQLMesh info in sushi_dbt
working-directory: ./examples/sushi_dbt
run: |
source ../../.venv/bin/activate
sed -i 's/target: in_memory/target: postgres/g' profiles.yml
if [[ "${{ matrix.dbt-version }}" == "1.3" ]] || \
[[ "${{ matrix.dbt-version }}" == "1.4" ]]; then
echo "DBT version is ${{ matrix.dbt-version }} (< 1.5.0), removing version parameters..."
sed -i -e 's/, version=1) }}/) }}/g' -e 's/, v=1) }}/) }}/g' models/top_waiters.sql
else
echo "DBT version is ${{ matrix.dbt-version }} (>= 1.5.0), keeping version parameters"
fi
sqlmesh info --skip-connection