forked from tensorzero/tensorzero
-
Notifications
You must be signed in to change notification settings - Fork 1
1496 lines (1288 loc) · 56.7 KB
/
Copy pathgeneral.yml
File metadata and controls
1496 lines (1288 loc) · 56.7 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: General Checks
run-name: "General Checks for: ${{ github.event.pull_request.title || github.ref }}"
on:
merge_group:
paths-ignore:
- "docs/**"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.ref == 'refs/heads/main' && github.run_id || format('general-{0}-{1}', github.workflow, github.ref) }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
FORCE_COLOR: 1
TENSORZERO_CLICKHOUSE_URL: "http://chuser:chpassword@localhost:8123/tensorzero"
SQLX_OFFLINE: 1
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
RUST_MSRV: 1.88.0
jobs:
check-version-consistency:
permissions:
contents: read
runs-on: ubuntu-latest
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Check version consistency
run: ./ci/check-version-consistency.sh
# This checks for specific markers in the codebase that require multiple files to be edited together.
check-if-edited-then-edit:
permissions:
contents: read
runs-on: ubuntu-latest
# Should run on all PRs from forks as well, if the label is not present
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-if-edited-check') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.9"
- name: Check coordinated edits
run: python3 ci/check_coordinated_edits.py
# Like `check-docker-compose-released`, but loads the freshly built `gateway` and `ui` container images first
# This checks that all of our docker-compose files work with the changes in the PR
check-docker-compose-commit:
needs: [build-gateway-container, build-ui-container]
permissions:
# Permission to checkout the repository
contents: read
# Permission to fetch GitHub OIDC token authentication
id-token: write
# Permission to download artifacts
actions: read
runs-on: ubuntu-latest
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Download container images
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
pattern: build-{gateway,ui}-container
merge-multiple: true
- name: Load `gateway` and `ui` containers
run: |
docker load < gateway-container.tar
docker load < ui-container.tar
# Retag the loaded images to match what docker-compose expects
docker tag tensorzero/gateway:sha-${{ github.sha }} tensorzero/gateway:latest
docker tag tensorzero/ui:sha-${{ github.sha }} tensorzero/ui:latest
- name: Create the `object_storage` directory for the multimodal-vision-finetuning example
run: |
mkdir -p examples/multimodal-vision-finetuning/object_storage
chmod 777 examples/multimodal-vision-finetuning/object_storage
- name: Apply Postgres migrations for the centralize-auth-rate-limits-and-more/auth example
# Note: In isolation, applying migrations should not require `OPENAI_API_KEY`, but Docker Compose will complain if it's not set given our docker-compose.yml file.
# Note: We must delete the Docker network because later we use `ci/internal-network.yml`
# Note: This uses relay-gateway instead of gateway, so it requires explicit handling here
run: |
cd examples/docs/guides/operations/centralize-auth-rate-limits-and-more/auth
OPENAI_API_KEY=dummy docker compose run --rm relay-gateway --run-postgres-migrations
OPENAI_API_KEY=dummy docker compose down
- name: Check latest docker-compose
run: ./ci/check-all-docker-compose.sh
# Checks our docker-compose files against the most recent published `gateway` and `ui` container images
# (not the ones built for this PR)
check-docker-compose-released:
permissions:
# Permission to checkout the repository
contents: read
# Permission to fetch GitHub OIDC token authentication
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.repository == 'RouterBase/tensorzero'
steps:
- name: Set DNS
run: echo "127.0.0.1 howdy.tensorzero.com" | sudo tee -a /etc/hosts
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We allow the namespace builder setup to fail on Dependabot PRs and PRs from forks
# (where the oidc token is not available)
- name: Install Namespace CLI
uses: namespacelabs/nscloud-setup@d1c625762f7c926a54bd39252efff0705fd11c64
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Configure Namespace-powered Buildx
uses: namespacelabs/nscloud-setup-buildx-action@91c2e6537780e3b092cb8476406be99a8f91bd5e
with:
wait-for-builder: true
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Create the `object_storage` directory for the multimodal-vision-finetuning example
run: |
mkdir -p examples/multimodal-vision-finetuning/object_storage
chmod 777 examples/multimodal-vision-finetuning/object_storage
- name: Apply Postgres migrations for the centralize-auth-rate-limits-and-more/auth example
# Note: In isolation, applying migrations should not require `OPENAI_API_KEY`, but Docker Compose will complain if it's not set given our docker-compose.yml file.
# Note: We must delete the Docker network because later we use `ci/internal-network.yml`
# Note: This uses relay-gateway instead of gateway, so it requires explicit handling here
run: |
cd examples/docs/guides/operations/centralize-auth-rate-limits-and-more/auth
OPENAI_API_KEY=dummy docker compose run --rm relay-gateway --run-postgres-migrations
OPENAI_API_KEY=dummy docker compose down
- name: Check all docker-compose.yml files
run: ./ci/check-all-docker-compose.sh
check-python-client-build:
permissions:
contents: read
uses: ./.github/workflows/python-client-build.yml
check-node-bindings:
permissions:
contents: read
# Permission to upload artifacts
actions: write
runs-on: ubuntu-latest
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with:
node-version: "24.13.0"
- name: Install pnpm
run: |
for attempt in 1 2 3; do
if npm install -g pnpm@latest; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install pnpm after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Install dependencies
working-directory: internal/tensorzero-node
run: pnpm install --frozen-lockfile
- name: Build Node.js bindings
working-directory: internal/tensorzero-node
run: pnpm build-bindings
- name: Check for git diff after building bindings
id: git_diff_check
run: git diff --exit-code
- name: Upload bindings artifact on diff failure
if: failure()
uses: namespace-actions/upload-artifact@9a78c62e083914789d908952f9773e42744b9f68
with:
name: node-bindings
path: internal/tensorzero-node/lib/bindings
retention-days: 7
- name: Check tensorzero-node bindings are properly exported
run: pnpm --filter=tensorzero-node run check-exports
check-python-schemas:
permissions:
contents: read
runs-on: ubuntu-latest
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with:
node-version: "24.13.0"
- name: Install pnpm
run: |
for attempt in 1 2 3; do
if npm install -g pnpm@latest; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install pnpm after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Generate Python schemas
run: pnpm generate-python-schemas
- name: Check for git diff after generating schemas
id: git_diff_check
run: git diff --exit-code
build-windows:
permissions:
contents: read
# Permission for rust-cache to read/write cache
actions: read
runs-on: windows-latest
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install stable && rustup default stable; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
cache-provider: "buildjet"
save-if: ${{ github.event_name == 'merge_group' }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Install Python 3.10
run: uv python install 3.10
- name: Set PYO3_PYTHON
run: echo "PYO3_PYTHON=$(uv python find python3.10)" >> $GITHUB_ENV
shell: bash
- name: Build Rust
run: cargo build --workspace
lint-rust:
permissions:
contents: read
# Permission for rust-cache
actions: read
runs-on: ubuntu-latest
strategy:
matrix:
# Keep 'total_partitions' in sync with the number of entries in the 'partition' array
partition: [1, 2, 3, 4]
include:
- total_partitions: 4
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We install the latest rust when running lints, since we don't care if older rust versions lint successfully.
# This avoids the need to deal with linter bugs in older rust versions.
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install stable --component clippy && rustup default stable; then
break
fi
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
cache-provider: "buildjet"
shared-key: "lint-rust-cache"
save-if: ${{ github.event_name == 'merge_group' }}
- name: Install cargo-hack
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-hack
- name: Lint (Rust)
run: |
cargo hack --partition '${{ matrix.partition }}/${{ matrix.total_partitions }}' clippy --all-targets --each-feature -- -D warnings
validate-python:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We deliberately install our MSRV here (rather than 'stable') to ensure that everything compiles with that version
- name: Install Rust ${{ env.RUST_MSRV }}
run: |
for attempt in 1 2 3; do
if rustup install ${{ env.RUST_MSRV }} --component rustfmt && rustup default ${{ env.RUST_MSRV }}; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust ${{ env.RUST_MSRV }} after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Print Rust version
run: rustc --version
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Install Python for python async client tests
run: uv python install 3.9
- name: Lint (Python:ruff)
run: |
uvx ruff@0.14.0 check --output-format=github --extend-select I .
uvx ruff@0.14.0 format --check .
- name: "Python: Pyo3 Client: Build and install dependencies"
working-directory: clients/python
run: uv sync
- name: "Python: PyO3 Client: pyright"
working-directory: clients/python
run: |
uv pip install pyright==1.1.394
uv run pyright
- name: "Python: PyO3 Client: stubtest"
working-directory: clients/python
run: |
uv run stubtest tensorzero.tensorzero
- name: "Python: Recipes: Install dependencies"
working-directory: recipes
run: |
uv venv
uv sync
- name: "Python: Recipes: pyright"
working-directory: recipes
run: |
uv run pyright
- name: Compile / validate notebooks
run: ci/compile-check-notebooks.sh
validate-node:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We deliberately install our MSRV here (rather than 'stable') to ensure that everything compiles with that version
- name: Install Rust ${{ env.RUST_MSRV }}
run: |
for attempt in 1 2 3; do
if rustup install ${{ env.RUST_MSRV }} --component rustfmt && rustup default ${{ env.RUST_MSRV }}; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust ${{ env.RUST_MSRV }} after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Print Rust version
run: rustc --version
- name: Setup Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with:
node-version: "24.13.0"
- name: Install pnpm
run: |
for attempt in 1 2 3; do
if npm install -g pnpm@latest; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install pnpm after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Build npm workspace
run: pnpm -r build
- name: Format tensorzero-node package
run: pnpm --filter=tensorzero-node run format:check
- name: Lint tensorzero-node package
run: pnpm --filter=tensorzero-node run lint:check
- name: Typecheck tensorzero-node package
run: pnpm --filter=tensorzero-node run typecheck
- name: Run ESLint
run: pnpm --filter=tensorzero-ui run lint:check
- name: Run Prettier
run: pnpm --filter=tensorzero-ui run format:check
- name: pnpm TypeScript type checking
run: pnpm --filter=tensorzero-ui run typecheck
rust-build:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We deliberately install our MSRV here (rather than 'stable') to ensure that everything compiles with that version
- name: Install Rust ${{ env.RUST_MSRV }}
run: |
for attempt in 1 2 3; do
if rustup install ${{ env.RUST_MSRV }} --component rustfmt && rustup default ${{ env.RUST_MSRV }}; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust ${{ env.RUST_MSRV }} after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Install cargo-nextest, cargo-deny, and cargo-hack
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-nextest,cargo-deny,cargo-hack
- name: Build (Rust)
run: cargo build --workspace --verbose
- name: Validate config
run: |
unset TENSORZERO_CLICKHOUSE_URL
cargo run-e2e --validate-and-exit
rust-test:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We deliberately install our MSRV here (rather than 'stable') to ensure that everything compiles with that version
- name: Install Rust ${{ env.RUST_MSRV }}
run: |
for attempt in 1 2 3; do
if rustup install ${{ env.RUST_MSRV }} --component rustfmt && rustup default ${{ env.RUST_MSRV }}; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust ${{ env.RUST_MSRV }} after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Install cargo-nextest, cargo-deny, and cargo-hack
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-nextest,cargo-deny,cargo-hack
- name: Test (Rust)
env:
# Write the exported bindings to somewhere we don't care about
TS_RS_EXPORT_DIR: /tmp/tensorzero-bindings
run: |
cargo test-unit ${{ vars.CARGO_NEXTEST_EXTRA_ARGS }}
validate:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# We deliberately install our MSRV here (rather than 'stable') to ensure that everything compiles with that version
- name: Install Rust ${{ env.RUST_MSRV }}
run: |
for attempt in 1 2 3; do
if rustup install ${{ env.RUST_MSRV }} --component rustfmt && rustup default ${{ env.RUST_MSRV }}; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust ${{ env.RUST_MSRV }} after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Print Rust version
run: rustc --version
- name: Setup Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
with:
node-version: "24.13.0"
- name: Install pnpm
run: |
for attempt in 1 2 3; do
if npm install -g pnpm@latest; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install pnpm after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Install JS dependencies
run: pnpm install --frozen-lockfile
- name: Set up Helm
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
with:
version: "3.18.6" # Conservatively match the `Helm 3.2.0+` version specified in examples/production-deployment-k8s-helm/README.md
- name: Install helm-values-schema-json plugin
run: helm plugin install https://github.com/losisin/helm-values-schema-json.git
- name: check‑case‑conflict
run: uv run --with pre-commit pre-commit run check-case-conflict --all-files
- name: end-of-file-fixer
run: uv run --with pre-commit pre-commit run end-of-file-fixer --all-files
- name: check‑executables‑have‑shebangs
run: uv run --with pre-commit pre-commit run check-executables-have-shebangs --all-files
- name: check‑json
run: uv run --with pre-commit pre-commit run check-json --all-files
- name: check‑yaml
run: uv run --with pre-commit pre-commit run check-yaml --all-files
- name: check‑toml
run: uv run --with pre-commit pre-commit run check-toml --all-files
- name: check‑xml
run: uv run --with pre-commit pre-commit run check-xml --all-files
- name: check‑merge‑conflict
run: uv run --with pre-commit pre-commit run check-merge-conflict --all-files
- name: check‑symlinks
run: uv run --with pre-commit pre-commit run check-symlinks --all-files
- name: check‑vcs‑permalinks
run: uv run --with pre-commit pre-commit run check-vcs-permalinks --all-files
- name: detect‑private‑key
run: uv run --with pre-commit pre-commit run detect-private-key --all-files
- name: helm-values-schema
run: uv run --with pre-commit pre-commit run helm-schema --all-files
- name: Check helm schema sync
run: ./ci/check-helm-schema-sync.sh
- name: prettier-root
run: "uv run --with pre-commit pre-commit run 'prettier: root' --all-files"
# We don't run these two because we want to allow template files to have trailing whitespace
# TODO: how do we exclude minijinja files using pre-commit in GHA?
# - name: end‑of‑file‑fixer
# run: uv run --with pre-commit pre-commit run end-of-file-fixer
# - name: trailing‑whitespace
# run: uv run --with pre-commit pre-commit run trailing-whitespace
# TODO: Enable this if we can figure out the invocation
# - name: Run nb-clean
# run: uv run --with nb-clean nb-clean check --remove-empty-cells
- name: Install cargo-nextest and cargo-hack
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-nextest,cargo-hack
- name: Check durable dependencies
run: ./ci/check-durable-deps.sh
- name: Run cargo fmt
run: cargo fmt --all --check
- name: "Node.js: Run prettier"
run: pnpm --filter=openai-node run format
- name: "Node.js: OpenAI Client: typecheck"
run: pnpm --filter=openai-node run typecheck
- name: "Node.js: OpenAI Client: lint"
working-directory: clients/openai-node
run: pnpm --filter=openai-node run lint
- name: Lint Helm charts
run: find . -name "Chart.yaml" -exec dirname {} \; | xargs -I {} helm lint {}
# This job is intentionally NOT included in check-all-general-jobs-passed
# It runs as an optional check that shows up in the PR but doesn't block merging
cargo-deny:
permissions:
contents: read
runs-on: ubuntu-latest
if: github.repository == 'RouterBase/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install cargo-deny
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-deny
- name: Run cargo-deny
run: cargo deny check
clickhouse-tests:
name: "ClickHouse tests (replicated: ${{ matrix.replicated }}) (version: ${{ matrix.clickhouse_version.tag }})"
permissions:
contents: read
# Permission to download artifacts and for rust-cache
actions: read
# Permission to fetch GitHub OIDC token authentication for Namespace login
id-token: write
needs:
[
build-gateway-container,
build-mock-provider-api-container,
build-fixtures-container,
]
# We don't run many tests here, so use a normal runner with Github Actions caching
# to avoid unnecessarily using Namespace credits (it should still always finish before
# the main 'validate' job)
runs-on: ${{ matrix.replicated && 'namespace-profile-tensorzero-8x16;ephemeral-storage.size-multiplier=2' || 'namespace-profile-tensorzero-8x16' }}
continue-on-error: ${{ matrix.clickhouse_version.allow_failure }}
# This needs to pull from Docker Hub, so only run in the merge queue, or when running on a PR from the main repository
# TODO - switch back to 'latest': https://github.com/tensorzero/tensorzero/issues/6080
if: ${{ github.event_name == 'merge_group' || (github.event.pull_request.head.repo.full_name == github.repository) }}
strategy:
matrix:
# Only include replicated: true when running in merge queue
replicated: ${{ github.event_name == 'merge_group' && fromJSON('[true, false]') || fromJSON('[false]') }}
clickhouse_version: ${{ github.event_name == 'merge_group' && fromJSON('[{"tag":"lts","prefix":"lts","allow_failure":false},{"tag":"25.11","prefix":"25.11","allow_failure":false}]') || fromJSON('[{"tag":"lts","prefix":"lts","allow_failure":false}]') }}
exclude:
- replicated: true
clickhouse_version:
{ "tag": "25.11", "prefix": "25.11", "allow_failure": false }
include: ${{ github.event_name == 'merge_group' && fromJSON('[{"clickhouse_version":{"tag":"25.11","prefix":"25.11","allow_failure":false},"replicated":true}]') || fromJson('[]') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install stable && rustup default stable; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
cache-provider: "buildjet"
shared-key: "build-gateway-cache"
save-if: false
- name: "Check disk space before cleanup"
run: df -h
# ClickHouse intermittently runs out of disk space on the `ubuntu-latest` runner
# Use extreme disk cleanup script that frees up ~26GB of space (11-phase cleanup)
- name: "Free up disk space"
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
- name: Install cargo-nextest
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-nextest
- name: Set ClickHouse replicated cluster name
if: matrix.replicated == true
run: echo "TENSORZERO_CLICKHOUSE_CLUSTER_NAME=tensorzero_e2e_tests_cluster" >> $GITHUB_ENV
- name: Setup Namespace caching for Clickhouse fixtures
uses: namespacelabs/nscloud-cache-action@446d8f390563cd54ca27e8de5bdb816f63c0b706
with:
path: |
./ui/fixtures/large-fixtures/
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Download container images
run: |
docker pull nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }}
docker pull nscr.io/igvf4asmf8kri/mock-provider-api:sha-${{ github.sha }}
docker pull nscr.io/igvf4asmf8kri/fixtures:sha-${{ github.sha }}
# Retag the images to what we expect the names to be
docker tag nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }} tensorzero/gateway:sha-${{ github.sha }}
docker tag nscr.io/igvf4asmf8kri/mock-provider-api:sha-${{ github.sha }} tensorzero/mock-provider-api:sha-${{ github.sha }}
docker tag nscr.io/igvf4asmf8kri/fixtures:sha-${{ github.sha }} tensorzero/fixtures:sha-${{ github.sha }}
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Download ClickHouse fixtures
run: |
uv run ./ui/fixtures/download-large-fixtures.py
uv run ./ui/fixtures/download-small-fixtures.py
- name: Set up TENSORZERO_CLICKHOUSE_URL for E2E tests (non-replicated)
if: matrix.replicated == false
run: |
echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@localhost:8123/tensorzero_e2e_tests" >> $GITHUB_ENV
- name: Set up TENSORZERO_CLICKHOUSE_URL for E2E tests (replicated)
if: matrix.replicated == true
run: |
# Note: In replicated mode, we use the HTTP port (8124) of the second replica so we can ensure this works
echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@localhost:8124/tensorzero_e2e_tests" >> $GITHUB_ENV
- name: Set container image tags
run: |
echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
echo "TENSORZERO_MOCK_PROVIDER_API_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
echo "TENSORZERO_COMMIT_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
- name: Launch dependency services with non-replicated ClickHouse container for E2E tests
if: matrix.replicated == false
run: TENSORZERO_CLICKHOUSE_VERSION=${{ matrix.clickhouse_version.tag }} docker compose -f tensorzero-core/tests/e2e/docker-compose.yml up --no-build --wait
- name: Launch replicated ClickHouse container for E2E tests
if: matrix.replicated == true
run: TENSORZERO_CLICKHOUSE_VERSION=${{ matrix.clickhouse_version.tag }} docker compose -f tensorzero-core/tests/e2e/docker-compose.replicated.yml up --no-build --wait
# Make an HTTP request to ClickHouse and check that the version matches '${{ matrix.clickhouse_version }}'
- name: Check ClickHouse version
run: |
CLICKHOUSE_VERSION=$(curl -s "http://localhost:8123/query?user=chuser&password=chpassword" --data-binary "SELECT version()")
echo "Detected ClickHouse version: $CLICKHOUSE_VERSION"
echo "$CLICKHOUSE_VERSION" | grep -q "${{ matrix.clickhouse_version.prefix }}" || echo "WARNING: ClickHouse version does not match expected ${{ matrix.clickhouse_version.prefix }}"
# We run this as a separate step so that we can see live build logs
# (and fail the job immediately if the build fails)
- name: Build the gateway for E2E tests
run: cargo build-e2e
- name: Launch the gateway for E2E tests (not configured for replication)
if: matrix.replicated == false
run: |
cargo run-e2e > e2e_logs.txt 2>&1 &
count=0
max_attempts=20
while ! curl http://localhost:3000/health; do
echo "Waiting for gateway to be healthy..."
sleep 1
count=$((count + 1))
if [ $count -ge $max_attempts ]; then
echo "Gateway failed to become healthy after $max_attempts attempts"
exit 1
fi
done
echo "GATEWAY_PID=$!" >> $GITHUB_ENV
- name: Launch the gateway for E2E tests (configured for replication)
if: matrix.replicated == true
env:
TENSORZERO_CLICKHOUSE_URL: http://chuser:chpassword@localhost:8123/tensorzero_e2e_tests
run: |
cargo run-e2e --run-clickhouse-migrations &&
cargo run-e2e > e2e_logs.txt 2>&1 &
count=0
max_attempts=40
while ! curl http://localhost:3000/health; do
echo "Waiting for gateway to be healthy..."
sleep 1
count=$((count + 1))
if [ $count -ge $max_attempts ]; then
echo "Gateway failed to become healthy after $max_attempts attempts"
exit 1
fi
done
echo "GATEWAY_PID=$!" >> $GITHUB_ENV
- name: Test (Rust)
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/tensorzero-e2e-tests
TENSORZERO_POSTGRES_URL: postgres://postgres:postgres@localhost:5432/tensorzero-e2e-tests
run: cargo test-clickhouse
- name: Print docker compose logs (replicated)
if: always() && matrix.replicated == true
run: |
TENSORZERO_CLICKHOUSE_VERSION=${{ matrix.clickhouse_version.tag }} docker compose -f tensorzero-core/tests/e2e/docker-compose.replicated.yml logs -t
- name: Print ClickHouse error logs (replicated)
if: always() && matrix.replicated == true
run: |
echo "Error logs for ClickHouse 01:"
docker cp e2e-clickhouse-01-1:/var/log/clickhouse-server/clickhouse-server.err.log -
echo "Error logs for ClickHouse 02:"
docker cp e2e-clickhouse-02-1:/var/log/clickhouse-server/clickhouse-server.err.log -
echo "Error logs for ClickHouse 03:"
docker cp e2e-clickhouse-03-1:/var/log/clickhouse-server/clickhouse-server.err.log -
- name: Print ClickHouse trace logs (replicated)
if: always() && matrix.replicated == true
run: |
echo "Trace logs for ClickHouse 01:"
docker cp e2e-clickhouse-01-1:/var/log/clickhouse-server/clickhouse-server.log -
echo "Trace logs for ClickHouse 02:"
docker cp e2e-clickhouse-02-1:/var/log/clickhouse-server/clickhouse-server.log -
echo "Trace logs for ClickHouse 03:"
docker cp e2e-clickhouse-03-1:/var/log/clickhouse-server/clickhouse-server.log -
- name: Print container health checks (replicated)
if: always() && matrix.replicated == true
run: |
echo "Health check for ClickHouse 01:"
docker inspect --format "{{json .State.Health }}" e2e-clickhouse-01-1 | jq
echo "Health check for ClickHouse 02:"
docker inspect --format "{{json .State.Health }}" e2e-clickhouse-02-1 | jq
echo "Health check for ClickHouse 03:"
docker inspect --format "{{json .State.Health }}" e2e-clickhouse-03-1 | jq
- name: Print docker compose logs (non-replicated)
if: always() && matrix.replicated == false
run: |
TENSORZERO_CLICKHOUSE_VERSION=${{ matrix.clickhouse_version.tag }} docker compose -f tensorzero-core/tests/e2e/docker-compose.yml logs -t
- name: Print ClickHouse error logs (non-replicated)
if: always() && matrix.replicated == false
run: docker cp e2e-clickhouse-1:/var/log/clickhouse-server/clickhouse-server.err.log -
- name: Print ClickHouse trace logs (non-replicated)
if: always() && matrix.replicated == false
run: docker cp e2e-clickhouse-1:/var/log/clickhouse-server/clickhouse-server.log -
- name: Print container health checks (non-replicated)
if: always() && matrix.replicated == false
run: |
echo "Health check for ClickHouse:"
docker inspect --format "{{json .State.Health }}" e2e-clickhouse-1 | jq || echo "Could not read health check"
- name: Print e2e logs
if: always()
run: cat e2e_logs.txt
# Run Postgres tests
# Postgres does not have unit test coverage, because sqlx doesn't expose mocks. We include it here to get early CI signals.
postgres-tests:
name: "Postgres tests"
permissions:
contents: read
# Permission to download artifacts and for rust-cache
actions: read
# Permission to fetch GitHub OIDC token authentication for Namespace login
id-token: write
runs-on: ubuntu-latest
needs: [build-gateway-container, build-fixtures-container]
if: ${{ github.event_name == 'merge_group' || (github.event.pull_request.head.repo.full_name == github.repository) }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install stable && rustup default stable; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
cache-provider: "buildjet"
shared-key: "build-gateway-cache"
save-if: false
- name: Install cargo-nextest
uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787
with:
tool: cargo-nextest
- name: Install Namespace CLI
uses: namespacelabs/nscloud-setup@d1c625762f7c926a54bd39252efff0705fd11c64
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Login to Namespace registry
run: nsc docker login
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Download container images
run: |
docker pull nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }}
docker pull nscr.io/igvf4asmf8kri/fixtures:sha-${{ github.sha }}
docker tag nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }} tensorzero/gateway:sha-${{ github.sha }}
docker tag nscr.io/igvf4asmf8kri/fixtures:sha-${{ github.sha }} tensorzero/fixtures:sha-${{ github.sha }}
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Set container image tags
run: |
echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
echo "TENSORZERO_COMMIT_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
- name: Set environment variables for Postgres
run: |
echo "DATABASE_URL=postgres://postgres:postgres@localhost:5432/tensorzero-e2e-tests" >> $GITHUB_ENV
echo "TENSORZERO_POSTGRES_URL=postgres://postgres:postgres@localhost:5432/tensorzero-e2e-tests" >> $GITHUB_ENV
- name: Launch Postgres
run: docker compose -f tensorzero-core/tests/e2e/docker-compose.yml up --no-build postgres gateway-postgres-migrations fixtures-postgres -d --wait
- name: Test (Rust)
run: cargo nextest run --filterset 'test(db::) & test(postgres)'
- name: Print docker compose logs
if: always()
run: docker compose -f tensorzero-core/tests/e2e/docker-compose.yml logs -t