Repository navigation
518 lines (480 loc) · 20.8 KB
/
Copy pathnightly.yml
File metadata and controls
518 lines (480 loc) · 20.8 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
name: Nightly Release & Integration Tests
on:
schedule:
# Every day at 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch: # Allow manual trigger
inputs:
# A manual run of everything from a branch would also publish that
# branch's binaries as the `nightly` release. `bench` runs the benchmark
# job alone, which is how a change to it is tried before it merges.
only:
description: 'Run every job, or the benchmark alone'
type: choice
options: [all, bench]
default: all
permissions:
contents: write
jobs:
test:
# On a schedule `inputs.only` is empty, so every job runs.
if: inputs.only != 'bench'
runs-on: ubuntu-latest
strategy:
matrix:
# There is one engine since the legacy sdk/mpr backend was deleted
# (docs/plans/2026-09-14-retire-legacy-engine.md), so the matrix is over
# Mendix versions alone. MXCLI_TEST_ENGINES is left unset: its default is
# every engine, and a name that no longer exists fails loudly rather than
# selecting nothing.
mendix-version:
- '10.24.24.119349'
- '11.6.8'
- '11.12.2'
- '11.13.0'
- '11.14.0'
- '11.15.0'
- '11.16.0'
- '11.17.0'
fail-fast: false
name: test (Mendix ${{ matrix.mendix-version }})
steps:
- uses: actions/checkout@v7
with:
# testdata/testapp (ako/TestApp) is the Studio Pro-authored fixture
# the roundtrip suite and mdl/backend/modelsdk read (#743); without it
# those tests skip, as push-test.yml's roundtrip/parity jobs know.
# upgrade-full-corpus (PedApp only) and the release job do not read
# it and check out without it.
submodules: true
- uses: actions/setup-go@v7
with:
go-version: '1.27.4'
- name: Cache ANTLR4 JAR
uses: actions/cache@v6
with:
path: ~/.m2/repository/org/antlr/antlr4
key: antlr4-4.13.2
- name: Install ANTLR4
run: pip install 'antlr4-tools==0.2.2'
- name: Generate parser
run: make grammar
env:
ANTLR4_TOOLS_ANTLR_VERSION: '4.13.2'
- name: Build
run: make build
- name: Unit tests
run: make test
- name: Setup mxbuild ${{ matrix.mendix-version }}
run: ./bin/mxcli setup mxbuild --version ${{ matrix.mendix-version }}
# One step, every package: go test runs the packages in parallel, so the
# wall time is the slowest one's (mdl/roundtrip, ~21 min on this runner in
# ako/mxcli#757's measurement) and grows as the round trip gains fixtures.
# Per-PR CI splits this into parallel jobs instead (push-test.yml).
- name: "Integration tests (Mendix ${{ matrix.mendix-version }})"
run: make test-integration
timeout-minutes: 60
# Mendix 9.24 (the last 9.x LTS), kept OUT of the `test` matrix on purpose:
# `nightly` needs `test`, and 9.x still has known writer bugs, so a matrix
# entry would block every release until they are fixed. continue-on-error
# keeps a red run from failing the workflow while the failures stay visible
# in the job log. Once this job is green, fold the version into the `test`
# matrix and delete this job.
test-mendix-9:
if: inputs.only != 'bench'
runs-on: ubuntu-latest
continue-on-error: true
env:
MENDIX_VERSION: '9.24.30.51827'
name: test (Mendix 9.24.30.51827, non-gating)
steps:
- uses: actions/checkout@v7
with:
submodules: true
- uses: actions/setup-go@v7
with:
go-version: '1.27.4'
# mxbuild 9 draws through System.Drawing; without libgdiplus every mx call
# dies with "The type initializer for 'Gdip' threw an exception."
- name: Install libgdiplus
run: sudo apt-get update && sudo apt-get install -y libgdiplus
# The 9.x runtime and its Gradle build need JDK 17; pin it rather than
# relying on the runner image's default JAVA_HOME.
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '17'
- name: Cache ANTLR4 JAR
uses: actions/cache@v6
with:
path: ~/.m2/repository/org/antlr/antlr4
key: antlr4-4.13.2
- name: Install ANTLR4
run: pip install 'antlr4-tools==0.2.2'
- name: Generate parser
run: make grammar
env:
ANTLR4_TOOLS_ANTLR_VERSION: '4.13.2'
- name: Build
run: make build
# No `make test`: the unit tests are version-independent and already run
# in every `test` matrix entry.
- name: Setup mxbuild ${{ env.MENDIX_VERSION }}
run: ./bin/mxcli setup mxbuild --version ${{ env.MENDIX_VERSION }}
- name: "Integration tests (Mendix ${{ env.MENDIX_VERSION }})"
run: make test-integration
timeout-minutes: 60
# The tunnel seam's !linux stub on macOS (ADR-0009) -- the ONLY place it runs.
# push-test.yml runs it on Windows, on every PR and main push; macOS left
# that workflow because its hosted queue failed to deliver a runner for a
# third of main pushes. This catches a darwin-only break within a day; run it
# on demand with workflow_dispatch. Like upgrade-full-corpus it does not gate
# the release: a nightly is not held back by a macOS queue flake.
tunnel-seam-macos:
if: inputs.only != 'bench'
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.4'
- name: Test the tunnel seam
run: bash scripts/test-tunnel-seam.sh
# The upgrade property test over the WHOLE mdl-examples corpus, header-only
# scripts included (MXCLI_UPGRADE_ALL). Per-PR CI executes only the scripts
# the upgrade rewrites beyond the header and terminators; this is the run that
# proves langver's gating on the rest (ako/mxcli#757). Independent of the
# Mendix version — it runs on the committed PedApp fixture and never calls
# mx — so it runs once, not per matrix entry. It does not gate the release.
upgrade-full-corpus:
if: inputs.only != 'bench'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: ['1/3', '2/3', '3/3']
name: upgrade full corpus (${{ matrix.shard }})
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.4'
- name: Cache ANTLR4 JAR
uses: actions/cache@v6
with:
path: ~/.m2/repository/org/antlr/antlr4
key: antlr4-4.13.2
- name: Install ANTLR4
run: pip install 'antlr4-tools==0.2.2'
- name: Generate parser
run: make grammar
env:
ANTLR4_TOOLS_ANTLR_VERSION: '4.13.2'
- name: Build
run: make build
- name: Upgrade property test, full corpus (${{ matrix.shard }})
run: make test-integration-upgrade
env:
MXCLI_UPGRADE_ALL: '1'
MXCLI_UPGRADE_SHARD: ${{ matrix.shard }}
timeout-minutes: 45
# The agent dev-loop benchmark (docs/11-proposals/PROPOSAL_agent_devloop_benchmark.md):
# a scripted session of the mxcli commands an agent runs, timed one process
# per command. A hosted runner's speed varies from night to night by more
# than most regressions, so the job does not compare tonight with last
# night: it downloads the previous nightly's binary and runs both
# interleaved on THIS runner, and reports the ratio. The record goes to the
# `benchmarks` branch, one file per run.
#
# Three sessions. Two time mxcli alone and start from the committed PedApp
# fixture. The third times the running app -- boot, a hot change, an entity
# change, a page check, tests -- on a project `mxcli new` creates, and so
# needs mxbuild and the runtime (mxcli downloads both), JDK 21 for the
# runtime, and a browser for the page check. It runs last: if it fails, the
# record of the first two is still written and committed.
#
# Does not gate the release, like upgrade-full-corpus: a slow night must not
# hold a nightly back. The driver exits non-zero only when a command fails
# or re-running a settled script changes a file.
bench:
runs-on: ubuntu-latest
timeout-minutes: 90
name: agent dev-loop benchmark
permissions:
# The record and the trend are pushed to the `benchmarks` branch; an
# alert opens or updates an issue.
contents: write
issues: write
env:
# One version, the one the running-app session was developed against.
# Moving it is a deliberate change: boot and apply times differ between
# Mendix versions, so the trend restarts where it moves.
BENCH_MENDIX_VERSION: '11.13.0'
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.4'
- name: Cache ANTLR4 JAR
uses: actions/cache@v6
with:
path: ~/.m2/repository/org/antlr/antlr4
key: antlr4-4.13.2
- name: Install ANTLR4
run: pip install 'antlr4-tools==0.2.2'
- name: Generate parser
run: make grammar
env:
ANTLR4_TOOLS_ANTLR_VERSION: '4.13.2'
# The Mendix 11 runtime launches under JDK 21; the runner's default
# `java` is older.
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '21'
# `mxcli playwright check` requires the `playwright` package from the
# global node_modules and launches its Chromium.
- name: Install Playwright and Chromium
run: |
npm install -g playwright@1.63.0
npx --yes playwright@1.63.0 install --with-deps chromium
# First, before the `nightly` job can replace the release. That job
# waits for the whole `test` matrix, but nothing here relies on it: the
# record names the baseline's version, and with no baseline the run
# still measures, without ratios.
- name: Download the previous nightly binary
id: baseline
run: |
mkdir -p "$RUNNER_TEMP/baseline"
if gh release download nightly --repo "$GITHUB_REPOSITORY" \
--pattern mxcli-linux-amd64 --dir "$RUNNER_TEMP/baseline"; then
chmod +x "$RUNNER_TEMP/baseline/mxcli-linux-amd64"
echo "path=$RUNNER_TEMP/baseline/mxcli-linux-amd64" >> "$GITHUB_OUTPUT"
else
echo "No previous nightly binary: measuring without an A/B."
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Run the benchmark
run: |
make bench BASELINE="${{ steps.baseline.outputs.path }}" \
BENCH_RUNTIME="$BENCH_MENDIX_VERSION" \
BENCH_FLAGS="-out agentbench-record.json -summary $GITHUB_STEP_SUMMARY"
- name: Upload the record
if: always()
uses: actions/upload-artifact@v7
with:
name: agent-benchmark-record
path: agentbench-record.json
if-no-files-found: ignore
# One file per run, so two runs never edit the same file. An orphan
# branch: results only, never merged. With the record go TREND.md and
# trend.json, rebuilt from every record on the branch by
# scripts/agentbench/trend -- so a lost push is retried from the
# branch as it then stands, not rebased: the trend is a function of
# the records, and two runs' versions of it would conflict.
#
# A run from another branch (workflow_dispatch) builds the trend with
# its own record in it and uploads that, and pushes nothing: it is not
# history, but it is how a change to the trend is tried.
- name: Record the run and build the trend
# hashFiles sees the workspace only, which is why the record is written there.
if: always() && hashFiles('agentbench-record.json') != ''
run: |
set -euo pipefail
sha=$(git rev-parse --short HEAD)
file="results/$(date -u +%Y/%m)/$(date -u +%Y-%m-%dT%H%M)-$sha.json"
bm="$RUNNER_TEMP/benchmarks"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git fetch origin benchmarks:benchmarks 2>/dev/null; then
git worktree add "$bm" benchmarks
else
git worktree add --detach "$bm"
git -C "$bm" checkout --orphan benchmarks
git -C "$bm" rm -rf -q .
printf '%s\n' '# Agent dev-loop benchmark records' '' \
'One JSON file per nightly run, written by the `bench` job of `.github/workflows/nightly.yml`.' \
'Never merged into `main`. How to read a record: `docs-site/src/internals/agent-benchmark.md` on `main`.' \
> "$bm/README.md"
fi
for attempt in 1 2 3; do
mkdir -p "$bm/$(dirname "$file")"
cp agentbench-record.json "$bm/$file"
# The record is what must not be lost: a trend that fails to
# build is a warning, and the next run rebuilds it.
go run ./scripts/agentbench/trend -records "$bm/results" \
-md "$bm/TREND.md" -json "$bm/trend.json" -alerts "$RUNNER_TEMP/bench-alerts.md" \
|| echo "::warning::the benchmark trend could not be built"
if [ "$GITHUB_REF" != refs/heads/main ]; then
echo "Not main: the record and the trend are not pushed."
exit 0
fi
git -C "$bm" add -A
git -C "$bm" commit -q -m "bench: $sha"
if git -C "$bm" push origin benchmarks; then exit 0; fi
git -C "$bm" fetch origin benchmarks
git -C "$bm" reset -q --hard FETCH_HEAD
done
exit 1
- name: Upload the trend
if: always()
uses: actions/upload-artifact@v7
with:
name: agent-benchmark-trend
path: |
${{ runner.temp }}/benchmarks/TREND.md
${{ runner.temp }}/benchmarks/trend.json
${{ runner.temp }}/bench-alerts.md
if-no-files-found: ignore
# One issue, opened when the trend has something to report and updated
# while it does. A comment is added only when what is reported changed,
# so a regression nobody has got to yet does not notify every night.
# Never closed from here: that an alert stopped firing is not the same
# as someone having looked.
- name: Report alerts in an issue
if: always() && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
body="$RUNNER_TEMP/bench-alerts.md"
if [ ! -s "$body" ]; then
echo "No alerts."
exit 0
fi
cat "$body" >> "$GITHUB_STEP_SUMMARY"
printf '\nRun: %s/%s/actions/runs/%s\n' "$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" >> "$body"
gh label create benchmark-regression --repo "$GITHUB_REPOSITORY" --color D93F0B \
--description "The agent dev-loop benchmark has something to report" 2>/dev/null || true
number=$(gh issue list --repo "$GITHUB_REPOSITORY" --label benchmark-regression --state open \
--json number --jq '.[0].number // empty')
if [ -z "$number" ]; then
gh issue create --repo "$GITHUB_REPOSITORY" --label benchmark-regression \
--title "Agent dev-loop benchmark: regression alert" --body-file "$body"
exit 0
fi
# The alert lines are the list items; the figures in them move a
# little every night, so compare kind, session and step only.
reported() { grep '^- \*\*' "$1" | sed 's/: .*//' | sort; }
gh issue view "$number" --repo "$GITHUB_REPOSITORY" --json body --jq .body > "$RUNNER_TEMP/bench-alerts-was.md"
gh issue edit "$number" --repo "$GITHUB_REPOSITORY" --body-file "$body"
if [ "$(reported "$body")" != "$(reported "$RUNNER_TEMP/bench-alerts-was.md")" ]; then
gh issue comment "$number" --repo "$GITHUB_REPOSITORY" --body-file "$body"
fi
nightly:
needs: test
if: inputs.only != 'bench'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-go@v7
with:
go-version: '1.27.4'
- uses: oven-sh/setup-bun@v2
- name: Cache ANTLR4 JAR
uses: actions/cache@v6
with:
path: ~/.m2/repository/org/antlr/antlr4
key: antlr4-4.13.2
- name: Install ANTLR4
run: pip install 'antlr4-tools==0.2.2'
- name: Generate parser
run: make grammar
env:
ANTLR4_TOOLS_ANTLR_VERSION: '4.13.2'
- name: Check for new commits since last nightly
id: check
run: |
LAST_NIGHTLY=$(gh release view nightly --json publishedAt -q .publishedAt 2>/dev/null || echo "")
if [ -n "$LAST_NIGHTLY" ]; then
COMMITS=$(git log --since="$LAST_NIGHTLY" --oneline origin/main | wc -l)
if [ "$COMMITS" -eq 0 ]; then
echo "No new commits since last nightly, skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "$COMMITS new commit(s) since last nightly."
fi
echo "skip=false" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
# One version string for the binaries and the dated release that carries
# them: `mxcli --version` prints it, `mxcli init` stamps it into a
# project, and the bootstrap script can then download exactly that build.
- name: Compute nightly version
if: steps.check.outputs.skip != 'true'
id: version
run: echo "version=nightly-$(date -u +%Y%m%d)-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build release binaries
if: steps.check.outputs.skip != 'true'
run: VERSION=${{ steps.version.outputs.version }} make release
- name: Generate changelog
if: steps.check.outputs.skip != 'true'
id: changelog
run: |
{
echo "body<<NIGHTLY_EOF"
echo "**Nightly build from \`main\` — $(date -u +%Y-%m-%d)**"
echo ""
echo "Commit: [\`$(git rev-parse --short HEAD)\`](https://github.com/${{ github.repository }}/commit/$(git rev-parse HEAD))"
echo ""
echo "### Recent changes"
echo ""
git log --oneline -20 origin/main
echo ""
echo "> This is an automated pre-release build. Use tagged releases for production."
echo "NIGHTLY_EOF"
} >> "$GITHUB_OUTPUT"
- name: Delete previous nightly release
if: steps.check.outputs.skip != 'true'
run: gh release delete nightly --cleanup-tag -y 2>/dev/null || true
env:
GH_TOKEN: ${{ github.token }}
- name: Create nightly release
if: steps.check.outputs.skip != 'true'
# Pass the notes body via an env var, NOT via `${{ }}` interpolation into
# the shell. Interpolating it directly lets the shell re-interpret the
# body's backticks (command substitution) and double quotes (from commit
# subjects in the git log), which broke the release step. `"$NOTES"` is
# inert literal data.
run: |
gh release create nightly \
--prerelease \
--title "Nightly $(date -u +%Y-%m-%d)" \
--notes "$NOTES" \
bin/mxcli-*
env:
GH_TOKEN: ${{ github.token }}
NOTES: ${{ steps.changelog.outputs.body }}
# The rolling `nightly` tag moves every night, so the build a project was
# made with could not be fetched again: no rollback, and the bootstrap
# script's "set MXCLI_TAG to <stamp>" downloaded a 404 (ako/mxcli#2359).
# Each nightly is also published under its dated tag — the version
# `mxcli --version` prints — and the newest KEEP of those are kept.
- name: Publish dated nightly
if: steps.check.outputs.skip != 'true'
run: |
if ! gh release view "$VERSION" >/dev/null 2>&1; then
gh release create "$VERSION" \
--prerelease \
--latest=false \
--target "$(git rev-parse HEAD)" \
--title "Nightly $(date -u +%Y-%m-%d) ($VERSION)" \
--notes "$NOTES" \
bin/mxcli-*
fi
gh release list --limit 200 --json tagName,createdAt \
-q '.[] | select(.tagName | test("^nightly-[0-9]{8}-")) | [.createdAt, .tagName] | @tsv' |
sort -r | tail -n +$((KEEP + 1)) | cut -f2 |
while read -r old; do
gh release delete "$old" --cleanup-tag -y || true
done
env:
GH_TOKEN: ${{ github.token }}
NOTES: ${{ steps.changelog.outputs.body }}
VERSION: ${{ steps.version.outputs.version }}
KEEP: '30'