forked from nulang-org/nulang
-
Notifications
You must be signed in to change notification settings - Fork 0
323 lines (257 loc) · 11 KB
/
Copy pathci.yml
File metadata and controls
323 lines (257 loc) · 11 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
name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
# -----------------------------------------------------------------------
# Primary build & test (default features)
# -----------------------------------------------------------------------
test:
name: Build & Test
runs-on: ubuntu-latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --all-targets
- name: Test
run: cargo test
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked
- name: Generate coverage report
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- name: Upload coverage to Codecov
if: env.CODECOV_TOKEN != ''
uses: codecov/codecov-action@v5
with:
files: lcov.info
- name: Gate (forbidden patterns + zero warnings)
run: python3 verify_implementation.py
# -----------------------------------------------------------------------
# Release build — catches optimization-only errors
# -----------------------------------------------------------------------
release:
name: Release Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build (release)
run: cargo build --release
- name: Test (release)
run: cargo test --release
# -----------------------------------------------------------------------
# Nula package-manager smoke test — scaffold a package and run `nula test`
# -----------------------------------------------------------------------
nula-test:
name: Nula Package Test
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build nulang (release)
run: cargo build --release
- name: Smoke test (eval)
run: ./target/release/nulang --eval 'perform IO.print("hello")'
- name: Scaffold test package
run: ./target/release/nulang nula new test-pkg
- name: Run nula test
run: cd test-pkg && ../target/release/nulang nula test
- name: Verify documentation examples
run: NULANG_BIN=./target/release/nulang bash scripts/verify_doc_examples.sh
# -----------------------------------------------------------------------
# No-default-features build — proves zero PyO3/SQLite/LSP dependencies
# -----------------------------------------------------------------------
minimal-build:
name: Build without optional features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
# No python3-dev installed here on purpose: this job proves the
# no-default-features build has zero PyO3/SQLite/LSP dependencies.
- name: Build
run: cargo build --all-targets --no-default-features
- name: Test
run: cargo test --no-default-features
- name: Check zero warnings
run: cargo check --tests --no-default-features
# -----------------------------------------------------------------------
# WASM backend
# -----------------------------------------------------------------------
wasm-backend:
name: Build & Test (wasm-backend feature)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --all-targets --features wasm-backend
- name: Test
run: cargo test --features wasm-backend
# -----------------------------------------------------------------------
# Lint — format, clippy, audit, docs, all-features check
# -----------------------------------------------------------------------
lint:
name: Format, Clippy & Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
# Format check is blocking — the codebase has been rustfmt'd.
- name: Format check
run: cargo fmt --check
# Clippy with default features — correctness lints are blocking.
- name: Clippy (default features)
run: cargo clippy --all-targets -- -D clippy::correctness
# Clippy with all features — catches wasm-backend code paths.
- name: Clippy (all features)
run: cargo clippy --all-targets --all-features -- -D clippy::correctness
# Clippy with no default features — catches minimal-build code paths.
- name: Clippy (no default features)
run: cargo clippy --all-targets --no-default-features -- -D clippy::correctness
# Zero compiler warnings on the main build path.
- name: Check zero warnings (tests)
run: cargo check --tests
# Security audit of dependency tree.
- name: Audit (cargo-audit)
run: |
cargo install cargo-audit --locked
cargo audit
# All-features compilation check.
- name: Check all features
run: cargo check --all-features
# Documentation builds without errors.
- name: Check docs
run: cargo doc --no-deps
# Documentation warnings are non-blocking but visible.
- name: Doc warnings (info only)
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps 2>&1 || true
# -----------------------------------------------------------------------
# Lean formalization — verifies the formal specs compile
# -----------------------------------------------------------------------
lean:
name: Lean Formalization
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install elan (Lean toolchain manager)
run: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain leanprover/lean4:v4.16.0
echo "$HOME/.elan/bin" >> $GITHUB_PATH
- name: Build formal specs
run: |
cd spec/formal
lake build
- name: Sorry-count ratchet (no silent proof regressions)
run: |
cd spec/formal
count=$(grep -rc '\bsorry\b' *.lean | awk -F: '{sum+=$2} END {print sum+0}')
baseline=9
echo "sorry count: $count (baseline: $baseline)"
if [ "$count" -gt "$baseline" ]; then
echo "::error::spec/formal/*.lean sorry count ($count) exceeds baseline ($baseline)."
echo "::error::A PR must not silently regress a proved theorem to 'sorry'. If intentional"
echo "::error::(e.g. a toolchain compat fix), lower this baseline AND document the"
echo "::error::regression in spec/formal/README.md, SPEC2.md, CHANGELOG.md, and PLAN.md"
echo "::error::(see the 2026-08-02 correction entries for the required disclosure"
echo "::error::pattern this repeats: what regressed, which commit, why, and current"
echo "::error::per-theorem status)."
exit 1
fi
# -----------------------------------------------------------------------
# Benchmarks — regression-gated against a rolling window of recent
# main-branch history (see scripts/check_bench_regression.py and
# benchmarks/README.md for the noise-aware methodology: each
# benchmark's own historical spread sets its threshold, not a flat
# percentage — GitHub Actions' shared runners commonly show 20-50%+
# run-to-run noise, so a naive fixed threshold would fail PRs for
# noise, not real regressions). Runs on push to main only (not every
# PR) since a full criterion run of every group is slow; results are
# committed back so PERFORMANCE_ANALYSIS.md can cite real numbers
# instead of estimates. The gate needs >= 3 prior commits' worth of
# history for a given benchmark before it will fail anything, so
# early runs (and brand-new benchmarks) are informational only until
# enough history accumulates.
# -----------------------------------------------------------------------
bench:
name: Benchmarks (regression-gated)
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y python3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run benchmarks
run: cargo bench --bench bench_main
- name: Collect results
run: |
python3 scripts/collect_bench_results.py \
--criterion-dir target/criterion \
--out "benchmarks/$(git rev-parse --short HEAD).json"
- name: Check for regressions
id: regression_check
continue-on-error: true
run: |
python3 scripts/check_bench_regression.py \
--latest "benchmarks/$(git rev-parse --short HEAD).json" \
--history-dir benchmarks
- name: Upload results as build artifact
uses: actions/upload-artifact@v4
with:
name: bench-results-${{ github.sha }}
path: benchmarks/*.json
retention-days: 90
- name: Commit results to benchmarks/
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "benchmarks/$(git rev-parse --short HEAD).json"
git diff --staged --quiet || git commit -m "bench: record results for $(git rev-parse --short HEAD) [skip ci]"
git push
# Separate from the check step itself so the commit above always
# happens (preserving complete rolling-window history) even when
# this commit's numbers regressed.
- name: Fail the job if a regression was found
if: steps.regression_check.outcome == 'failure'
run: exit 1