{{ message }}
Repository navigation
446 lines (436 loc) · 15.2 KB
/
Copy pathci.yml
File metadata and controls
446 lines (436 loc) · 15.2 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
name: CI/CD
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-lint-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-lint-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Check Project Graph Cycles
run: npm run lint:cycles
- name: Check License Headers
run: npm run lint:headers
- name: Check Filename Conventions
run: npm run lint:filenames
- name: Check Root TypeScript Config
run: npx tsc --noEmit
- name: Lint Root Scripts
run: npm run lint:scripts
- name: Run Lint
run: npx nx affected -t lint --parallel=3
- name: Run Typecheck
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
npx nx affected -t typecheck --parallel=3
else
npx nx run-many -t typecheck --parallel=3
fi
test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-test-${{ matrix.shard }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-test-${{ matrix.shard }}-
${{ runner.os }}-nx-build-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Cache MSL
id: cache-msl
uses: actions/cache@v4
with:
path: |
scripts/ModelicaStandardLibrary_v4.1.0.zip
data/libraries/Modelica/4.1.0/extracted
key: ${{ runner.os }}-msl-v4.1.0
- name: Download and Extract MSL
run: |
if [ ! -d "data/libraries/Modelica/4.1.0/extracted/Modelica" ]; then
node scripts/download-msl.cjs --version=4.1.0 --extract --outDir=data/libraries/Modelica/4.1.0/extracted
fi
- name: Cache FMI Simulator
id: cache-fmusim
uses: actions/cache@v4
with:
path: packages/exchange/validation/fmi/reference_fmus
key: ${{ runner.os }}-fmusim-v0.0.39
- name: Fetch FMI Simulator
if: steps.cache-fmusim.outputs.cache-hit != 'true'
run: npm run fetch:fmusim --workspace=@modelscript/exchange
- name: Cache WASM Parsers
uses: actions/cache@v4
with:
path: |
.cache/asc-tests
languages/*/.cache
languages/*/dist/*.wasm
packages/runtime/build/*.wasm
packages/simulate/src/wasm/*.wasm
packages/simulate/.cache/**
packages/dsl/.cache/**
key: ${{ runner.os }}-wasm-${{ hashFiles('packages/dsl/src/**', 'packages/runtime/src/wasm/**', 'packages/runtime/assembly/**', 'languages/*/assembly/**') }}
restore-keys: |
${{ runner.os }}-wasm-
- name: Run Sharded Tests
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
node scripts/test-coordinator.js affected --shard=${{ matrix.shard }}/4
else
node scripts/test-coordinator.js run-many --shard=${{ matrix.shard }}/4
fi
- name: Upload CTRF Artifacts
uses: actions/upload-artifact@v4
with:
name: ctrf-${{ matrix.shard }}
path: "**/ctrf/*.json"
if-no-files-found: ignore
if: always()
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.shard }}
path: "**/coverage/*lcov*.info"
if-no-files-found: ignore
if: always()
modelica_testsuite:
name: Modelica OMC Testsuite (WASM vs JS)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-omc-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-omc-
${{ runner.os }}-nx-build-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Check If Modelica Affected
id: check-affected
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
AFFECTED=$(npx nx show projects --affected --projects=@modelscript/modelica,@modelscript/dsl,@modelscript/runtime,@modelscript/simulate || true)
if [ -n "$AFFECTED" ]; then
echo "Compiler projects affected: $AFFECTED"
echo "run_suite=true" >> "$GITHUB_OUTPUT"
else
echo "No Modelica compiler packages affected. Skipping testsuite."
echo "run_suite=false" >> "$GITHUB_OUTPUT"
fi
else
echo "Direct push or manual trigger: running full testsuite."
echo "run_suite=true" >> "$GITHUB_OUTPUT"
fi
- name: Cache WASM Parsers
if: steps.check-affected.outputs.run_suite == 'true'
uses: actions/cache@v4
with:
path: |
.cache/asc-tests
languages/*/.cache
packages/runtime/build/*.wasm
packages/simulate/src/wasm/*.wasm
key: ${{ runner.os }}-wasm-${{ hashFiles('packages/dsl/src/**', 'packages/runtime/src/wasm/**', 'packages/runtime/assembly/**', 'languages/*/assembly/**') }}
restore-keys: |
${{ runner.os }}-wasm-
- name: Build Prerequisites
if: steps.check-affected.outputs.run_suite == 'true'
run: npx nx run-many -t build --projects=@modelscript/dsl,@modelscript/runtime,@modelscript/modelica
- name: Run Modelica Dual Testsuite (WASM vs JS)
if: steps.check-affected.outputs.run_suite == 'true'
run: |
mkdir -p .v8-coverage languages/modelica/coverage/omc
NODE_V8_COVERAGE=$(pwd)/.v8-coverage npm run test:modelica:both:allow-wasm
npx c8 report --temp-directory=.v8-coverage --reporter=lcov --reports-dir=languages/modelica/coverage/omc --include="languages/modelica/src/**" --include="packages/dsl/src/**" --include="packages/runtime/src/**" || true
- name: Upload CTRF Artifacts
if: always() && steps.check-affected.outputs.run_suite == 'true'
uses: actions/upload-artifact@v4
with:
name: ctrf-omc-testsuite
path: |
languages/modelica/ctrf/ctrf-testsuite-report-wasm.json
languages/modelica/ctrf/ctrf-testsuite-report-js.json
if-no-files-found: ignore
- name: Upload HTML Test Reports
if: always() && steps.check-affected.outputs.run_suite == 'true'
uses: actions/upload-artifact@v4
with:
name: omc-testsuite-html-reports
path: |
languages/modelica/ctrf/*.html
if-no-files-found: ignore
- name: Upload Coverage Artifacts
if: always() && steps.check-affected.outputs.run_suite == 'true'
uses: actions/upload-artifact@v4
with:
name: coverage-omc-testsuite
path: "languages/modelica/coverage/omc/*lcov*.info"
if-no-files-found: ignore
publish_reports:
needs: [test, modelica_testsuite]
runs-on: ubuntu-latest
if: always()
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Download All CTRF Artifacts
uses: actions/download-artifact@v4
with:
path: ctrf-artifacts
pattern: ctrf-*
merge-multiple: false
- name: Generate Consolidated Hierarchical Test Summary
if: always()
run: |
npx tsx scripts/consolidate-test-reports.ts \
--dir=ctrf-artifacts \
--github-step-summary \
--output-json=ctrf-artifacts/ctrf-consolidated.json \
--output-html=ctrf-artifacts/test-report-unified.html
- name: Upload Consolidated Report Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: consolidated-test-report
path: |
ctrf-artifacts/ctrf-consolidated.json
ctrf-artifacts/test-report-unified.html
if-no-files-found: ignore
- name: Publish Test Report & PR Insights
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: ctrf-io/github-test-reporter@v1
with:
report-path: "ctrf-artifacts/ctrf-consolidated.json"
github-report: false
pull-request-report: true
flaky-rate-report: true
slowest-report: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Coverage Artifacts
uses: actions/download-artifact@v4
with:
path: coverage-artifacts
pattern: coverage-*
merge-multiple: false
if: always()
- name: Consolidate Code Coverage Reports
if: always()
run: |
npx tsx scripts/consolidate-coverage.ts \
--dir=coverage-artifacts \
--github-step-summary \
--output-lcov=coverage/lcov-consolidated.info \
--output-json=coverage/coverage-summary.json \
--threshold=65
- name: Upload Consolidated Coverage Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: consolidated-coverage
path: |
coverage/lcov-consolidated.info
coverage/coverage-summary.json
if-no-files-found: ignore
build:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-build-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Run Build
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
npx nx affected -t build --parallel=3
else
npx nx run-many -t build --parallel=3
fi
- name: Build VS Code Extension
run: npm run build:extension
- name: Package VS Code Extension
run: npx --yes @vscode/vsce package --no-dependencies --allow-star-activation
working-directory: dist/extension
- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: modelscript-vsix
path: dist/extension/*.vsix
deploy_site:
needs: [build, test, lint, modelica_testsuite]
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-docs-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-build-${{ github.sha }}
${{ runner.os }}-nx-docs-
${{ runner.os }}-nx-build-
- name: Build PDF Manual
run: npm run build:pdf --workspace=@modelscript/docs
- name: Build Unified Site & Docs
run: npx nx build @modelscript/docs
- name: Deploy Site (modelscript.org)
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.MODELSCRIPT_SITE_DEPLOY_PAT }}
external_repository: modelscript/modelscript.github.io
publish_dir: ./apps/docs/docs/.vitepress/dist
cname: modelscript.org
- name: Deploy Docs (docs.modelscript.org)
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.MODELSCRIPT_DOCS_DEPLOY_PAT || secrets.MODELSCRIPT_SITE_DEPLOY_PAT }}
external_repository: modelscript/docs.modelscript.org
publish_dir: ./apps/docs/docs/.vitepress/dist
cname: docs.modelscript.org
docker_build:
needs: [build, test, lint, modelica_testsuite]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
env:
CXXFLAGS: "-std=c++20"
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-build-${{ github.sha }}
${{ runner.os }}-nx-build-
${{ runner.os }}-nx-
- name: Fast Rebuild from Cache
run: npx nx run-many -t build --parallel=3
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/bake-action@v6
with:
source: .
files: docker-compose.yml
push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.PREBUILT=true
You can’t perform that action at this time.
