-
Notifications
You must be signed in to change notification settings - Fork 58
1365 lines (1200 loc) · 42.3 KB
/
ci.yaml
File metadata and controls
1365 lines (1200 loc) · 42.3 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: CI
on:
push:
branches: [main]
paths:
- "crates/**"
- "packages/**"
- "e2e/**"
- "fixtures/**"
- "sources/**"
- "scripts/**"
- "docs/snippets/**"
- "docs/reference/**"
- ".github/workflows/ci.yaml"
- ".github/actions/**"
- ".pre-commit-config.yaml"
- ".golangci.yml"
- ".cargo/config.toml"
- "rust-toolchain.toml"
- "Cargo.toml"
- "Cargo.lock"
- "Taskfile.yml"
- ".task/**"
- "pyproject.toml"
- ".clang-format"
- "alef.toml"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
pull_request:
branches: [main]
paths:
- "crates/**"
- "packages/**"
- "e2e/**"
- "fixtures/**"
- "sources/**"
- "scripts/**"
- "docs/snippets/**"
- "docs/reference/**"
- ".github/workflows/ci.yaml"
- ".github/actions/**"
- ".pre-commit-config.yaml"
- ".golangci.yml"
- ".cargo/config.toml"
- "rust-toolchain.toml"
- "Cargo.toml"
- "Cargo.lock"
- "Taskfile.yml"
- ".task/**"
- "pyproject.toml"
- ".clang-format"
- "alef.toml"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
workflow_run:
workflows: ["Publish Release"]
types: [completed]
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
RUST_BACKTRACE: short
BUILD_PROFILE: ci
jobs:
# ---------------------------------------------------------------------------
# 0. Clone vendors (shared prerequisite for most jobs)
# ---------------------------------------------------------------------------
clone-vendors:
name: Clone vendors
if: github.repository == 'kreuzberg-dev/tree-sitter-language-pack' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install tree-sitter CLI
run: npm install -g tree-sitter-cli
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install Python dependencies
run: uv sync --no-install-project
- name: Cache parsers
uses: actions/cache@v5
with:
path: parsers
key: parsers-${{ hashFiles('sources/language_definitions.json') }}
restore-keys: |
parsers-
- name: Clone vendors
run: |
mkdir -p parsers
uv run --script scripts/clone_vendors.py
- name: Upload parsers
uses: actions/upload-artifact@v7
with:
name: language-parsers
path: parsers
retention-days: 1
# ---------------------------------------------------------------------------
# 1. validate — Lint & Format (prek hooks)
# ---------------------------------------------------------------------------
validate:
name: Validate (Lint & Format)
if: github.repository == 'kreuzberg-dev/tree-sitter-language-pack' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-24.04-arm
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v6
# --- Task runner ---
- name: Install Task
uses: kreuzberg-dev/actions/install-task@v1
# --- Rust ---
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
use-sccache: "false"
install-llvm-cov: "false"
# --- Python ---
- name: Setup Python
uses: kreuzberg-dev/actions/setup-python-env@v1
with:
python-version: "3.13"
# --- Node.js / pnpm ---
- name: Setup Node Workspace
uses: kreuzberg-dev/actions/setup-node-workspace@v1
# --- Go ---
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "1.26"
cache-dependency-path: packages/go/go.sum
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v9
with:
install-only: true
# --- Java ---
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "25"
# --- Elixir ---
- name: Setup Elixir
uses: kreuzberg-dev/actions/setup-elixir@v1
# --- Ruby ---
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
working-directory: packages/ruby
# --- PHP ---
- name: Setup PHP
uses: kreuzberg-dev/actions/setup-php@v1
# --- C/C++ ---
- name: Install C/C++ tools
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends cppcheck clang-format
# --- Alef ---
- name: Install alef
uses: kreuzberg-dev/actions/install-alef@v1
# --- Alef binding deps ---
- name: Install binding dependencies
run: alef setup
# --- Prek ---
- name: Run prek hooks
uses: j178/prek-action@v2
with:
extra-args: --all-files
# ---------------------------------------------------------------------------
# 2. validate-rust — Rust lint + alef checks
# ---------------------------------------------------------------------------
validate-rust:
name: Validate Rust & Alef
if: github.repository == 'kreuzberg-dev/tree-sitter-language-pack' && github.actor != 'dependabot[bot]'
needs: [clone-vendors]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
use-sccache: "false"
install-llvm-cov: "false"
- name: Check Rust formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy --workspace --exclude ts-pack-core-wasm -- -D warnings
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
TSLP_LINK_MODE: static
- name: Install alef
uses: kreuzberg-dev/actions/install-alef@v1
- name: Verify binding API parity
run: alef verify
- name: Check README freshness
run: |
alef readme
git diff --exit-code -- packages/*/README.md crates/*/README.md || {
echo "::error::READMEs are out of date. Run 'alef readme' and commit."
exit 1
}
- name: Check API docs freshness
run: |
alef docs
# Ignore whitespace-only diffs (markdown formatter may add/remove blank lines)
git diff --ignore-blank-lines --exit-code -- docs/reference/ || {
echo "::error::API docs are out of date. Run 'alef docs' and commit."
exit 1
}
- name: Check version sync
run: |
alef sync-versions
git diff --exit-code -- packages/ crates/ || {
echo "::error::Versions are out of sync. Run 'alef sync-versions' and commit."
exit 1
}
# ---------------------------------------------------------------------------
# 3. changes — Detect which parts of the repo changed
# ---------------------------------------------------------------------------
changes:
name: Detect Changes
if: github.repository == 'kreuzberg-dev/tree-sitter-language-pack' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
core: ${{ steps.filter.outputs.core }}
rust: ${{ steps.filter.outputs.rust }}
ffi: ${{ steps.filter.outputs.ffi }}
python: ${{ steps.filter.outputs.python }}
node: ${{ steps.filter.outputs.node }}
wasm: ${{ steps.filter.outputs.wasm }}
go: ${{ steps.filter.outputs.go }}
java: ${{ steps.filter.outputs.java }}
csharp: ${{ steps.filter.outputs.csharp }}
ruby: ${{ steps.filter.outputs.ruby }}
php: ${{ steps.filter.outputs.php }}
elixir: ${{ steps.filter.outputs.elixir }}
docker: ${{ steps.filter.outputs.docker }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Detect changes
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- 'crates/ts-pack-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'sources/**'
rust:
- 'crates/ts-pack-core/**'
- 'crates/ts-pack-cli/**'
- 'e2e/rust/**'
ffi:
- 'crates/ts-pack-core-ffi/**'
- 'crates/ts-pack-core/**'
python:
- 'crates/ts-pack-core-py/**'
- 'packages/python/**'
- 'e2e/python/**'
- 'fixtures/**'
node:
- 'crates/ts-pack-core-node/**'
- 'packages/typescript/**'
- 'e2e/node/**'
- 'fixtures/**'
wasm:
- 'crates/ts-pack-core-wasm/**'
- 'packages/wasm/**'
- 'e2e/wasm/**'
- 'fixtures/**'
go:
- 'packages/go/**'
- 'e2e/go/**'
- 'crates/ts-pack-core-ffi/**'
- 'fixtures/**'
java:
- 'packages/java/**'
- 'e2e/java/**'
- 'crates/ts-pack-core-ffi/**'
- 'fixtures/**'
csharp:
- 'packages/csharp/**'
- 'e2e/csharp/**'
- 'crates/ts-pack-core-ffi/**'
- 'fixtures/**'
ruby:
- 'packages/ruby/**'
- 'e2e/ruby/**'
- 'fixtures/**'
php:
- 'crates/ts-pack-core-php/**'
- 'packages/php/**'
- 'e2e/php/**'
- 'fixtures/**'
elixir:
- 'packages/elixir/**'
- 'e2e/elixir/**'
- 'fixtures/**'
docker:
- 'Dockerfile*'
- 'docker/**'
# ---------------------------------------------------------------------------
# 4. rust-tests — Core Rust unit + e2e tests
# ---------------------------------------------------------------------------
rust-tests:
name: Rust Tests
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.rust == 'true')
needs: [validate, validate-rust, changes, clone-vendors]
runs-on: ubuntu-latest
timeout-minutes: 60
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
TSLP_LINK_MODE: static
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
components: "rustfmt"
use-sccache: "false"
install-llvm-cov: "false"
- name: Install Task
uses: kreuzberg-dev/actions/install-task@v1
- name: Run workspace tests
run: cargo test --workspace --exclude ts-pack-core-wasm
- name: Run Rust E2E tests
run: task rust:e2e:test
# ---------------------------------------------------------------------------
# 5. build-ffi — Build FFI shared/static library
# ---------------------------------------------------------------------------
build-ffi:
name: Build FFI (${{ matrix.os }})
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.ffi == 'true')
needs: [validate, validate-rust, changes, clone-vendors]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
TSLP_LINK_MODE: static
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
components: ""
use-sccache: "false"
install-llvm-cov: "false"
- name: Build FFI library
run: cargo build --release -p ts-pack-core-ffi
- name: Upload FFI artifacts
uses: actions/upload-artifact@v7
with:
name: ffi-${{ matrix.os }}
path: |
target/release/libts_pack_core_ffi.a
target/release/libts_pack_core_ffi.so
target/release/libts_pack_core_ffi.dylib
crates/ts-pack-core-ffi/include/
retention-days: 7
# ---------------------------------------------------------------------------
# 6. build-python — Python wheels (maturin)
# ---------------------------------------------------------------------------
build-python:
name: Build Python (${{ matrix.platform }})
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.python == 'true')
needs: [rust-tests, changes, clone-vendors]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x86_64
- os: macos-latest
platform: macos-arm64
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
TSLP_LINK_MODE: static
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
components: ""
use-sccache: "false"
install-llvm-cov: "false"
- name: Install maturin
run: pip install maturin
- name: Build wheel
run: maturin build --release --manifest-path crates/ts-pack-core-py/Cargo.toml --out dist
- name: Upload wheel
uses: actions/upload-artifact@v7
with:
name: wheel-${{ matrix.platform }}
path: dist/*.whl
if-no-files-found: error
retention-days: 7
# ---------------------------------------------------------------------------
# 6b. test-python — Run Python E2E tests against built wheels
# ---------------------------------------------------------------------------
test-python:
name: Test Python (${{ matrix.python-version }}, ${{ matrix.platform }})
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.python == 'true')
needs: [build-python, changes]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x86_64
python-version: "3.10"
- os: ubuntu-latest
platform: linux-x86_64
python-version: "3.14"
- os: macos-latest
platform: macos-arm64
python-version: "3.14"
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Download wheel
uses: actions/download-artifact@v8
with:
name: wheel-${{ matrix.platform }}
path: dist
- name: Install wheel
shell: bash
run: |
wheel_file=$(find dist -name '*.whl' -print -quit)
pip install "$wheel_file" tree-sitter pytest
- name: Run E2E tests
run: cd e2e/python && pip install -e . && pytest tests/ -v
# ---------------------------------------------------------------------------
# 7. build-node — Node.js NAPI native module
# ---------------------------------------------------------------------------
build-node:
name: Build Node.js (${{ matrix.platform }})
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.node == 'true')
needs: [rust-tests, changes, clone-vendors]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-x64
- os: macos-latest
target: aarch64-apple-darwin
platform: macos-arm64
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
TSLP_LINK_MODE: static
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
components: ""
use-sccache: "false"
install-llvm-cov: "false"
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install NAPI-RS CLI
run: npm install -g @napi-rs/cli
- name: Build native module
working-directory: crates/ts-pack-core-node
run: napi build --release --platform --target ${{ matrix.target }}
- name: Upload native module
uses: actions/upload-artifact@v7
with:
name: node-${{ matrix.platform }}
path: crates/ts-pack-core-node/*.node
if-no-files-found: error
retention-days: 7
# ---------------------------------------------------------------------------
# 7b. test-node — Node.js E2E tests
# ---------------------------------------------------------------------------
test-node:
name: Test Node.js (${{ matrix.platform }})
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.node == 'true')
needs: [build-node, changes]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x64
- os: macos-latest
platform: macos-arm64
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js workspace
uses: kreuzberg-dev/actions/setup-node-workspace@v1
- name: Download native module
uses: actions/download-artifact@v8
with:
name: node-${{ matrix.platform }}
path: crates/ts-pack-core-node/
- name: Smoke test native module
shell: bash
working-directory: crates/ts-pack-core-node
run: node -e "const m = require('./'); console.log('Languages:', m.availableLanguages().length)"
- name: Run E2E tests
shell: bash
working-directory: e2e/typescript
run: npx vitest run
# ---------------------------------------------------------------------------
# 8. build-wasm — WebAssembly (web + node targets)
# ---------------------------------------------------------------------------
build-wasm:
name: Build WASM
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.wasm == 'true')
needs: [rust-tests, changes, clone-vendors]
runs-on: ubuntu-latest
timeout-minutes: 120
env:
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Setup Rust
uses: kreuzberg-dev/actions/setup-rust@v1
with:
target: wasm32-unknown-unknown
components: ""
use-sccache: "true"
install-llvm-cov: "false"
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install wasi-sdk
uses: kreuzberg-dev/actions/install-wasi-sdk@v1
- name: Build WASM (web target)
working-directory: crates/ts-pack-core-wasm
run: wasm-pack build --target web --release
env:
PROJECT_ROOT: ${{ github.workspace }}
- name: Verify WASM artifacts
shell: bash
run: |
for FILE in \
crates/ts-pack-core-wasm/pkg/ts_pack_wasm.js \
crates/ts-pack-core-wasm/pkg/ts_pack_wasm.d.ts \
crates/ts-pack-core-wasm/pkg/ts_pack_wasm_bg.wasm; do
if [ ! -f "$FILE" ]; then
echo "ERROR: Expected file missing: $FILE"
exit 1
fi
echo "OK: $FILE"
done
- name: Upload WASM artifacts
uses: actions/upload-artifact@v7
with:
name: wasm-pkg
path: |
crates/ts-pack-core-wasm/pkg/*.wasm
crates/ts-pack-core-wasm/pkg/*.js
crates/ts-pack-core-wasm/pkg/*.ts
crates/ts-pack-core-wasm/pkg/package.json
retention-days: 7
- name: Build WASM (Node.js target)
working-directory: crates/ts-pack-core-wasm
run: wasm-pack build --target nodejs --release
env:
PROJECT_ROOT: ${{ github.workspace }}
- name: Upload WASM Node.js artifacts
uses: actions/upload-artifact@v7
with:
name: wasm-node-pkg
path: |
crates/ts-pack-core-wasm/pkg/*.wasm
crates/ts-pack-core-wasm/pkg/*.js
crates/ts-pack-core-wasm/pkg/*.ts
crates/ts-pack-core-wasm/pkg/package.json
retention-days: 7
# ---------------------------------------------------------------------------
# 8b. test-wasm — WASM E2E tests
# ---------------------------------------------------------------------------
test-wasm:
name: Test WASM
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.wasm == 'true')
needs: [build-wasm, changes]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download WASM Node.js artifacts
uses: actions/download-artifact@v8
with:
name: wasm-node-pkg
path: crates/ts-pack-core-wasm/pkg/
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install E2E dependencies
working-directory: e2e/wasm
run: npm install
- name: Run E2E tests
working-directory: e2e/wasm
run: npx vitest run
# ---------------------------------------------------------------------------
# 9. test-go — Go tests (needs FFI)
# ---------------------------------------------------------------------------
test-go:
name: Test Go
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.go == 'true' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.ffi == 'true')
needs: [build-ffi, changes, clone-vendors]
runs-on: ubuntu-latest
timeout-minutes: 30
env:
PROJECT_ROOT: ${{ github.workspace }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Download FFI artifacts
uses: actions/download-artifact@v8
with:
name: ffi-ubuntu-latest
path: ffi-artifacts
- name: Restore FFI to expected paths
run: |
mkdir -p target/release
cp ffi-artifacts/target/release/libts_pack_core_ffi.* target/release/ 2>/dev/null || true
mkdir -p crates/ts-pack-core-ffi/include
cp -r ffi-artifacts/crates/ts-pack-core-ffi/include/* crates/ts-pack-core-ffi/include/ 2>/dev/null || true
mkdir -p crates/ts-pack-core-ffi/target/release
cp target/release/libts_pack_core_ffi.* crates/ts-pack-core-ffi/target/release/ 2>/dev/null || true
- name: Verify go.mod placement
run: |
test -f packages/go/go.mod || (echo "ERROR: go.mod missing at packages/go/go.mod" && exit 1)
grep -q 'module github.com/kreuzberg-dev/tree-sitter-language-pack/packages/go$' packages/go/go.mod \
|| (echo "ERROR: module path in go.mod is wrong" && exit 1)
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "1.26"
cache-dependency-path: packages/go/go.sum
- name: Install Task
uses: kreuzberg-dev/actions/install-task@v1
- name: Run Go tests
run: task go:test
- name: Run Go lint
run: task go:lint
- name: Check Go formatting
run: task go:format:check
- name: Setup Rust (for e2e generate)
uses: kreuzberg-dev/actions/setup-rust@v1
with:
components: ""
use-sccache: "false"
install-llvm-cov: "false"
- name: Install alef
uses: kreuzberg-dev/actions/install-alef@v1
- name: Generate Go E2E tests
run: task go:e2e:generate
- name: Run Go E2E tests
run: task go:e2e:test
# ---------------------------------------------------------------------------
# 10. test-java — Java tests (needs FFI)
# ---------------------------------------------------------------------------
test-java:
name: Test Java
if: |
github.repository == 'kreuzberg-dev/tree-sitter-language-pack' &&
github.actor != 'dependabot[bot]' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.java == 'true' ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.ffi == 'true')
needs: [build-ffi, changes, clone-vendors]
runs-on: ubuntu-latest
timeout-minutes: 30
env:
PROJECT_ROOT: ${{ github.workspace }}
TSLP_LANGUAGES: "python,rust,javascript,typescript,go,html,css,json"
TSLP_LINK_MODE: static
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download parsers
uses: actions/download-artifact@v8
with:
name: language-parsers
path: parsers
- name: Download FFI artifacts
uses: actions/download-artifact@v8
with:
name: ffi-ubuntu-latest
path: ffi-artifacts
- name: Restore FFI to expected paths
run: |
mkdir -p target/release
cp ffi-artifacts/target/release/libts_pack_core_ffi.* target/release/ 2>/dev/null || true
mkdir -p crates/ts-pack-core-ffi/include
cp -r ffi-artifacts/crates/ts-pack-core-ffi/include/* crates/ts-pack-core-ffi/include/ 2>/dev/null || true
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "25"
cache: "maven"
- name: Set library paths for JNI
shell: bash
run: echo "LD_LIBRARY_PATH=${{ github.workspace }}/target/release:${LD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
- name: Run Java unit tests
working-directory: packages/java
run: mvn test
env:
TSPACK_LIB_PATH: ${{ github.workspace }}/target/release/libts_pack_core_ffi.so
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v7
with:
name: java-unit-reports
path: packages/java/target/surefire-reports
if-no-files-found: ignore
retention-days: 7
- name: Setup Rust (for alef e2e generate)
uses: kreuzberg-dev/actions/setup-rust@v1
with:
components: ""
use-sccache: "false"
install-llvm-cov: "false"
- name: Build Java jar
working-directory: packages/java
run: mvn package -DskipTests
- name: Run Java E2E tests
working-directory: e2e/java
run: mvn test
env:
TSPACK_LIB_PATH: ${{ github.workspace }}/target/release/libts_pack_core_ffi.so
MAVEN_OPTS: "--enable-native-access=ALL-UNNAMED -Dsun.misc.unsafe.memory.access=allow"
- name: Upload E2E test reports
if: always()
uses: actions/upload-artifact@v7
with:
name: java-e2e-reports
path: e2e/java/target/surefire-reports
if-no-files-found: ignore
retention-days: 7
# ---------------------------------------------------------------------------
# 11. test-csharp — C# tests (builds FFI locally per platform)
# ---------------------------------------------------------------------------
test-csharp:
name: Test C# (${{ matrix.os }})
if: |