-
Notifications
You must be signed in to change notification settings - Fork 0
368 lines (298 loc) · 11.3 KB
/
Copy pathci.yml
File metadata and controls
368 lines (298 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# agent-pmo:74cf183
name: CI
on:
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: src/Napper.VsCode/package-lock.json
- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.fsproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Cache Cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
src/Napper.Zed/target
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Napper.Zed/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install dependencies
working-directory: src/Napper.VsCode
run: npm ci
- name: Validate Shipwright manifest
run: npx --yes @nimblesite/shipwright-validate-manifest --schema schemas/shipwright.schema.json src/Napper.VsCode/shipwright.json
- name: Restore dotnet tools
run: dotnet tool restore
- name: Restore dotnet packages
run: dotnet restore
# Types.Generated.fs is gitignored and rebuilt from Types.td (typeDiagram DSL,
# the canonical source of truth). A fresh checkout has no generated file, so the
# F# build below fails (FS0225) unless we regenerate it first. typediagram is
# pinned to the version that ships F# support (Nimblesite/typeDiagram#36).
- name: Generate F# types (typeDiagram)
run: |
npm install -g typediagram@0.9.0
make generate-types
- name: Format check (Fantomas)
run: dotnet fantomas --check src/
- name: Format check (Prettier)
working-directory: src/Napper.VsCode
run: npm run format:check
- name: Format check (cargo fmt)
run: cargo fmt --manifest-path src/Napper.Zed/Cargo.toml -- --check
- name: Lint F# (warnings as errors)
run: dotnet build --no-restore --nologo -warnaserror
- name: Lint TypeScript (ESLint)
working-directory: src/Napper.VsCode
run: npm run lint
- name: Lint Rust (clippy)
run: cargo clippy --manifest-path src/Napper.Zed/Cargo.toml
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
needs: lint
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: src/Napper.VsCode/package-lock.json
- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.fsproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Cache Cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
src/Napper.Zed/target
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Napper.Zed/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install ReportGenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Install dotnet-script
run: dotnet tool install -g dotnet-script
- name: Restore tools
run: dotnet tool restore
- name: Restore
run: dotnet restore
# Regenerate the gitignored Types.Generated.fs before any F# compile (see lint job).
- name: Generate F# types (typeDiagram)
run: |
npm install -g typediagram@0.9.0
make generate-types
- name: Build (warnings as errors)
run: dotnet build --no-restore --nologo -warnaserror
- name: Install VS Code extension dependencies
working-directory: src/Napper.VsCode
run: npm ci
- name: Install NativeAOT prerequisites
run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev
- name: Build CLI, compile extension & tests
working-directory: src/Napper.VsCode
run: npm run pretest
- name: TypeScript unit tests with coverage
working-directory: src/Napper.VsCode
run: npm run test:unit
- name: Add CLI to PATH
run: echo "${{ github.workspace }}/src/Napper.VsCode/bin" >> "$GITHUB_PATH"
- name: Shipwright version-contract gate
run: |
set -euo pipefail
napper --version
napper --version | grep -Eq '^napper [0-9]+\.[0-9]+\.[0-9]+'
napper --version --json | node -e 'const d=JSON.parse(require("fs").readFileSync(0,"utf8")); if(d.manifestVersion!==1||d.name!=="napper"||d.kind!=="cli"||d.language!=="dotnet"){console.error("bad version json",d);process.exit(1)} console.log("version json OK")'
- name: TypeScript E2E tests
working-directory: src/Napper.VsCode
run: xvfb-run --auto-servernum npm test
- name: F# tests with coverage
run: make test-fsharp
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Rust tests with coverage
working-directory: src/Napper.Zed
run: cargo tarpaulin --out xml html --output-dir ../../coverage/rust/report --skip-clean
- name: Check coverage thresholds
run: make _coverage_check
- name: Upload TypeScript coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: typescript-coverage
path: src/Napper.VsCode/coverage/
retention-days: 7
- name: Upload F# coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: fsharp-coverage
path: coverage/fsharp/report/
retention-days: 7
- name: Upload DotHttp coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: dothttp-coverage
path: coverage/dothttp/report/
retention-days: 7
- name: Upload Napper.Lsp coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: lsp-coverage
path: coverage/lsp/report/
retention-days: 7
- name: Upload Rust coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: rust-coverage
path: coverage/rust/report/
retention-days: 7
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
needs: test
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: src/Napper.VsCode/package-lock.json
- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.fsproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Install VS Code extension dependencies
working-directory: src/Napper.VsCode
run: npm ci
- name: Compile extension
working-directory: src/Napper.VsCode
run: npx webpack --mode production
- name: Package universal VSIX
working-directory: src/Napper.VsCode
run: npx @vscode/vsce package --no-dependencies --skip-license
- name: Upload VSIX
uses: actions/upload-artifact@v7
with:
name: vsix
path: src/Napper.VsCode/*.vsix
retention-days: 7
aot-smoke:
name: NativeAOT smoke (linux-x64)
runs-on: ubuntu-latest
timeout-minutes: 20
needs: lint
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@v6
with:
node-version: 22
# Regenerate the gitignored Types.Generated.fs before publishing (see lint job).
- name: Generate F# types (typeDiagram)
run: |
npm install -g typediagram@0.9.0
make generate-types
# Guards the [cli-aot-migration] contract on every PR: the LSP and CLI must
# publish AND RUN under NativeAOT. A reflection regression compiles fine but
# crashes at runtime, so we exercise the real native binary here.
- name: Install NativeAOT prerequisites
run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev
- name: Publish CLI (NativeAOT)
run: dotnet publish src/Napper.Cli/Napper.Cli.fsproj -r linux-x64 -p:PublishAot=true -o out/aot --nologo
- name: Smoke test the native binary (CLI + LSP)
run: |
set -euo pipefail
chmod +x out/aot/napper
# CLI works with zero .NET runtime present.
out/aot/napper --version
# The LSP answers an initialize handshake over stdio (no reflection crash).
BODY='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{},"rootUri":""}}'
LEN=$(printf '%s' "$BODY" | wc -c)
OUT=$( { printf 'Content-Length: %s\r\n\r\n%s' "$LEN" "$BODY"; printf 'Content-Length: 44\r\n\r\n{"jsonrpc":"2.0","method":"exit","params":{}}'; } | out/aot/napper lsp )
echo "$OUT"
echo "$OUT" | grep -q '"name":"napper-lsp"' || { echo "::error::LSP initialize did not return capabilities under AOT"; exit 1; }
build-website:
name: Website Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: website
run: npm ci
- name: Build
working-directory: website
run: npx eleventy
mutation-ts:
name: Mutation (TypeScript, pure layer)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: lint
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: src/Napper.VsCode/package-lock.json
- name: Install dependencies
working-directory: src/Napper.VsCode
run: npm ci
# StrykerJS over the host-free unit suite ONLY (htmlUtils escaping/builders +
# cliResolver retry policy). The slow vscode-test/e2e extension-host layer is
# intentionally NOT mutated — that would be far too slow. Runs in ~2 min and breaks
# below the 80% mutation-score threshold in src/Napper.VsCode/stryker.conf.json.
- name: Mutation test pure TypeScript modules
working-directory: src/Napper.VsCode
run: npm run mutation