-
Notifications
You must be signed in to change notification settings - Fork 0
1430 lines (1202 loc) · 47.6 KB
/
Copy pathci.yml
File metadata and controls
1430 lines (1202 loc) · 47.6 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
- 'release-please--**'
pull_request:
branches: [ main ]
merge_group:
types: [checks_requested]
permissions:
contents: read
actions: read
pull-requests: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# sdl2-sys bundled build ships an older SDL2 CMakeLists.txt that uses
# cmake_minimum_required(VERSION 3.1.3). Newer CMake versions (4.0+)
# removed compatibility with policies < 3.5; this env var restores it.
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
jobs:
# Fast sanity checks to fail quickly before heavy matrix jobs
preflight:
name: Preflight (Ubuntu Stable)
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev
- name: Set up Python (for codegen)
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Validate architecture docs
run: python3 scripts/generate-architecture-docs.py --check
- name: Validate AGENTS.md constraints
run: bash scripts/check-agents-md.sh
- name: Run SDK codegen (generates .g.rs files needed by workspace)
run: |
python codegen/validate_coverage.py
python codegen/gen_csharp.py
python codegen/gen_python.py
python codegen/gen_ts_node.py
python codegen/gen_ts_web.py
python codegen/gen_kotlin.py
- name: Upload shared codegen artifact
uses: actions/upload-artifact@v4
with:
name: codegen-generated
path: |
sdks/csharp/generated/
sdks/python/goudengine/generated/
sdks/python/goudengine/__init__.py
sdks/typescript/src/generated/
sdks/typescript/native/src/*.g.rs
sdks/typescript/native/src/lib.rs
if-no-files-found: error
retention-days: 1
- name: Quick Rust check
run: cargo check --workspace --all-targets
- name: Check formatting
run: |
cargo fmt -p goud-engine-core -- --check
# Format generated napi-rs files (gitignored, no --check needed)
cargo fmt -p goud-engine-node
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
# Rust checks and tests
rust-check:
name: Rust ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [preflight]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: ${{ (github.event_name != 'pull_request' || (matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' && matrix.lane == 'full')) && 'true' || 'false' }}
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
include: ${{ fromJSON(github.event_name == 'pull_request' && '[{"os":"ubuntu-latest","rust":"stable","lane":"full","run_windows_native_clippy":false},{"os":"ubuntu-latest","rust":"nightly","lane":"smoke","run_windows_native_clippy":false},{"os":"macos-latest","rust":"stable","lane":"smoke","run_windows_native_clippy":false},{"os":"windows-latest","rust":"stable","lane":"clippy-only","run_windows_native_clippy":true}]' || '[{"os":"ubuntu-latest","rust":"stable","lane":"full","run_windows_native_clippy":false},{"os":"macos-latest","rust":"stable","lane":"full","run_windows_native_clippy":false},{"os":"windows-latest","rust":"stable","lane":"full","run_windows_native_clippy":true},{"os":"ubuntu-latest","rust":"nightly","lane":"smoke","run_windows_native_clippy":false},{"os":"macos-latest","rust":"nightly","lane":"smoke","run_windows_native_clippy":false}]') }}
steps:
- name: Free disk space (Ubuntu)
if: matrix.os == 'ubuntu-latest' && matrix.lane == 'full'
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force || true
df -h /
- uses: actions/checkout@v7
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
components: clippy
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev libxkbcommon-x11-dev
- name: Run clippy (Windows stable)
if: matrix.run_windows_native_clippy
run: cargo clippy --all-targets --features native -- -D warnings
shell: bash
- name: Nightly check/build smoke
if: matrix.rust == 'nightly'
run: |
cargo check --workspace --all-targets --all-features
cargo build --workspace --all-targets --all-features
- name: Stable smoke checks
if: matrix.rust == 'stable' && matrix.lane == 'smoke'
run: |
cargo check --workspace --all-targets --all-features
cargo test --lib sdk -- --nocapture
cargo test --test ffi_safety -- --nocapture
- name: Stable full suite (non-doc tests)
if: matrix.rust == 'stable' && matrix.lane == 'full'
run: cargo test --workspace --lib --bins --tests -- --nocapture
- name: Headless profile tests
if: matrix.rust == 'stable' && matrix.lane == 'full' && matrix.os == 'ubuntu-latest'
run: cargo test --features headless --lib -- null --nocapture
- name: Documentation tests (once per lane)
if: matrix.rust == 'stable' && matrix.lane == 'full' && matrix.os == 'ubuntu-latest'
run: cargo test --workspace --doc -- --nocapture
# Only run on stable for coverage
- name: Install cargo-tarpaulin
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && github.event_name == 'merge_group'
uses: taiki-e/install-action@cargo-tarpaulin
- name: Generate coverage
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && github.event_name == 'merge_group'
run: |
cargo tarpaulin \
--out xml html \
--output-dir coverage-report \
--all-features \
-p goud-engine-core \
--timeout 300 \
--branch \
--exclude-files "*/build.rs" \
--exclude-files "*/tests/*" \
--exclude-files "*/examples/*" \
--exclude-files "*/ffi/**" \
--exclude-files "*/sdk.rs"
- name: Check branch coverage threshold (70%)
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && github.event_name == 'merge_group' && always()
run: |
if [ ! -f coverage-report/cobertura.xml ]; then
echo "WARNING: Coverage report not found, skipping branch check"
exit 0
fi
BRANCH_RATE=$(python3 -c "
import xml.etree.ElementTree as ET
tree = ET.parse('coverage-report/cobertura.xml')
rate = tree.getroot().attrib.get('branch-rate')
if rate is None:
print('SKIP')
else:
print(f'{float(rate) * 100:.2f}')
")
if [ "$BRANCH_RATE" = "SKIP" ]; then
echo "WARNING: branch-rate attribute not found in cobertura.xml"
exit 0
fi
echo "Branch coverage: ${BRANCH_RATE}%"
if python3 -c "exit(0 if float('${BRANCH_RATE}') >= 70.0 else 1)"; then
echo "PASS: Branch coverage meets 70% threshold"
else
echo "WARNING: Branch coverage ${BRANCH_RATE}% is below 70% target (informational)"
fi
- name: Upload coverage report
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && github.event_name == 'merge_group' && always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-report/
retention-days: 1
- name: Upload coverage to Codecov
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && github.event_name == 'merge_group'
uses: codecov/codecov-action@v7
with:
file: ./coverage-report/cobertura.xml
flags: rust
name: rust-coverage
fail_ci_if_error: false
# Cargo deny check (license/security)
cargo-deny:
name: Cargo Deny Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: EmbarkStudios/cargo-deny-action@v2
with:
log-level: warn
command: check
arguments: --all-features
# Codegen drift detection — ensures generated SDK code is up to date
codegen-drift-check:
name: Codegen Drift Check
runs-on: ubuntu-latest
needs: [preflight]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
steps:
- uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Build (generates ffi_manifest.json)
run: cargo build
- name: Run full codegen pipeline
run: ./codegen.sh
- name: Validate codegen
run: |
python codegen/validate.py
python codegen/validate_coverage.py
- name: Lint layer dependencies
run: cargo run -p lint-layers
- name: Check for codegen drift
run: bash scripts/check-generated-artifacts.sh
- name: Verify SDK READMEs are up to date
run: python3 codegen/gen_sdk_readmes.py --check
# Build native release libraries once per OS and share across SDK jobs
native-release:
name: Native Release Artifact on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [preflight]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
os: ${{ fromJSON(github.event_name == 'pull_request' && '["ubuntu-latest","macos-latest"]' || '["ubuntu-latest","macos-latest","windows-latest"]') }}
steps:
- uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev libxkbcommon-x11-dev
- name: Build native library
run: cargo build --release
- name: Stage native release artifact
run: |
mkdir -p native-release
if [[ "$RUNNER_OS" == "Linux" ]]; then
cp target/release/libgoud_engine.so native-release/
elif [[ "$RUNNER_OS" == "macOS" ]]; then
cp target/release/libgoud_engine.dylib native-release/
else
cp target/release/goud_engine.dll native-release/
fi
shell: bash
- name: Upload native release artifact
uses: actions/upload-artifact@v4
with:
name: native-release-${{ matrix.os }}
path: native-release/
if-no-files-found: error
retention-days: 1
# Python SDK checks and tests
python-sdk-check:
name: Python SDK on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [preflight, native-release]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v7
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev libxkbcommon-x11-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Python coverage tooling
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
run: python -m pip install coverage
- name: Download native release artifact
uses: actions/download-artifact@v4
with:
name: native-release-${{ matrix.os }}
path: native-release
- name: Set up library path (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: echo "LD_LIBRARY_PATH=${{ github.workspace }}/native-release:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Set up library path (macOS)
if: matrix.os == 'macos-latest'
run: echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/native-release:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Run Python SDK tests
env:
PYTHONPATH: ${{ github.workspace }}/sdks/python
GOUD_ENGINE_LIB: ${{ github.workspace }}/native-release
run: |
python --version
python sdks/python/test_bindings.py
python sdks/python/test_network_loopback.py
- name: Test Python demo imports
env:
PYTHONPATH: ${{ github.workspace }}/sdks/python
GOUD_ENGINE_LIB: ${{ github.workspace }}/native-release
run: |
cd examples/python
python << 'EOF'
import sys
sys.path.insert(0, '../../sdks/python')
from goudengine import (
GoudGame, Entity, Transform2D, Sprite, Vec2, Color
)
print('Python SDK imports successful')
# Basic component tests
t = Transform2D.from_position(100, 200)
print(f'Transform2D: {t}')
s = Sprite(texture_handle=42)
print(f'Sprite: {s}')
print('All Python SDK basic tests passed!')
EOF
- name: Generate Python coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
env:
PYTHONPATH: ${{ github.workspace }}/sdks/python
GOUD_ENGINE_LIB: ${{ github.workspace }}/native-release
run: |
python -m coverage erase
python -m coverage run --source=sdks/python/goudengine sdks/python/test_bindings.py
python -m coverage run --append --source=sdks/python/goudengine sdks/python/test_network_loopback.py
python -m coverage report --fail-under=80
python -m coverage xml -o sdks/python/coverage.xml
- name: Upload Python coverage results
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: python-coverage
path: sdks/python/coverage.xml
if-no-files-found: error
retention-days: 3
# .NET SDK checks and tests
dotnet-check:
name: .NET SDK on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [preflight, native-release]
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
os: ${{ fromJSON(github.event_name == 'pull_request' && '["ubuntu-latest","macos-latest"]' || '["ubuntu-latest","macos-latest","windows-latest"]') }}
steps:
- uses: actions/checkout@v7
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev
- name: Download native release artifact
uses: actions/download-artifact@v4
with:
name: native-release-${{ matrix.os }}
path: native-release
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Set up library path (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: echo "LD_LIBRARY_PATH=${{ github.workspace }}/native-release:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Set up library path (macOS)
if: matrix.os == 'macos-latest'
run: echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/native-release:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
working-directory: sdks/csharp
run: dotnet restore ../csharp.tests/GoudEngine.Tests.csproj
- name: Build
working-directory: sdks/csharp
run: dotnet build ../csharp.tests/GoudEngine.Tests.csproj --no-restore --configuration Release
- name: Copy native library to test directory (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: cp native-release/libgoud_engine.so sdks/csharp.tests/bin/Release/net8.0/
- name: Copy native library to test directory (macOS)
if: matrix.os == 'macos-latest'
run: cp native-release/libgoud_engine.dylib sdks/csharp.tests/bin/Release/net8.0/
- name: Copy native library to test directory (Windows)
if: matrix.os == 'windows-latest'
run: copy native-release\goud_engine.dll sdks\csharp.tests\bin\Release\net8.0\libgoud_engine.dll
- name: Test
working-directory: sdks/csharp
run: dotnet test ../csharp.tests/GoudEngine.Tests.csproj --no-build --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" /p:CollectCoverage=true /p:CoverletOutput=../csharp.tests/TestResults/${{ matrix.os }}/coverage/ /p:CoverletOutputFormat=cobertura
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: dotnet-test-results-${{ matrix.os }}
path: '**/test-results.trx'
retention-days: 3
- name: Upload C# coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: dotnet-coverage-${{ matrix.os }}
path: 'sdks/csharp.tests/TestResults/${{ matrix.os }}/coverage/coverage.cobertura.xml'
retention-days: 3
- name: Upload C# coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v7
with:
file: sdks/csharp.tests/TestResults/${{ matrix.os }}/coverage/coverage.cobertura.xml
flags: dotnet
name: dotnet-coverage
fail_ci_if_error: false
# Build check to ensure everything compiles together
integration-build:
name: Integration Build Check
runs-on: ${{ matrix.os }}
# Intentionally parallelized for faster feedback; ci-success still gates SDK jobs.
needs: [preflight]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev
- name: Run full build script
run: |
chmod +x build.sh
./build.sh --local
- name: Verify build artifacts
run: |
# Check Rust library exists
if [[ "$RUNNER_OS" == "macOS" ]]; then
if [[ "$RUNNER_ARCH" == "ARM64" ]]; then
test -f sdks/csharp/runtimes/osx-arm64/native/libgoud_engine.dylib
else
test -f sdks/csharp/runtimes/osx-x64/native/libgoud_engine.dylib
fi
elif [[ "$RUNNER_OS" == "Linux" ]]; then
test -f sdks/csharp/runtimes/linux-x64/native/libgoud_engine.so
fi
# Check .NET package exists
test -f sdks/nuget_package_output/GoudEngine.*.nupkg
- name: Verify Python SDK can import
env:
PYTHONPATH: ${{ github.workspace }}/sdks/python
LD_LIBRARY_PATH: ${{ github.workspace }}/target/debug:${{ env.LD_LIBRARY_PATH }}
DYLD_LIBRARY_PATH: ${{ github.workspace }}/target/debug:${{ env.DYLD_LIBRARY_PATH }}
run: |
python -c "from goudengine import GoudGame, Entity, Transform2D, Sprite; print('Python SDK integration check passed')"
# TypeScript SDK — native addon build + tests
typescript-sdk-native:
name: TS SDK Native on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [preflight]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: ${{ (github.event_name != 'pull_request' || matrix.os == 'ubuntu-latest') && 'true' || 'false' }}
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
os: ${{ fromJSON(github.event_name == 'pull_request' && '["ubuntu-latest","macos-latest"]' || '["ubuntu-latest","macos-latest","windows-latest"]') }}
steps:
- uses: actions/checkout@v7
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: sdks/typescript/package-lock.json
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev libxkbcommon-x11-dev
- name: Install npm dependencies
working-directory: sdks/typescript
run: npm ci
- name: Install Playwright Chromium
working-directory: sdks/typescript
run: npx playwright install --with-deps chromium
- name: Create native typing shim (PR macOS smoke lane)
if: github.event_name == 'pull_request' && matrix.os != 'ubuntu-latest'
working-directory: sdks/typescript
run: |
cat > index.d.ts <<'EOF'
export type GameConfig = {
width?: number;
height?: number;
title?: string;
};
export class GoudGame {
constructor(config?: GameConfig);
[key: string]: any;
}
export class GoudContext {
constructor();
[key: string]: any;
}
export class Entity {
[key: string]: any;
}
export class UiManager {
constructor();
[key: string]: any;
}
EOF
- name: Build native addon
if: github.event_name != 'pull_request' || matrix.os == 'ubuntu-latest'
working-directory: sdks/typescript
run: npm run build:native
- name: Build TypeScript (Node)
working-directory: sdks/typescript
run: npm run build:ts
- name: Type-check TypeScript examples
run: |
cd examples/typescript/flappy_bird && npm install && npx tsc --noEmit
- name: Run smoke tests (Ubuntu with virtual display)
if: matrix.os == 'ubuntu-latest'
working-directory: sdks/typescript
run: xvfb-run npm run test:native
- name: Generate TypeScript coverage report
if: matrix.os == 'ubuntu-latest'
working-directory: sdks/typescript
run: xvfb-run npm run coverage:native
- name: Run smoke tests (macOS/Windows — skip GLFW window tests in headless CI)
if: matrix.os != 'ubuntu-latest'
working-directory: sdks/typescript
run: |
echo "Smoke tests require a display (GLFW window). Build verified above."
echo "Full smoke tests run on ubuntu-latest with xvfb."
- name: Upload TypeScript coverage results
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ts-coverage
path: sdks/typescript/coverage/native/cobertura-coverage.xml
if-no-files-found: error
retention-days: 3
- name: Upload native addon
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ts-native-${{ matrix.os }}
path: sdks/typescript/*.node
retention-days: 1
# TypeScript SDK — wasm build (Ubuntu only, one platform sufficient)
typescript-sdk-wasm:
name: TS SDK Wasm Build
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
runs-on: ubuntu-latest
needs: [preflight]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
steps:
- uses: actions/checkout@v7
- name: Download shared codegen artifact
uses: actions/download-artifact@v4
with:
name: codegen-generated
path: sdks
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: sdks/typescript/package-lock.json
- name: Install pinned wasm-pack
env:
WASM_PACK_VERSION: "0.13.1"
run: |
curl -sSfL "https://github.com/rustwasm/wasm-pack/releases/download/v${WASM_PACK_VERSION}/wasm-pack-v${WASM_PACK_VERSION}-x86_64-unknown-linux-musl.tar.gz" -o /tmp/wasm-pack.tar.gz
tar -xzf /tmp/wasm-pack.tar.gz -C /tmp
sudo install /tmp/wasm-pack-v${WASM_PACK_VERSION}-x86_64-unknown-linux-musl/wasm-pack /usr/local/bin/wasm-pack
wasm-pack --version
- name: Install npm dependencies
working-directory: sdks/typescript
run: npm ci
- name: Install Playwright Chromium
working-directory: sdks/typescript
run: npx playwright install --with-deps chromium
- name: Build wasm module
working-directory: sdks/typescript
# wasm-pack already runs wasm-opt for this bundle; a second manual pass
# broke Chromium's externref table initialization in the runtime smoke.
run: npm run build:wasm
- name: Build web TypeScript
working-directory: sdks/typescript
run: npm run build:ts:web
- name: Type-check web sources
working-directory: sdks/typescript
run: npx tsc -p tsconfig.web.json --noEmit
- name: Generate TypeScript web coverage report
working-directory: sdks/typescript
run: npm run coverage:web-runtime
- name: Verify wasm output structure
working-directory: sdks/typescript
run: |
echo "=== Wasm output ==="
ls -la wasm/
echo "=== Web dist output ==="
find dist/web/ -name "*.js" | head -20 || echo "No JS files in dist/web/"
test -f wasm/goud_engine_bg.wasm
test -f wasm/goud_engine.js
- name: Upload TypeScript web coverage results
uses: actions/upload-artifact@v4
with:
name: ts-web-coverage
path: sdks/typescript/coverage/web/cobertura-coverage.xml
if-no-files-found: error
retention-days: 3
- name: Upload wasm artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ts-wasm
path: |
sdks/typescript/wasm/*.wasm
sdks/typescript/wasm/*.js
sdks/typescript/wasm/*.d.ts
retention-days: 1
# C++ SDK tests (non-GL only, headless CI safe)
# Windows C++ CI is excluded: MSVC support is scaffolded in FindGoudEngine.cmake
# but not yet validated in CI. Add windows-latest when a Windows native-release
# artifact is reliably available on PRs.
cpp-tests:
name: C++ SDK Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [preflight, native-release]
strategy:
fail-fast: ${{ github.event_name == 'pull_request' }}
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- name: Download native release artifact
uses: actions/download-artifact@v4
with:
name: native-release-${{ matrix.os }}
path: native-release
- name: Stage native library
run: |
mkdir -p target/release target/release/deps
cp native-release/* target/release/
cp native-release/* target/release/deps/
shell: bash
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: Configure C++ tests
run: |
cmake -B sdks/cpp/build \
-DGOUD_BUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
sdks/cpp
- name: Build C++ tests
run: cmake --build sdks/cpp/build --config Release
- name: Run non-GL C++ tests
run: sdks/cpp/build/tests/goud_cpp_tests "~[gl_required]"
# Kotlin SDK tests
kotlin-sdk-test:
name: Kotlin SDK Test
runs-on: ubuntu-latest
needs: [preflight]
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Generate Kotlin SDK
run: python codegen/gen_kotlin.py
- name: Run Kotlin SDK tests
working-directory: sdks/kotlin
run: ./gradlew test --no-daemon -x buildNative
sandbox-parity:
name: Sandbox Recovery Smoke
runs-on: ubuntu-latest
needs: [preflight]
steps:
- uses: actions/checkout@v7
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev libasound2-dev libudev-dev libxkbcommon-x11-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: |
sdks/typescript/package-lock.json
examples/typescript/sandbox/package-lock.json