louise
The Louise language: compiler, runtime, std, tooling
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#88 · main · 15 min 30 s
0Étoiles
0Forks
40Issues
| 1 | #!/usr/bin/env bash |
| 2 | # Every check CI must run. Forge-specific CI config should just call this. |
| 3 | # |
| 4 | # Profiles (LOUISE_CI_PROFILE, or `scripts/ci.sh PROFILE`): |
| 5 | # full everything (default on a runner, CI=true) |
| 6 | # docs rustfmt, clippy, unit tests, the Louise fmt check |
| 7 | # compiler docs + native differential tests, packages, examples, stress |
| 8 | # runtime everything: loom, aarch64, the ABI spike, sanitizers |
| 9 | # auto pick from the diff against origin/main (default locally) |
| 10 | # Parts (LOUISE_CI_PART), which CI runs as parallel jobs (ci.yml); unset or |
| 11 | # `all` runs every one, as locally: |
| 12 | # check rustfmt, clippy, the unit tests, the generated and Louise |
| 13 | # formatting checks |
| 14 | # native the native programs (hibernated, unoptimised, the release |
| 15 | # compiler verifying, the benchmarks both ways), the fuzzer |
| 16 | # packages the packages and examples, the demo under load, tree-sitter, |
| 17 | # the stress run |
| 18 | # runtime aarch64, the loom models, the ABI spikes |
| 19 | # On a shared host (several agents, one machine) LOUISE_CI_SHARED_HOST=1 |
| 20 | # serializes the heavy lanes through /tmp/louise-ci-heavy.lock, niced. |
| 21 | set -euo pipefail |
| 22 | cd "$(dirname "$0")/.." |
| 23 | # mold, when installed, for faster links, and heavy(), the shared-host |
| 24 | # heavy-lane lock (lib.sh; override the links with RUSTFLAGS). |
| 25 | source scripts/lib.sh |
| 26 | |
| 27 | # Each step's time, until the next one starts (the slowest first at the |
| 28 | # end, also on a failure): what to shorten next is measured, not guessed. |
| 29 | step_name="" step_start=$SECONDS |
| 30 | timings=() |
| 31 | step_done() { |
| 32 | if [ -n "$step_name" ]; then timings+=("$(printf '%5ds %s' $((SECONDS - step_start)) "$step_name")"); fi |
| 33 | step_name="" |
| 34 | } |
| 35 | timings_summary() { |
| 36 | step_done |
| 37 | if [ ${#timings[@]} -gt 0 ]; then printf '\n== the steps, slowest first\n'; printf '%s\n' "${timings[@]}" | sort -rn; fi |
| 38 | } |
| 39 | trap timings_summary EXIT |
| 40 | step() { |
| 41 | step_done |
| 42 | step_name="$*" step_start=$SECONDS |
| 43 | printf '\n== %s\n' "$*" |
| 44 | if [ "${CI:-}" = true ]; then df -h . | tail -1; fi |
| 45 | } |
| 46 | # On a runner the heavy one-off target dirs are peak disk, not caches: |
| 47 | # the job's store is bounded, and a full one fails the link with "No |
| 48 | # space left on device" (2026-10-22; local runs keep the cache warm). |
| 49 | sweep() { if [ "${CI:-}" = true ]; then chmod -R u+w "$1" 2>/dev/null || true; rm -rf "$1"; fi; } |
| 50 | # The compiler, as built from this checkout (debug), from any directory. |
| 51 | louise() { cargo run --quiet -p louise -- "$@"; } |
| 52 | # The sanitizer suites of the test programs run in their own workflow |
| 53 | # (.toboggan/workflows/asan.yml); ci.sh keeps only the quick ABI spike under |
| 54 | # ASan+UBSan (runtime lane, when clang exists). |
| 55 | |
| 56 | # The tests compile every tests/run program several times over: with the |
| 57 | # compiler optimised, much faster than with a debug one. Debug assertions |
| 58 | # and overflow checks stay on. |
| 59 | export CARGO_PROFILE_DEV_OPT_LEVEL="${CARGO_PROFILE_DEV_OPT_LEVEL:-1}" |
| 60 | # Line tables only, not full debuginfo: file:line in backtraces stays, the |
| 61 | # test binaries (most link the whole compiler) and liblouise_rt.a shrink, |
| 62 | # and so do the links. No check reads Rust's debuginfo (the file:line |
| 63 | # checks are the generated C's, through clang's -g); a debugger session |
| 64 | # builds with cargo's defaults, outside ci.sh. |
| 65 | export CARGO_PROFILE_DEV_DEBUG="${CARGO_PROFILE_DEV_DEBUG:-line-tables-only}" |
| 66 | # The quick lane (LOUISE_CI_FULL=0, which ci.yml sets for pull requests) |
| 67 | # leaves out the native part's longer runs: every parked actor hibernated, |
| 68 | # the differential fuzzer's full batch, the release build's verification, |
| 69 | # and the benchmark programs both ways. Pushes to main, manual runs and |
| 70 | # local runs do everything. |
| 71 | full="${LOUISE_CI_FULL:-1}" |
| 72 | |
| 73 | profile="${1:-${LOUISE_CI_PROFILE:-}}" |
| 74 | if [ -z "$profile" ]; then |
| 75 | if [ "${CI:-}" = true ]; then profile=full; else profile=auto; fi |
| 76 | fi |
| 77 | if [ "$profile" = auto ]; then |
| 78 | # Pick from the diff: docs only → docs; runtime/ → runtime; anything |
| 79 | # else → compiler. Unsure (no origin/main, no git) → full. |
| 80 | { git diff --name-only origin/main...HEAD 2>/dev/null || git diff --name-only HEAD 2>/dev/null; } > /tmp/louise-ci-diff.$$ || true |
| 81 | git status --porcelain=v1 -uall 2>/dev/null | awk '{print $2}' >> /tmp/louise-ci-diff.$$ || true |
| 82 | if [ ! -s /tmp/louise-ci-diff.$$ ]; then |
| 83 | profile=full |
| 84 | elif ! grep -qvE '^(docs/|.*\.md$|\.toboggan/|\.worktrees/)' /tmp/louise-ci-diff.$$; then |
| 85 | profile=docs |
| 86 | elif grep -q '^runtime/' /tmp/louise-ci-diff.$$; then |
| 87 | profile=runtime |
| 88 | else |
| 89 | profile=compiler |
| 90 | fi |
| 91 | rm -f /tmp/louise-ci-diff.$$ |
| 92 | echo "ci: auto profile from the diff: $profile" |
| 93 | fi |
| 94 | lanes=$profile |
| 95 | [ "$profile" = full ] && lanes="docs,compiler,runtime" |
| 96 | lane() { # lane NAME — whether this profile runs the lane |
| 97 | case ",$lanes," in *",$1,"*) return 0;; esac |
| 98 | echo "ci: skipping the $1 lane (the $profile profile)" |
| 99 | return 1 |
| 100 | } |
| 101 | ci_part="${LOUISE_CI_PART:-all}" |
| 102 | case $ci_part in all|check|native|packages|runtime) ;; *) echo "ci: no part $ci_part" >&2; exit 2;; esac |
| 103 | part() { # part NAME... — whether this job runs one of these parts |
| 104 | [ "$ci_part" = all ] && return 0 |
| 105 | local p; for p in "$@"; do [ "$ci_part" = "$p" ] && return 0; done |
| 106 | return 1 |
| 107 | } |
| 108 | |
| 109 | if part check; then |
| 110 | step "rustfmt"; cargo fmt --all --check |
| 111 | step "clippy"; cargo clippy --workspace --all-targets -- -D warnings |
| 112 | fi |
| 113 | # Every profile: some of the driver's unit tests link liblouise_rt.a. |
| 114 | step "runtime library"; cargo build --quiet -p louise_rt # native tests link it |
| 115 | if part native packages && { lane compiler || lane runtime; }; then |
| 116 | # The fast runtime too, next to the debug louise: the tests' release builds |
| 117 | # link it (ADR 0031). The archives are installed into target/debug; the |
| 118 | # whole-std LTO build dirs are big and never needed again (the job's |
| 119 | # store is bounded: run #738 died here with "No space left on device"). |
| 120 | step "fast runtime"; without_mold scripts/runtime.sh debug |
| 121 | sweep target/fast |
| 122 | sweep target/lto |
| 123 | fi |
| 124 | # aarch64: tested under qemu where it is installed (scripts/aarch64.sh), |
| 125 | # else type-checked and assembled. Without mimalloc and ring then: their |
| 126 | # build scripts need a C cross-compiler, and the allocator and the hashes |
| 127 | # are not what this checks (without `crypto`, the crypto externs exist and |
| 128 | # panic "crypto support not built in", the `tls` precedent). |
| 129 | if part runtime && lane runtime; then |
| 130 | if scripts/aarch64.sh --available; then |
| 131 | step "runtime and native programs on aarch64 (qemu)"; heavy scripts/aarch64.sh |
| 132 | sweep target/arm64-sysroot |
| 133 | else |
| 134 | step "runtime on aarch64 (type-check and assemble; no qemu here)" |
| 135 | cargo check --quiet -p louise_rt --all-targets --no-default-features --features stats --target aarch64-unknown-linux-gnu |
| 136 | cargo build --quiet -p louise_rt --lib --no-default-features --features stats --target aarch64-unknown-linux-gnu |
| 137 | fi |
| 138 | fi |
| 139 | if part check; then |
| 140 | # built, then run: the step timings tell compiling and linking the test |
| 141 | # binaries (most of them link the whole compiler) from running them |
| 142 | step "unit tests (build)"; cargo test --workspace --quiet --no-run |
| 143 | step "unit tests"; cargo test --workspace --quiet |
| 144 | fi |
| 145 | if part runtime && lane runtime; then |
| 146 | step "loom models (scheduler hand-offs, timers, mailbox)"; heavy scripts/loom.sh |
| 147 | sweep target/loom |
| 148 | fi |
| 149 | if part native && { lane compiler || lane runtime; }; then |
| 150 | # Hibernation (ADR 0028) normally reaches only actors parked for 400 ms: |
| 151 | # here every parked actor is hibernated and thawed, in every program. |
| 152 | if [ "$full" = 1 ]; then |
| 153 | step "native programs, every parked actor hibernated" |
| 154 | LOUISE_PARKED_EPOCH_MS=0 cargo test --quiet -p louise_codegen_c --test native |
| 155 | fi |
| 156 | # Both back ends run optimised Core, so the optimiser is checked against |
| 157 | # the same programs unoptimised (issue #219; the interpreter's half runs |
| 158 | # with the unit tests). |
| 159 | step "native programs, unoptimised" |
| 160 | cargo test --quiet -p louise_codegen_c --test native -- --ignored run_programs_natively_unoptimised |
| 161 | # The differential fuzzer (issue #352): random small programs from fuzz/, |
| 162 | # each run interpreted and natively and compared on stdout, exit code and |
| 163 | # the leak oracle. Bounded by LOUISE_FUZZ_RUNS; the base seed is printed |
| 164 | # so a failure reproduces (LOUISE_FUZZ_SEED=<seed> LOUISE_FUZZ_RUNS=1 |
| 165 | # cargo test -p louise_codegen_c --test fuzz). A small fixed batch also |
| 166 | # runs with the unit tests above (LOUISE_FUZZ_RUNS defaults to 25). |
| 167 | if [ "$full" = 1 ]; then |
| 168 | step "differential fuzzer (issue #352)" |
| 169 | fuzz_seed="${LOUISE_FUZZ_SEED:-$((RANDOM % 1000000))}" |
| 170 | echo "fuzz base seed: $fuzz_seed" |
| 171 | LOUISE_FUZZ_SEED="$fuzz_seed" LOUISE_FUZZ_RUNS="${LOUISE_FUZZ_RUNS:-200}" \ |
| 172 | cargo test --quiet -p louise_codegen_c --test fuzz |
| 173 | # 200 compiled programs are hundreds of MB; the store is bounded. |
| 174 | sweep target/fuzz |
| 175 | fi |
| 176 | # Verify after every opt pass with a release compiler (issue #350): the |
| 177 | # debug compiler the other lanes run verifies already; LOUISE_VERIFY=1 |
| 178 | # keeps a release-only miscompilation visible. Full mode only: a second |
| 179 | # (release) build of the workspace is not cheap enough for the quick |
| 180 | # lane. |
| 181 | if [ "$full" = 1 ]; then |
| 182 | step "release compiler verifies every opt pass (issue #350)" |
| 183 | heavy env LOUISE_VERIFY=1 CARGO_TARGET_DIR=target/verify \ |
| 184 | cargo build --quiet --release -p louise_rt |
| 185 | heavy env LOUISE_VERIFY=1 CARGO_TARGET_DIR=target/verify \ |
| 186 | cargo test --quiet --release -p louise_codegen_c --test native |
| 187 | sweep target/verify |
| 188 | fi |
| 189 | # The benchmarks' checksums predate the optimiser: built optimised and |
| 190 | # unoptimised, they must print them (issue #219). |
| 191 | if [ "$full" = 1 ]; then |
| 192 | step "benchmark programs, optimised and unoptimised" |
| 193 | cargo test --quiet -p louise_codegen_c --test native -- --ignored bench_programs_natively_both_ways |
| 194 | fi |
| 195 | fi |
| 196 | if part check; then |
| 197 | step "prelude tuple impls are generated"; scripts/gen-tuple-impls.py --check |
| 198 | step "Louise formatting"; louise fmt --check std tests/run tests/ui tests/stress tests/bench tests/compare packages examples fuzz |
| 199 | # A program checks only the std modules it reaches (ADR 0074): this |
| 200 | # checks all of them, `@fip` included, with their warnings. |
| 201 | step "all of std checks"; louise check --all-std --deps-warnings --deny-warnings tests/run/hello.lse |
| 202 | fi |
| 203 | if part packages && { lane compiler || lane runtime; }; then |
| 204 | step "packages and examples are warning-free" |
| 205 | for pkg in packages/argon2 packages/uuid packages/postgres packages/form packages/gen packages/search packages/web packages/blindindex packages/stringzilla packages/json packages/eventsourcing packages/log packages/url packages/multipart packages/fetch packages/resilience packages/throttle packages/secrets examples/http_demo examples/event_store examples/qsort examples/cluster fuzz; do |
| 206 | (cd "$pkg" && louise check --deny-warnings --locked) |
| 207 | done |
| 208 | step "argon2 package (native)"; (cd packages/argon2 && louise test --native --locked) |
| 209 | step "uuid package"; (cd packages/uuid && louise test --locked && louise test --native --locked) |
| 210 | step "form package"; (cd packages/form && louise test --locked && louise test --native --locked) |
| 211 | step "gen package"; (cd packages/gen && louise test --locked && louise test --native --locked) |
| 212 | step "log package"; (cd packages/log && louise test --locked && louise test --native --locked) |
| 213 | step "web package"; (cd packages/web && louise test --locked && louise test --native --locked) |
| 214 | step "json package"; (cd packages/json && louise test --locked && louise test --native --locked) |
| 215 | step "url package"; (cd packages/url && louise test --locked && louise test --native --locked) |
| 216 | step "multipart package"; (cd packages/multipart && louise test --locked && louise test --native --locked) |
| 217 | # Its loopback tests need LOUISE_NET_TESTS (native only); without it |
| 218 | # they skip, and the parsers' tests run in both back ends. |
| 219 | step "fetch package"; (cd packages/fetch && louise test --locked && louise test --native --locked) |
| 220 | step "resilience package"; (cd packages/resilience && louise test --locked && louise test --native --locked) |
| 221 | # Its shared buckets' tests need LOUISE_PG_URL (native only); without it |
| 222 | # they skip, and the local throttle and the store's checks still run. |
| 223 | step "throttle package"; (cd packages/throttle && louise test --locked && louise test --native --locked --jobs 1) |
| 224 | step "secrets package"; (cd packages/secrets && louise test --locked && louise test --native --locked) |
| 225 | # Its PostgreSQL tests need LOUISE_PG_URL; without it they skip. |
| 226 | step "eventsourcing package"; (cd packages/eventsourcing && louise test --locked && louise test --native --locked --jobs 1) |
| 227 | # Deterministic loopback/wire tests run only in the native backend; the |
| 228 | # interpreter skips them. Real PostgreSQL service cases still need |
| 229 | # LOUISE_PG_URL and skip without it. |
| 230 | step "postgres package"; (cd packages/postgres && louise test --locked && LOUISE_NET_TESTS=1 louise test --native --locked) |
| 231 | step "demo tests (native)"; (cd examples/http_demo && louise test --native --locked) |
| 232 | # The event store's live tests need a database (LOUISE_PG_URL); without |
| 233 | # one they skip, and the in-memory handler's tests run. |
| 234 | step "event store example"; (cd examples/event_store && louise test --locked && louise test --native --locked) |
| 235 | # Responses and the leak oracle under concurrent keep-alive connections, |
| 236 | # on 1 and 8 threads; a small load, as timings are not checked here. |
| 237 | step "demo under load (leak oracle)" |
| 238 | LOAD_CONNECTIONS=16 LOAD_REQUESTS=100 cargo test --quiet -p louise --test demo -- --ignored the_demo_under_load |
| 239 | step "qsort example: C callbacks, generated bindings (native)"; (cd examples/qsort && louise test --native --locked) |
| 240 | # The store on one node; crates/louise/tests/dist.rs runs both nodes. |
| 241 | step "cluster example"; (cd examples/cluster && louise test --locked && louise test --native --locked) |
| 242 | # Every package/example above built native test binaries into its build/; |
| 243 | # dead weight for the rest of the job (the store is bounded; run #778). |
| 244 | for d in packages/*/build examples/*/build fuzz/build; do sweep "$d"; done |
| 245 | fi |
| 246 | if part packages && { lane compiler || lane runtime; }; then |
| 247 | if command -v tree-sitter >/dev/null; then |
| 248 | step "tree-sitter grammar" |
| 249 | (cd editors/tree-sitter-louise && tree-sitter generate && git diff --exit-code -- src && tree-sitter test) |
| 250 | else |
| 251 | echo "skipping tree-sitter generate/test: the tree-sitter CLI is not installed (cargo test covers parsing)" |
| 252 | fi |
| 253 | step "stress (several threads)"; heavy scripts/stress.sh |
| 254 | # stress.sh's release build (compiler + runtime archives) is the job's |
| 255 | # peak disk; nothing after it needs target/release. |
| 256 | sweep target/release |
| 257 | fi |
| 258 | if part runtime && lane runtime; then |
| 259 | step "ABI spike"; heavy scripts/spike.sh |
| 260 | step "ABI spike (release)"; heavy env CARGO_TARGET_DIR=target/spike-release scripts/spike.sh --release |
| 261 | sweep target/spike-release |
| 262 | if command -v clang >/dev/null; then |
| 263 | step "ABI spike (ASan+UBSan)"; heavy scripts/spike.sh --asan |
| 264 | # The sanitizer suites of the test programs live in their own workflow |
| 265 | # (.toboggan/workflows/asan.yml): the full lane's store filled here |
| 266 | # (run #738), so they run as their own job, as tsan.yml does. |
| 267 | else |
| 268 | echo "skipping ASan spike: clang not found" |
| 269 | fi |
| 270 | fi |
| 271 | # Opt-in here: it needs a nightly toolchain with rust-src. On the forge it |
| 272 | # is its own workflow (.toboggan/workflows/tsan.yml), which runs |
| 273 | # scripts/tsan.sh. |
| 274 | if [ "${LOUISE_CI_TSAN:-0}" = 1 ]; then |
| 275 | step "ThreadSanitizer (runtime, native programs)"; heavy without_mold scripts/tsan.sh |
| 276 | sweep target/tsan |
| 277 | else |
| 278 | echo "skipping ThreadSanitizer: set LOUISE_CI_TSAN=1 (needs nightly with rust-src, and clang); the tsan workflow runs it" |
| 279 | fi |
| 280 | if [ "$full" = 1 ]; then |
| 281 | printf '\nci: all checks passed (profile: %s, part: %s)\n' "$profile" "$ci_part" |
| 282 | else |
| 283 | printf '\nci: the quick lane passed (profile: %s, part: %s; LOUISE_CI_FULL=0: pushes to main run the rest)\n' "$profile" "$ci_part" |
| 284 | fi |