Repository navigation
234 lines (230 loc) · 14 KB
/
Copy pathcoverage.yml
File metadata and controls
234 lines (230 loc) · 14 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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Code Coverage
permissions:
contents: read
checks: write
pull-requests: write
on:
push:
branches: ["main", "release/*"]
pull_request:
branches: ["main", "release/*"]
jobs:
build_and_test:
# Pull request runs ALWAYS go to hosted ubuntu-latest. Only a push (which
# needs write access to this repo) may be sent to vars.RUNS_ON, the
# self-hosted runner on the operator's own machine; when RUNS_ON is unset
# every run is hosted. This repo is public, so a pull_request run may be a
# stranger's code and must never reach that machine. Same rule as
# release.yml. This line is not the security boundary against fork PRs (a
# fork's PR runs the fork's own copy of this file); the org runner group
# setting allows_public_repositories=false is, and must stay that way.
runs-on: ${{ fromJSON(github.event_name == 'push' && vars.RUNS_ON || '"ubuntu-latest"') }}
strategy:
matrix:
node-version: [24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout repository
uses: actions/checkout@v5
# WITHOUT THIS STEP THE MATRIX IS DECORATION. `node-version: [24.x]` was
# declared above and never installed, so the job ran on whatever node the
# runner image happened to preinstall and the matrix value only ever
# reached the job NAME, "build_and_test (24.x)". That is not cosmetic: the
# runner's preinstalled npm was a 10.9.x, and such an npm CANNOT read this
# repo's lockfile (see the npm ci step below).
#
# THAT VERSION IS RECOVERED FROM THE RUN, not guessed. A previous revision
# of this comment called it "NOT recoverable" and weakened the claim to
# "BELOW 11.3.0"; that over-corrected and understated the evidence the run
# already carries. The failing run 33928197351 predates the Record
# toolchain step below, so it printed no version -- but its "Set up job"
# log names the image exactly:
# Image: ubuntu-24.04 Version: 20260831.293.1
# Included Software: .../runner-images/blob/ubuntu24/20260831.293/...
# and images/ubuntu/toolsets/toolset-2404.json AT THAT RELEASE TAG sets
# "node": {"default": "22"}. All 35 published node 22.x releases ship an
# npm between 10.5.1 and 10.9.8 (nodejs.org/dist/index.json), so any
# recent 22 image carries a 10.9.x. Confirmed end to end: npm 10.9.8, the
# npm bundled with the newest node 22 (v22.23.2), run against THIS
# package-lock.json, exits 1 with the run's exact signature -- "Missing:
# semver@7.5.2 / lru-cache@6.0.0 / yallist@4.0.0 from lock file" -- and
# leaves the lockfile byte-identical.
#
# Full bisect, `npm ci --dry-run` against the committed package-lock.json:
# npm 9.9.4 exit 1 npm 11.0.0 exit 1
# npm 10.8.2 exit 1 npm 11.3.0 exit 0
# npm 10.9.4 exit 1 npm 11.6.2 / 11.12.0 / 11.16.0 / 11.19.0 exit 0
# npm 10.9.8 exit 1
# The SIGNATURE alone identifies nothing -- it is identical across every
# failing npm above. The runner IMAGE TAG is what identifies the version,
# which is why it is quoted rather than inferred.
#
# Every node 24.x ships an npm at or above the passing bound -- all 28
# published releases, 24.0.0 -> npm 11.3.0 through 24.20.0 -> npm 11.19.0
# -- so pinning the matrix for real is what makes the step below viable
# across the whole 24.x line without also pinning an npm.
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Recorded on every run so the versions this job actually used are never
# again a matter of inference.
- name: Record toolchain
run: node -v && npm -v
- name: Theme-token contract gate
run: npm run-script check:theme-tokens
# One-copy gate for @softarc/native-federation (issue #73, decision 94 =
# A, answered 2026-09-23). The lockfile must record EXACTLY ONE copy of
# the package; the counting logic is HARD 3 of the deleted
# scripts/check-nf-override.mjs, unchanged. Lockfile only and node
# built-ins only, so it runs here, BEFORE `npm ci`, and fails at the bump
# that introduces a second copy -- which nothing else in this job notices
# (measured 2026-09-16: npm ci, npm test and npm run build all stay green
# with two copies). Called as `node scripts/...`, not an npm script, so
# it is the same command locally; its RED tests run in the next step.
# NOT `npm ls`: it exits 0 on a stale override and exits 1 on main from
# ~188 unrelated ELSPROBLEMS lines (issue #73, 2026-09-24 comment).
# What it does NOT catch: a stale SINGLE copy -- the Production build
# step below is the gate for that.
- name: native-federation single-copy gate
run: node scripts/check-nf-single-copy.mjs
- name: native-federation single-copy gate self-test
run: node --test scripts/check-nf-single-copy.test.mjs
# Node floor gate (issue #92). The same command the Dockerfile build stage
# runs before `npm ci`: this job's node must satisfy the engines.node range
# package-lock.json records for the federation runtime and Angular build
# packages (npm ci itself only warns). Lockfile only, node built-ins only.
# Its self-test is the red/green table and the fail-closed cases.
- name: Node floor gate
run: |
node scripts/check-node-floor.mjs
node --test scripts/check-node-floor.test.mjs
# Pull request runner gate. Fails if any workflow that runs on
# pull_request could send a job to the self-hosted runner (see the
# runs-on comment above). Node built-ins only, so it runs before `npm ci`.
# It stops an in-org change from re-opening that door; it does not stop a
# fork, whose PR runs the fork's own copy of this file.
- name: Pull request runner gate
run: |
node scripts/check-pr-runner.mjs
node --test scripts/check-pr-runner.test.mjs
# Served CSP gate. nginx.conf's Content-Security-Policy governs every
# remote mounted into the shell, and neither Karma nor `ng serve` sends a
# CSP, so nothing else in this job can see that header. The test parses
# the header nginx.conf actually serves (comment lines excluded) and
# requires connect-src to admit exactly the loopback sign-in agent origin
# http://127.0.0.1:27621 that login-ui's role cards probe, with no `http:`
# scheme source, no wildcard, no other plaintext origin, and script-src not
# loosened. Node built-ins only, so it runs before `npm ci`.
- name: Served CSP gate
run: node --test scripts/check-nginx-csp.test.mjs
# Release version gate. scripts/release-version.sh is the guard
# release.yml runs before it publishes an image; its test also runs it
# against this repo's own package.json and package-lock.json, so a PR
# that leaves the two version fields of the lock disagreeing with
# package.json (or sets a version no image tag can carry) fails here,
# not on the day someone pushes the v<version> tag. bash + python3 only,
# so it runs before `npm ci`. The release channel self-test (beta tags
# from main, stable tags from release/X.Y, which floating tags move, and
# the release.yml steps that depend on it) runs here too, so a PR that
# breaks it fails before it merges rather than on a release run. It
# needs only git, python3 and coreutils; no network, no docker.
- name: Release version gate
run: |
bash scripts/release-version.test.sh
bash scripts/test-release-channel.sh
# `npm ci`, NOT `npm install`: this job must test the tree the merge
# actually produces, not a fresh re-resolve of it.
# (An earlier revision of this comment justified that with "this job is the
# only automated gate on a dependency bump". That is FALSE and is corrected
# here: .gitlab-ci.yml also runs e2e:host -- npm ci + build + nightwatch --
# and build:image, both on merge requests and the default branch, via the
# in-cluster GitLab pull mirror. This is the only gate that runs on GITHUB,
# which is where Dependabot opens its PRs.)
# MEASURED on this repo (npm 11.19.0), package.json pinned to
# @types/node 26.2.0 against a lockfile holding 26.4.0:
# npm install -> exit 0, and it SILENTLY REWRITES package-lock.json to
# match package.json. CI goes green on a lockfile that
# is not the committed one and says nothing.
# npm ci -> exit 1, EUSAGE, "lock file's @types/node@26.4.0 does
# not satisfy @types/node@26.2.0" -- names the package.
# MEASURED LIMIT, so this line is not credited with more than it does: on
# an already-in-sync tree `npm install` did NOT drift within a caret range
# (^26.4.0 stayed 26.4.0 with 26.4.1 published), and it rewrote nothing.
# The failure this closes is a package.json/package-lock.json DESYNC being
# papered over, not silent version drift.
#
# THIS STEP REQUIRES npm >= 11.3.0, which is why the setup-node step above
# is not optional. The nested override
# overrides["cucumber-html-reporter"]["@cucumber/cucumber"]["semver"]
# is placed differently by npm 10 and npm 11: npm 10 builds an ideal tree
# wanting semver@7.5.2 / lru-cache@6.0.0 / yallist@4.0.0 at a second path
# the lockfile does not record, and aborts with "Missing: ... from lock
# file". `npm install` never noticed because it simply re-resolves. The
# first push of this change proved it live: with no setup-node step the
# job failed here on the runner's preinstalled npm 10.9.x, with that exact
# signature. (The signature is common to every npm below the bound; it is
# the runner image tag in that run's log that pins the version -- see the
# setup-node comment above.)
- name: npm ci and coverage
run: |
npm ci
npm run-script coverage
# There is no "Override contract gate" step here any more. It guarded
# overrides["@softarc/native-federation"], and #53 removed that override
# together with the dead @softarc/native-federation-node dependency that
# was the ONLY thing ever producing a second copy of the package. The
# lockfile now resolves ONE copy from @angular-architects/native-federation
# own range, and the `npm ci` above installs exactly that tree -- there is
# no pin left to drift.
# MEASURED REACH of that removal, 2026-09-16 -- recorded so the paragraph
# above is not read as wider than it is. The deleted gate's HARD 3 also
# asserted an OVERRIDE-INDEPENDENT invariant: the lockfile records EXACTLY
# ONE copy of @softarc/native-federation. Mutation-tested on that tree:
# re-adding the dead dependency
# npm pkg set 'dependencies.@softarc/native-federation-node=^4.0.0'
# npm install --package-lock-only # exit 0
# reproduces the two-copy state (4.5.0 hoisted + 4.1.3 nested under
# native-federation-node, both on disk after `npm ci`), and on that tree
# EVERY other gate PASSED: npm ci exit 0 (1905 pkgs, no EUSAGE and no
# ERESOLVE), npm test 697/697 SUCCESS, npm run build exit 0 with
# remoteEntry.json emitted and ZERO TS2724 / error TS / isUnderAnyDir
# hits, check:karma-viewport exit 0, check:theme-tokens PASS. So the old
# "two copies compile to TS2724" rationale does NOT reproduce on Angular
# 22.1.6 / @softarc 4.5.0 / TS 6.0.3: the harm today is nil, but a second
# copy would otherwise go UNDETECTED. Issue #73 put keeping HARD 3 alone
# to the operator, and decision 94 = A (2026-09-23) restored it as the
# "native-federation single-copy gate" step above the `npm ci` step.
# It only starts catching anything once GitHub Actions runs jobs on this
# account again; until then, run `node scripts/check-nf-single-copy.mjs`
# by hand on a dependency bump.
# Karma viewport gate. commit 544d9eb gave ChromeHeadlessCI a load-bearing
# --window-size and left the other two launchers in `browsers` at Chrome's
# 800x600 default, so `npm test` went red on 7 desktop-layout specs on a
# healthy tree for three weeks. This job never saw it because the coverage
# script passes --browsers=ChromeHeadlessCI and bypasses that list. The
# gate reads the real karma.conf.js through karma's own callback.
- name: Karma viewport gate
run: npm run-script check:karma-viewport
# MEASURED REACH of this step, kept as history so nobody over-credits it:
# while overrides["@softarc/native-federation"] existed, this step caught
# only a pin stale enough to break the /internal export surface (4.3.2
# under @angular-architects 22.1.x: "does not provide an export named
# 'isUnderAnyDir'", no bundle) and NOT one minor of drift (4.4.1 under
# 22.1.2, which requires ~4.5.0, exited 0 here on the committed lockfile
# and on a fresh re-resolve alike). That gap was the Override contract
# gate's job; #53 removed the override and the gate together, so the
# lockfile now follows the consumer's own range and there is no pin here
# to go stale.
# What this step IS for: before it was added, the job named build_and_test
# ran no build at all -- only check:theme-tokens and ng test.
- name: Production build
run: npm run-script build
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2.18.0
if: always()
with:
files: |
coverage/hugmesh/**/test-results.xml