Repository navigation
3205 lines (2890 loc) · 129 KB
/
Copy pathci.yml
File metadata and controls
3205 lines (2890 loc) · 129 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']
tags: ['v*']
pull_request:
branches: ['main']
# One bounded recovery of the immutable release; execute this workflow on main.
workflow_dispatch:
inputs:
recovery_release:
description: Recover the immutable v0.10.3 release
required: true
type: choice
options: [v0.10.3]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
# Content identity and workflow identity are deliberately different in recovery.
CI_SOURCE_SHA: ${{ github.event_name == 'workflow_dispatch' && 'd01ad41f0a01e8fe529f4f78358c5c2947d52f0d' || github.sha }}
CI_WORKFLOW_SHA: ${{ github.workflow_sha }}
# Prevent duplicate runs
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && 'v0.10.3' || github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: write
id-token: write
issues: write
pages: write
packages: read
pull-requests: write
jobs:
detect-release-tag:
name: Detect release tag on commit
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))) || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-24.04
outputs:
is_release: ${{ steps.detect.outputs.is_release }}
tag: ${{ steps.detect.outputs.tag }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
fetch-depth: 0
fetch-tags: true
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Detect v* tag for current commit
id: detect
shell: bash
run: |
set -euo pipefail
if [[ '${{ github.event_name }}' == workflow_dispatch ]]; then
test '${{ github.ref }}' = refs/heads/main
test '${{ inputs.recovery_release }}' = v0.10.3
test "$(git rev-parse 'refs/tags/v0.10.3^{commit}')" = "$CI_SOURCE_SHA"
test "$(git rev-parse HEAD^{tree})" = 44e7f5a097b4215b03c6213b1014db8d3dc53028
fi
mapfile -t tags < <(git tag --points-at "$CI_SOURCE_SHA" 'v*' | sort -V)
if [ "${#tags[@]}" -eq 0 ]; then
echo "is_release=false" >> "$GITHUB_OUTPUT"
echo "tag=" >> "$GITHUB_OUTPUT"
echo "No v* tag detected on $CI_SOURCE_SHA"
exit 0
fi
tag="${tags[$((${#tags[@]} - 1))]}"
if [[ '${{ github.event_name }}' == workflow_dispatch ]]; then tag=v0.10.3; fi
if [ "${#tags[@]}" -gt 1 ]; then
echo "::warning::Multiple v* tags point at $CI_SOURCE_SHA: ${tags[*]}. Using $tag."
fi
echo "is_release=true" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "Detected release tag: $tag"
printf 'source=%s\nworkflow=%s\ntag=%s\ntree=%s\n' \
"$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$tag" "$(git rev-parse HEAD^{tree})" \
> "$RUNNER_TEMP/release-provenance.txt"
- name: Retain release source and workflow identities
if: steps.detect.outputs.is_release == 'true'
uses: actions/upload-artifact@v6
with:
name: release-provenance
path: ${{ runner.temp }}/release-provenance.txt
# ============================================================================
# Rust Testing
# ============================================================================
fmt:
name: Format
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install rustfmt
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain "$(awk -F'"' '/^channel/ { print $2 }' rust-toolchain.toml)" \
--component rustfmt
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check humanoid benchmark policy and runner controls
run: python3 -m unittest discover -s examples/benchmarks/humanoid -p test_benchmark.py -v
- name: Install Node for CI script tests
uses: actions/setup-node@v5
with:
node-version: 22
- name: Test CI scripts
run: node --test .github/scripts/*.test.mjs
# Architectural invariant, checked without compiling anything: `xtask` must
# carry NO rumoca-* workspace crate. It parses args, moves files, and shells
# out; compiler-linked work runs on demand through a command in its owning
# package. If a rumoca-* dep creeps back in,
# building any xtask bin again drags in the whole compiler/diffsol stack.
- name: Architecture — xtask stays dependency-light
run: |
deps=$(cargo tree -p xtask -e normal --prefix none | grep '^rumoca-' | sort -u || true)
if [ -n "$deps" ]; then
echo "::error::xtask must not depend on any rumoca-* crate, but it now pulls in:"
echo "$deps"
echo "Move the heavy code into a compiler-linked crate and shell out to it."
exit 1
fi
echo "OK: xtask has no rumoca-* dependencies"
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
fetch-depth: 0
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install system dependencies
uses: ./.github/actions/apt-install
with:
packages: libudev-dev
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$(awk -F'"' '/^channel/ { print $2 }' rust-toolchain.toml)" --component rustfmt,clippy
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Rust cache (lint)
uses: Swatinem/rust-cache@v2
with:
shared-key: lint
save-if: ${{ github.event_name != 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
- name: Run lint gate
run: cargo xtask verify lint
- name: Run architecture review scan
if: github.event_name == 'pull_request'
run: |
cargo xtask repo review-scan \
--base origin/${{ github.base_ref }} \
--head HEAD \
--out target/review/review-scan.json \
--fail-on-forbidden
- name: Upload architecture review scan
if: github.event_name == 'pull_request' && always()
uses: actions/upload-artifact@v6
with:
name: architecture-review-scan
path: target/review/review-scan.json
if-no-files-found: ignore
retention-days: 7
- name: Check generated parsers are current
shell: bash
run: |
set -euo pipefail
git diff --exit-code -- \
crates/rumoca-phase-parse/src/generated \
crates/rumoca-phase-parse-galec/src/parse/generated
- name: Generate crate DAG release artifact
run: cargo xtask repo graph crates --format dot
- name: Upload crate DAG artifact
uses: actions/upload-artifact@v6
with:
name: crate-dag
path: target/crate-dag/workspace-crate-dag.dot
if-no-files-found: error
retention-days: 7
# Reproducible package build via the root crane+fenix flake. Nix store paths
# are cached privately in GitHub Actions, so pull requests need no external
# cache credentials.
nix-checks:
name: Nix flake checks (Linux)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v22
with:
determinate: false
- name: GitHub Actions Nix cache
uses: DeterminateSystems/magic-nix-cache-action@v14
with:
use-flakehub: false
diagnostic-endpoint: ''
# Pull requests read the public cache like the other jobs and need no
# credentials. A push to main also logs in, so the publish step below can
# put rumoca in the cache for downstream flakes (kite, slam_web, the
# humanoid demo) instead of each first build compiling it for 20-40
# minutes. skipPush: nothing is published automatically; only the two
# store paths named in the publish step, with their closures, are pushed.
- name: CogniPilot Nix cache
uses: cachix/cachix-action@v17
with:
name: cognipilot
authToken: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.CACHIX_AUTH_TOKEN || '' }}
skipPush: true
- name: Nix build the package and required MLIR CPU checks
# Build only the reproducible package and focused MLIR CPU checks.
# Format and clippy are owned by the standalone Format/Lint jobs, and
# the heavy release MSL artifact bundle is built once by the dedicated
# `nix-build-msl` producer.
#
# We deliberately do NOT run `nix flake check`: it eval-builds every output
# (re-building those packages), and its `--no-build` eval trips over the
# fenix toolchain `.drv` under the DeterminateSystems installer
# (`path '…rust-nightly.toml.drv' is not valid`). `nix build` realizes the
# toolchain, so building the checks directly is the reliable gate.
run: |
# Nix evaluates the finite Crane + LLVM derivation graph recursively.
# The default hosted-runner stack is too small for this workspace;
# keep the evaluator budget explicit and bounded rather than relying
# on an unlimited process stack. The flake eval depth outgrew the
# earlier 64 MB budget, so raise it to 1 GB (still bounded).
ulimit -s 1048576
nix build --print-build-logs \
.#checks.x86_64-linux.rumoca \
.#checks.x86_64-linux.mlir-cpu
- name: Compare humanoid native speed and task fidelity with MuJoCo
if: github.event_name == 'pull_request'
timeout-minutes: 15
run: bash .github/ci/run-humanoid-comparison.sh
- name: Retain humanoid comparison attempts
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@v6
with:
name: humanoid-comparison
path: |
target/humanoid-comparison
!target/humanoid-comparison/cache/**
if-no-files-found: warn
retention-days: 14
- name: Record added humanoid comparison time
if: always() && github.event_name == 'pull_request'
shell: bash
run: |
if [ -f "$RUNNER_TEMP/humanoid-comparison-start" ]; then
elapsed=$(( $(date +%s) - $(cat "$RUNNER_TEMP/humanoid-comparison-start") ))
mkdir -p target/humanoid-comparison
printf '{"elapsed_seconds":%s}\n' "$elapsed" > target/humanoid-comparison/elapsed.json
awk -v seconds="$elapsed" 'BEGIN {printf "\nHumanoid comparison added %.2f minutes (downloads + setup + runs + artifact upload; excludes the existing package build).\n", seconds / 60}' >> "$GITHUB_STEP_SUMMARY"
fi
- name: Publish rumoca and its dependency build to the CogniPilot cache
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# A cache upload problem is reported, not allowed to turn main red.
continue-on-error: true
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
run: |
set -euo pipefail
if [ -z "${CACHIX_AUTH_TOKEN}" ]; then
echo "::warning::CACHIX_AUTH_TOKEN is not set, so rumoca was not published to the cognipilot cache"
exit 0
fi
ulimit -s 1048576
# checks.rumoca above is the same derivation as packages.rumoca, so
# nothing is rebuilt here. The dependency build (crane's
# buildDepsOnly) is a direct input of it; take it from there rather
# than by searching the store.
rumoca=$(nix path-info .#rumoca)
deps_drv=$(nix-store --query --references "$(nix path-info --derivation .#rumoca)" | grep -E -- '-deps-[^/]+\.drv$')
test "$(printf '%s\n' "$deps_drv" | wc -l)" -eq 1
deps=$(nix-store --query --outputs "$deps_drv")
printf 'Publishing %s\n' "$rumoca" "$deps"
cachix push cognipilot "$rumoca" "$deps"
kani:
name: Kani symbolic event-history contract
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
CARGO_BUILD_JOBS: 4
RUST_TEST_THREADS: 4
RAYON_NUM_THREADS: 4
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v22
with:
determinate: false
- name: GitHub Actions Nix cache
uses: DeterminateSystems/magic-nix-cache-action@v14
with:
use-flakehub: false
diagnostic-endpoint: ''
- name: Prove bounded semantic and runtime contracts with pinned Kani
run: |
nix develop .#kani --command cargo kani --version
nix develop .#kani --command cargo xtask verify kani
- name: Upload Kani proof summary
if: always()
uses: actions/upload-artifact@v6
with:
name: kani-proof-summary
path: target/verification/kani-summary.json
if-no-files-found: warn
retention-days: 7
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-2025]
env:
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
fetch-depth: 0
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
uses: ./.github/actions/apt-install
with:
# libxml2-utils provides xmllint for rumoca-efmi XSD validation tests
packages: libudev-dev libxml2-utils
# macOS ships /usr/bin/xmllint; Windows runner images have no xmllint
# contract, so install libxml2's tools explicitly (the rumoca-efmi XSD
# validation tests hard-fail rather than skip when xmllint is absent).
- name: Install system dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install xsltproc -y --no-progress
xmllint --version
- name: Cache rustup toolchain
uses: actions/cache@v5
continue-on-error: true
with:
path: |
~/.rustup/toolchains
~/.rustup/update-hashes
key: ${{ runner.os }}-rustup-test-v2-${{ hashFiles('rust-toolchain.toml') }}
- name: Install Rust
run: |
export PATH="$HOME/.cargo/bin:$PATH"
toolchain="$(awk -F'"' '/^channel/ { print $2 }' rust-toolchain.toml)"
if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
fi
rustup set profile minimal
if ! rustup toolchain list | grep -Eq "^${toolchain}"; then
rustup toolchain install "$toolchain"
fi
if ! rustup component list --toolchain "$toolchain" --installed | grep -qx 'rust-src'; then
rustup component add rust-src --toolchain "$toolchain"
fi
if ! rustup target list --toolchain "$toolchain" --installed | grep -qx 'wasm32-unknown-unknown'; then
rustup target add wasm32-unknown-unknown --toolchain "$toolchain"
fi
rustup default "$toolchain"
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Rust cache (native)
uses: Swatinem/rust-cache@v2
with:
shared-key: native-test
save-if: ${{ github.event_name != 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
# Linux keeps the dependency target dir here (warm third-party deps);
# all OSes additionally run sccache (next steps) to cache the workspace
# crate compilations rust-cache drops. Windows/macOS keep rust-cache to
# the registry only so it never overlaps sccache on target/.
cache-targets: ${{ runner.os == 'Linux' }}
- name: Run sccache-cache
# sccache (GHA-cache backend) caches per-crate compilations INCLUDING the
# workspace crates that Swatinem rust-cache deliberately drops, so across
# runs each unchanged rumoca crate is a cache hit instead of a recompile.
# Enabling it on Linux too is what stops ubuntu recompiling all of rumoca
# every run (it previously had NO compiler cache — rust-cache keeps deps
# but not workspace crates). Relies on the global CARGO_INCREMENTAL=0.
# The GHA cache service is an optimization, not a dependency: when it
# is unreachable the step is tolerated, the wrapper stays off and the
# later steps (MSL, CMM, tests) still run.
id: sccache
continue-on-error: true
uses: mozilla-actions/sccache-action@v0.0.10
- name: Enable sccache wrapper
if: steps.sccache.outcome == 'success'
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
- name: Cache MSL
uses: actions/cache@v5
continue-on-error: true
id: msl-cache
with:
path: target/msl/ModelicaStandardLibrary-4.1.0
key: msl-v4.1.0-release-zip-layout-v3
- name: Cache CMM
uses: actions/cache@v5
continue-on-error: true
id: cmm-cache
with:
path: target/cmm/CMM-a642c381
key: cmm-a642c381-ca47391811532c89300e52bb8ce53ee4bfd6d6d8412d54e2f13f11387f44dcc3
- name: Ensure MSL
shell: bash
run: |
set -euo pipefail
mkdir -p target/msl
touch target/msl/formatter-stability-required
msl_dir=target/msl/ModelicaStandardLibrary-4.1.0
# Accept only the release-zip layout: a stale or foreign top-level entry
# (for example an unversioned Modelica/ tree) would load a second provider.
unexpected_entries=$(ls -A "$msl_dir" 2>/dev/null | grep -vxF -e Complex.mo -e LICENSE -e "Modelica 4.1.0" -e "ModelicaReference 4.1.0" -e "ModelicaServices 4.1.0" -e ObsoleteModelica4.mo -e README.md || true)
if [[ -f "$msl_dir/Complex.mo" && -f "$msl_dir/Modelica 4.1.0/package.mo" && -z "$unexpected_entries" ]]; then
echo "MSL cache is valid at $msl_dir"
exit 0
fi
rm -rf "$msl_dir"
mkdir -p "$msl_dir"
curl -L -o target/msl/msl-v4.1.0.zip \
https://github.com/modelica/ModelicaStandardLibrary/releases/download/v4.1.0/ModelicaStandardLibrary_v4.1.0.zip
unzip -q target/msl/msl-v4.1.0.zip -d "$msl_dir"
rm target/msl/msl-v4.1.0.zip
test -f "$msl_dir/Complex.mo"
test -f "$msl_dir/Modelica 4.1.0/package.mo"
- name: Ensure CMM for heavy Solve regressions (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
cargo xtask repo modelica-deps ensure
test -f target/cmm/CMM-a642c381/LieGroups/package.mo
- name: Install Python for mandatory guide CLI and stdio examples
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Resolve owning Git Bash for mandatory guide syntax (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
# The later Windows Cargo/Python steps use PowerShell, retaining this native path.
test -f "$BASH"
printf 'BASH=%s\n' "$(cygpath -w "$BASH")" >> "$GITHUB_ENV"
# Reached only after required setup succeeds. Optional cache failures
# remain tolerated through their existing continue-on-error settings.
- name: Mark test prerequisites ready
id: test-prerequisites
shell: bash
run: echo "Test prerequisites ready"
- name: Run example build smoke (Linux monitored)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
monitor() {
while true; do
echo "== resource snapshot: $(date -Is) =="
df -h . /tmp /home/runner/actions-runner/cached 2>/dev/null || true
free -h || true
du -sh target target/debug target/debug/deps target/debug/incremental target/msl target/cmm ~/.rustup ~/.cargo ~/.cargo/registry ~/.cargo/git /home/runner/actions-runner/cached/_diag 2>/dev/null || true
ps -eo pid,ppid,%cpu,%mem,rss,vsz,comm,args --sort=-rss | head -n 15 || true
sleep 60
done
}
monitor &
monitor_pid=$!
trap 'kill "$monitor_pid" 2>/dev/null || true' EXIT
cargo xtask verify examples
- name: Run example build smoke
if: runner.os != 'Linux'
run: cargo xtask verify examples
# `!cancelled()` keeps the test step running when the example smoke step
# fails, but only after setup succeeds; missing tools are not test failures.
# The job still fails on the smoke step.
- name: Run workspace tests (Linux monitored)
if: runner.os == 'Linux' && !cancelled() && steps.test-prerequisites.outcome == 'success'
shell: bash
run: |
set -euo pipefail
monitor() {
while true; do
echo "== resource snapshot: $(date -Is) =="
df -h . /tmp /home/runner/actions-runner/cached 2>/dev/null || true
free -h || true
du -sh target target/debug target/debug/deps target/debug/incremental target/msl target/cmm ~/.rustup ~/.cargo ~/.cargo/registry ~/.cargo/git /home/runner/actions-runner/cached/_diag 2>/dev/null || true
ps -eo pid,ppid,%cpu,%mem,rss,vsz,comm,args --sort=-rss | head -n 15 || true
sleep 60
done
}
monitor &
monitor_pid=$!
trap 'kill "$monitor_pid" 2>/dev/null || true' EXIT
# Full workspace suite (unit + integration + doctests) in one job per OS.
# Not nextest-sharded: the suite isn't the CI pole (the MSL gate is), so
# sharding it buys no overall wall-clock, only jobs + runner cost.
cargo xtask verify workspace
- name: Prepare GNU static-PIE test executables (Linux)
if: runner.os == 'Linux' && !cancelled() && steps.test-prerequisites.outcome == 'success'
timeout-minutes: 20
shell: bash
run: |
set -euo pipefail
export CARGO_TARGET_DIR="$GITHUB_WORKSPACE/target"
export TMPDIR="$RUNNER_TEMP"
bash .github/scripts/qualify-issue422-static-pie.sh \
"$RUNNER_TEMP/issue422-gnu-static-pie" prepare
- name: Qualify GNU static-PIE memcmp and original U4 (Linux)
if: runner.os == 'Linux' && !cancelled() && steps.test-prerequisites.outcome == 'success'
shell: bash
run: |
set -euo pipefail
export CARGO_TARGET_DIR="$GITHUB_WORKSPACE/target"
export TMPDIR="$RUNNER_TEMP"
timeout --kill-after=5s 600s bash .github/scripts/qualify-issue422-static-pie.sh \
"$RUNNER_TEMP/issue422-gnu-static-pie" run
- name: Upload GNU static-PIE qualification (Linux)
if: runner.os == 'Linux' && always()
uses: actions/upload-artifact@v6
with:
name: issue422-gnu-static-pie
path: ${{ runner.temp }}/issue422-gnu-static-pie
if-no-files-found: error
retention-days: 7
- name: Run heavy Solve counterexample regressions (Linux)
if: runner.os == 'Linux' && !cancelled() && steps.test-prerequisites.outcome == 'success'
shell: bash
run: |
set -euo pipefail
cargo test --package rumoca --features heavy-solve-tests \
--test suite_heavy_solve -- --nocapture
- name: Run workspace tests
if: runner.os != 'Linux' && !cancelled() && steps.test-prerequisites.outcome == 'success'
run: cargo xtask verify workspace
- name: Build all binaries
run: cargo xtask verify binaries
- name: Run tensor compile-scaling ratchet
if: runner.os == 'Linux'
run: |
cargo build \
--package rumoca-test-msl \
--bin rumoca-tensor-scaling \
--features rumoca-test-msl/tensor-scaling-bin
target/debug/rumoca-tensor-scaling \
--enforce \
--output target/tensor-scaling/report.json
- name: Upload tensor compile-scaling report
if: runner.os == 'Linux' && always()
uses: actions/upload-artifact@v6
with:
name: tensor-compile-scaling-report
path: target/tensor-scaling/report.json
if-no-files-found: warn
retention-days: 7
template-runtime-tests:
name: Template Runtime (${{ matrix.backend }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- backend: render
nix_shell: ci-template-core
- backend: c
nix_shell: ci-template-core
- backend: casadi
nix_shell: ci-template-python
- backend: cuda
nix_shell: ci-template-cuda
- backend: fmi
nix_shell: ci-template-fmi
- backend: jax
nix_shell: ci-template-python
- backend: modelica
nix_shell: ci-template-modelica
- backend: rust
nix_shell: ci-template-core
- backend: wasm
nix_shell: ci-template-wasm
env:
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v22
with:
determinate: false
- name: GitHub Actions Nix cache
uses: DeterminateSystems/magic-nix-cache-action@v14
with:
use-flakehub: false
diagnostic-endpoint: ''
- name: Rust cache (template-runtime)
uses: Swatinem/rust-cache@v2
with:
shared-key: template-runtime
save-if: ${{ github.event_name != 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
cache-targets: false
- name: Reclaim runner disk before template runtimes
shell: bash
run: |
set -euo pipefail
echo "== disk before cleanup =="
df -h . / /tmp /home/runner/actions-runner/cached 2>/dev/null || true
du -sh target target/debug ~/.cargo ~/.rustup /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL /home/runner/actions-runner/cached/_diag 2>/dev/null || true
rm -rf target/debug/deps target/debug/build target/debug/incremental target/debug/.fingerprint
sudo rm -rf \
/usr/share/dotnet \
/usr/local/lib/android \
/opt/ghc \
/usr/local/.ghcup \
/opt/hostedtoolcache/CodeQL
sudo apt-get clean
echo "== disk after cleanup =="
df -h . / /tmp /home/runner/actions-runner/cached 2>/dev/null || true
du -sh target target/debug ~/.cargo ~/.rustup /home/runner/actions-runner/cached/_diag 2>/dev/null || true
- name: Prepare Python template runtime dependencies
if: matrix.nix_shell == 'ci-template-python' || matrix.nix_shell == 'ci-template-fmi'
env:
TEMPLATE_BACKEND: ${{ matrix.backend }}
run: |
nix develop .#${{ matrix.nix_shell }} --command bash <<'EOF'
set -euo pipefail
venv="target/template-runtime-venv-${TEMPLATE_BACKEND}"
python -m venv "$venv"
. "$venv/bin/activate"
python -m pip install --upgrade pip
case "$TEMPLATE_BACKEND" in
casadi)
python -m pip install casadi==3.7.2 numpy==2.4.3
python -c 'import casadi, numpy; print("casadi template deps ok")'
;;
jax)
python -m pip install diffrax==0.7.2 jax==0.9.2 numpy==2.4.3 scipy==1.17.1
python -c 'import diffrax, jax, numpy; print("jax template deps ok")'
;;
fmi)
python -m pip install fmpy==0.3.30
python -c 'import fmpy; assert fmpy.__version__ == "0.3.30"; print("FMPy conformance dependency ok")'
;;
*)
echo "::error::unexpected Python template backend: $TEMPLATE_BACKEND"
exit 1
;;
esac
EOF
- name: Cache MSL (fmi-ls-wasm Fourbar1 check)
if: matrix.backend == 'wasm'
uses: actions/cache@v5
continue-on-error: true
with:
path: target/msl/ModelicaStandardLibrary-4.1.0
key: msl-v4.1.0-release-zip-layout-v3
- name: Ensure MSL (fmi-ls-wasm Fourbar1 check)
if: matrix.backend == 'wasm'
shell: bash
run: |
set -euo pipefail
msl_dir=target/msl/ModelicaStandardLibrary-4.1.0
# Accept only the release-zip layout: a stale or foreign top-level entry
# (for example an unversioned Modelica/ tree) would load a second provider.
unexpected_entries=$(ls -A "$msl_dir" 2>/dev/null | grep -vxF -e Complex.mo -e LICENSE -e "Modelica 4.1.0" -e "ModelicaReference 4.1.0" -e "ModelicaServices 4.1.0" -e ObsoleteModelica4.mo -e README.md || true)
if [[ -f "$msl_dir/Complex.mo" && -f "$msl_dir/Modelica 4.1.0/package.mo" && -z "$unexpected_entries" ]]; then
echo "MSL cache is valid at $msl_dir"
exit 0
fi
rm -rf "$msl_dir"
mkdir -p "$msl_dir"
curl --proto '=https' --tlsv1.2 --fail --location --silent --show-error \
-o target/msl/msl-v4.1.0.zip \
https://github.com/modelica/ModelicaStandardLibrary/releases/download/v4.1.0/ModelicaStandardLibrary_v4.1.0.zip
unzip -q target/msl/msl-v4.1.0.zip -d "$msl_dir"
rm target/msl/msl-v4.1.0.zip
test -f "$msl_dir/Complex.mo"
test -f "$msl_dir/Modelica 4.1.0/package.mo"
- name: Fetch pinned official FMI standards
if: matrix.backend == 'fmi'
run: |
nix develop .#${{ matrix.nix_shell }} --command bash <<'EOF'
set -euo pipefail
cache="$PWD/target/fmi-standards"
mkdir -p "$cache/2.0.5" "$cache/3.0.2"
mkdir -p "$cache/vdm2" "$cache/vdm3"
curl --proto '=https' --tlsv1.2 --fail --location --silent --show-error \
https://github.com/modelica/fmi-standard/releases/download/v2.0.5/FMI-Standard-2.0.5.zip \
--output "$cache/fmi-2.0.5.zip"
curl --proto '=https' --tlsv1.2 --fail --location --silent --show-error \
https://github.com/modelica/fmi-standard/releases/download/v3.0.2/FMI-Standard-3.0.2.zip \
--output "$cache/fmi-3.0.2.zip"
curl --proto '=https' --tlsv1.2 --fail --location --silent --show-error \
https://github.com/INTO-CPS-Association/FMI-VDM-Model/releases/download/Release/1.1.3/vdmcheck2-1.1.3-distribution-rules.zip \
--output "$cache/vdmcheck2-1.1.3.zip"
curl --proto '=https' --tlsv1.2 --fail --location --silent --show-error \
https://github.com/INTO-CPS-Association/FMI-VDM-Model/releases/download/Release/1.1.3/vdmcheck3-1.1.3-distribution-rules.zip \
--output "$cache/vdmcheck3-1.1.3.zip"
printf '%s %s\n' \
2695efc7f3aac3443957b0784880e16eec84013558995547f5d706cbf2104909 \
"$cache/fmi-2.0.5.zip" \
454a12f40069db7efc38faee1c8899fabe74086c0b052f88133b16f256c444bd \
"$cache/fmi-3.0.2.zip" \
53916d61e7f46ff12e010b05646085e27f808acde6069d47f4ee9e45ae98e7d5 \
"$cache/vdmcheck2-1.1.3.zip" \
9f429acedff53350106efa66bbaed077ddbb107c81cca96f585451da3499afd7 \
"$cache/vdmcheck3-1.1.3.zip" | sha256sum --check
unzip -q "$cache/fmi-2.0.5.zip" -d "$cache/2.0.5"
unzip -q "$cache/fmi-3.0.2.zip" -d "$cache/3.0.2"
unzip -q "$cache/vdmcheck2-1.1.3.zip" -d "$cache/vdm2"
unzip -q "$cache/vdmcheck3-1.1.3.zip" -d "$cache/vdm3"
mkdir -p target/fmi-conformance
printf '%s\n' \
'{' \
" \"fmi2_standard_dir\": \"$cache/2.0.5\"," \
" \"fmi3_standard_dir\": \"$cache/3.0.2\"," \
" \"fmi2_vdm_check\": \"$cache/vdm2/vdmcheck-1.1.3/VDMCheck2.sh\"," \
" \"fmi3_vdm_check\": \"$cache/vdm3/vdmcheck-1.1.3/VDMCheck3.sh\"" \
'}' > target/fmi-conformance/config.json
EOF
- name: Run template runtime checks
env:
TEMPLATE_BACKEND: ${{ matrix.backend }}
run: |
nix develop .#${{ matrix.nix_shell }} --command bash <<'EOF'
set -euo pipefail
venv="target/template-runtime-venv-${TEMPLATE_BACKEND}"
system_cmake=$(command -v cmake || true)
if [ -d "$venv" ]; then
. "$venv/bin/activate"
fi
if [ "$TEMPLATE_BACKEND" = fmi ]; then
export PATH="$(dirname "$system_cmake"):$PATH"
fi
runtime_check=(cargo xtask verify template-runtimes
--backend "$TEMPLATE_BACKEND" --require-external-tools)
if [ "$TEMPLATE_BACKEND" = modelica ]; then
export TMPDIR="${RUNNER_TEMP:?}/rumoca-workshop-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}"
mkdir "$TMPDIR"
"${runtime_check[@]}" 2>&1 | tee "$TMPDIR/template-runtime.log"
else
"${runtime_check[@]}"
fi
EOF
- name: Hash retained workshop Modelica evidence
if: always() && matrix.backend == 'modelica'
shell: bash
run: |
set -euo pipefail
evidence="${RUNNER_TEMP:?}/rumoca-workshop-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}"
if [ -d "$evidence" ]; then
cd "$evidence"
find . -type f ! -name SHA256SUMS -print0 | sort -z |
xargs -0 -r sha256sum > SHA256SUMS
fi
- name: Upload retained workshop Modelica evidence
if: always() && matrix.backend == 'modelica'
uses: actions/upload-artifact@v6
with:
name: workshop-modelica-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/rumoca-workshop-${{ github.run_id }}-${{ github.run_attempt }}/
if-no-files-found: error
editor-msl-smoke:
name: Full-MSL LSP/Editor Gate
runs-on: ubuntu-24.04
# This gate runs full-MSL LSP probes, VS Code smoke, and a WASM browser
# smoke. Hosted runners can exhaust 30 minutes before the browser smoke
# finishes its playground build on a cold wasm cache.
timeout-minutes: 60
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.CI_SOURCE_SHA }}
token: ${{ github.token }}
persist-credentials: true
- name: Verify source checkout identity
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$CI_SOURCE_SHA"
printf 'source=%s workflow=%s tree=%s\n' "$CI_SOURCE_SHA" "$CI_WORKFLOW_SHA" "$(git rev-parse HEAD^{tree})"
- name: Install Rust nightly with rust-src
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$(awk -F'"' '/^channel/ { print $2 }' rust-toolchain.toml)"
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- name: Install wasm-pack (prebuilt)
# The gate's WASM smoke needs wasm-pack; installing the prebuilt binary
# here lets xtask's ensure_wasm_pack find it on PATH (it checks
# `wasm-pack --version` == 0.15.0) and skip its `cargo install wasm-pack`
# — a ~3min from-source build every run.
uses: taiki-e/install-action@v2
with:
tool: wasm-pack@0.15.0
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
# Cache npm's download store keyed by the committed lockfiles so the
# `npm ci` in the VS Code + browser smokes reuses packages across runs.
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Install Xvfb and system dependencies
uses: ./.github/actions/apt-install
with:
packages: xvfb xauth libudev-dev
- name: Select headless browser
shell: bash
run: |
set -euo pipefail
if command -v google-chrome >/dev/null 2>&1; then
browser=google-chrome
elif command -v chromium >/dev/null 2>&1; then
browser=chromium
elif command -v chromium-browser >/dev/null 2>&1; then
browser=chromium-browser
else
echo "::error::Missing Chrome/Chromium for headless WASM smoke."
exit 1
fi
# xtask auto-detects the headless browser; this step only fails fast
# when none is installed.
"$browser" --version
- name: Rust cache (editor-msl)
uses: Swatinem/rust-cache@v2
with:
shared-key: editor-msl
save-if: ${{ github.event_name != 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
# The VS Code runtime smoke downloads a full VS Code build via
# @vscode/test-electron; the xtask resolves its cache to the source
# packages/vscode/.vscode-test (even though the smoke runs in a staged
# copy), so cache that dir to reuse the ~100MB electron download.
- name: Cache VS Code test electron
uses: actions/cache@v5
continue-on-error: true
with:
path: packages/vscode/.vscode-test
key: ${{ runner.os }}-vscode-test-v1
- name: Cache MSL
uses: actions/cache@v5
continue-on-error: true
id: msl-cache-editor
with: