ci(gates): merge 단계 job 14개를 셋으로 합친다

merge 단계가 게이트마다 job 하나(행렬 14개)라서 PR마다 checkout,
setup-node, `pnpm install`을 14번 하고 브라우저 설치를 2번 한다. Gitea
runner는 소유자 기계 한 대다. 사례(Vite 등)는 설치를 job당 한 번으로
묶는다(design-docs repo-structure/03-ci.md 3.5절).

고른 방법(03-ci.md 7.3절 F1, 소유자 승인 2026-11-07):
- job 종류 `gate-sequence`를 더한다. job 하나가 게이트 여럿을 차례로
  돈다. 게이트마다 `FE-GATE-NNN / <이름>` 단계이고 `if: !cancelled()`라
  앞 게이트가 실패해도 다음 게이트가 돈다(행렬의 fail-fast: false와 같다).
- merge job 셋: `merge_static`(001·002·003·010·011·012, 소스를 읽고
  빌드하는 검사), `merge_test`(004·005·006·007·013·020, 시험),
  `merge_browser`(008·009, 브라우저 설치). release 단계는 셋을 모두
  기다린다. 게이트 id·명령·증거·승격 공식은 그대로다.
- 증거 업로드는 job마다 하나(`merge-static-<run>` 등)다.

버린 것: 행렬을 두고 `pnpm install`만 캐시하는 방법. runner 한 대에서는
job 수만큼 checkout과 준비가 남는다. 게이트를 job 하나에 모두 넣는
방법은 브라우저 설치를 모든 게이트가 기다린다.

위험: 한 job 안의 게이트가 같은 작업 공간을 쓴다. 앞 게이트의 산출물이
뒤 게이트에 남는다. desktop의 merge 단계 실행(게이트를 한 checkout에서
차례로 도는 것)과 같은 조건이라 그 결과로 확인했다. 실제 Gitea runner의
`!cancelled()` 해석은 Actions를 켠 뒤 확인한다.

검증(desktop): check:ci, check:types, CI 시험 4파일 통과. 합치기
전후 merge 단계 게이트별 결과 비교는 PR 본문에 적는다.

Refs: design-docs repo-structure/03-ci.md 3.5·7.3·7.4절, README.md 3.3절
This commit is contained in:
2026-11-08 21:56:28 +09:00
parent c54c381325
commit 0739f26b80
13 changed files with 327 additions and 90 deletions
+95 -26
View File
@@ -31,31 +31,97 @@ env:
CI_RUNNER_IMAGE: "${{ vars.RUNNER_IMAGE_DIGEST }}"
jobs:
merge_gate:
name: "${{ matrix.gate }} / ${{ matrix.name }}"
merge_static:
name: "merge / static checks"
if: ${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-001 / manifest-lockfile"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-001
- name: "FE-GATE-002 / lint"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-002
- name: "FE-GATE-003 / typecheck"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-003
- name: "FE-GATE-010 / architecture"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-010
- name: "FE-GATE-011 / build"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-011
- name: "FE-GATE-012 / bundle"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-012
- name: Upload merge static evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-static-${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_test:
name: "merge / tests"
if: ${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}
# FE-GATE-013 runner requirement: Linux with executable /usr/bin/bwrap (with --size), /usr/bin/prlimit, /usr/bin/systemd-run, /usr/bin/systemctl and /usr/bin/tar, an active systemd user manager 254 or newer, and unified cgroup v2 with delegated memory, pids and cpu controllers
# FE-GATE-013 runner requirement: unprivileged user and network namespaces for bwrap (the provider sandbox runs bwrap --unshare-pid --unshare-ipc --unshare-uts --unshare-net); Ubuntu 23.10 and later refuse them while kernel.apparmor_restrict_unprivileged_userns=1 unless /usr/bin/bwrap has an AppArmor profile that allows userns; scripts/check-system-test-prerequisites.ts probes this before test:system runs
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- { gate: FE-GATE-001, name: manifest-lockfile, browser: false }
- { gate: FE-GATE-002, name: lint, browser: false }
- { gate: FE-GATE-003, name: typecheck, browser: false }
- { gate: FE-GATE-004, name: runtime-schema, browser: false }
- { gate: FE-GATE-005, name: unit, browser: false }
- { gate: FE-GATE-006, name: component, browser: false }
- { gate: FE-GATE-007, name: integration, browser: false }
- { gate: FE-GATE-008, name: e2e, browser: true }
- { gate: FE-GATE-009, name: accessibility, browser: true }
- { gate: FE-GATE-010, name: architecture, browser: false }
- { gate: FE-GATE-011, name: build, browser: false }
- { gate: FE-GATE-012, name: bundle, browser: false }
- { gate: FE-GATE-013, name: security, browser: false }
- { gate: FE-GATE-020, name: removability, browser: false }
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-004 / runtime-schema"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-004
- name: "FE-GATE-005 / unit"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-005
- name: "FE-GATE-006 / component"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-006
- name: "FE-GATE-007 / integration"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-007
- name: "FE-GATE-013 / security"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-013
- name: "FE-GATE-020 / removability"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-020
- name: Upload merge test evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-test-${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_browser:
name: "merge / browser tests"
if: ${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
@@ -68,23 +134,26 @@ jobs:
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers
if: ${{ matrix.browser }}
run: |
corepack pnpm exec playwright install --with-deps chromium firefox webkit
$(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
- name: Run blocking gate
run: corepack pnpm ci:gate -- ${{ matrix.gate }}
- name: Upload merge gate evidence
- name: "FE-GATE-008 / e2e"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-008
- name: "FE-GATE-009 / accessibility"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-009
- name: Upload merge browser evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "${{ matrix.gate }}-${{ gitea.run_id }}"
name: "merge-browser-${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
release_gate:
name: "${{ matrix.gate }} / ${{ matrix.name }}"
needs: merge_gate
needs: [merge_static, merge_test, merge_browser]
if: ${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}
runs-on: ubuntu-latest
timeout-minutes: 45
+83 -11
View File
@@ -2083,9 +2083,9 @@
],
"jobs": [
{
"id": "merge_gate",
"displayName": "${{ matrix.gate }} / ${{ matrix.name }}",
"kind": "gate-matrix",
"id": "merge_static",
"displayName": "merge / static checks",
"kind": "gate-sequence",
"needs": [],
"condition": "merge",
"timeoutMinutes": 45,
@@ -2093,18 +2093,88 @@
"FE-GATE-001",
"FE-GATE-002",
"FE-GATE-003",
"FE-GATE-010",
"FE-GATE-011",
"FE-GATE-012"
],
"browserGateIds": [],
"environment": [],
"steps": [
{
"kind": "checkout"
},
{
"kind": "setup-node"
},
{
"kind": "frozen-install"
},
{
"kind": "run-gate"
},
{
"kind": "upload",
"transferId": "merge-static-evidence",
"name": "merge-static-${{ gitea.run_id }}",
"paths": [
"artifacts/"
],
"always": true
}
]
},
{
"id": "merge_test",
"displayName": "merge / tests",
"kind": "gate-sequence",
"needs": [],
"condition": "merge",
"timeoutMinutes": 45,
"gateIds": [
"FE-GATE-004",
"FE-GATE-005",
"FE-GATE-006",
"FE-GATE-007",
"FE-GATE-008",
"FE-GATE-009",
"FE-GATE-010",
"FE-GATE-011",
"FE-GATE-012",
"FE-GATE-013",
"FE-GATE-020"
],
"browserGateIds": [],
"environment": [],
"steps": [
{
"kind": "checkout"
},
{
"kind": "setup-node"
},
{
"kind": "frozen-install"
},
{
"kind": "run-gate"
},
{
"kind": "upload",
"transferId": "merge-test-evidence",
"name": "merge-test-${{ gitea.run_id }}",
"paths": [
"artifacts/"
],
"always": true
}
]
},
{
"id": "merge_browser",
"displayName": "merge / browser tests",
"kind": "gate-sequence",
"needs": [],
"condition": "merge",
"timeoutMinutes": 45,
"gateIds": [
"FE-GATE-008",
"FE-GATE-009"
],
"browserGateIds": [
"FE-GATE-008",
"FE-GATE-009"
@@ -2128,8 +2198,8 @@
},
{
"kind": "upload",
"transferId": "merge-gate-evidence",
"name": "${{ matrix.gate }}-${{ gitea.run_id }}",
"transferId": "merge-browser-evidence",
"name": "merge-browser-${{ gitea.run_id }}",
"paths": [
"artifacts/"
],
@@ -2142,7 +2212,9 @@
"displayName": "${{ matrix.gate }} / ${{ matrix.name }}",
"kind": "gate-matrix",
"needs": [
"merge_gate"
"merge_static",
"merge_test",
"merge_browser"
],
"condition": "release",
"timeoutMinutes": 45,
+6 -4
View File
@@ -6,8 +6,10 @@ strict v2 contract; it is not an independent configuration authority. Update
the registry, run `corepack pnpm generate:ci-workflow`, and commit the generated
bytes together. `corepack pnpm check:ci-workflow` rejects missing, stale, CRLF,
or otherwise byte-different output. `corepack pnpm check:ci` runs artifact-schema
checking, the typed contract checker, and this workflow drift check. The Gitea
adapter runs each gate as an independent matrix check with full fan-out and no
checking, the typed contract checker, and this workflow drift check. The merge
stage runs as three jobs (`merge_static`, `merge_test`, `merge_browser`), one
install each; every gate is a step named by its ID, and a failed gate does not
skip the next. Release and production gates stay matrix checks. There is no
soft-fail wiring.
## 기준선 갱신과 새 프로젝트 시작 시 초기화할 기준선
@@ -407,9 +409,9 @@ the paired backend: `{ "id": "PRODUCT-GATE-001", "name": "backend-contract",
"script": "check:backend-contract" }`. Ids are `PRODUCT-GATE-NNN`; the
`FE-GATE-NNN` ids, their commands, artifacts and readiness formula stay the
template's. Each runs as `corepack pnpm <script>` in the `product_merge_gate`
job, on the same condition as `merge_gate`, without browsers and without the
job, on the same condition as the merge jobs, without browsers and without the
gate log and evidence artifacts of `ci:gate`. `release_gate` waits for that job
as it waits for `merge_gate`, so a failing product gate also stops the release
as it waits for the merge jobs, so a failing product gate also stops the release
build, promotion and deployment of the same run (1105/13-02); with no product
gates the workflow is the template's own. A required check of the branch is
what blocks a pull request merge, so make the job one where it has to. `check:ci`
+20 -7
View File
@@ -405,7 +405,7 @@ const jobSchema = z
.object({
id,
displayName: workflowValue,
kind: z.enum(["gate-matrix", "gate-single", "immutable", "provider", "promotion", "deployment"]),
kind: z.enum(["gate-matrix", "gate-sequence", "gate-single", "immutable", "provider", "promotion", "deployment"]),
needs: z.array(id).max(32),
condition: z.enum(["always", "needs-success", "merge", "release", "production", "field", "documentation"]),
timeoutMinutes: z.number().int().positive(),
@@ -912,10 +912,16 @@ function validateContractSemantics(
if (gateOwners.length > 1) issue(`multiply owned gate: ${gate.id} by ${gateOwners.join(", ")}`);
}
const expectedJobOwnership: Readonly<Record<string, readonly string[]>> = {
// The merge stage runs as three jobs, one install each (design-docs
// repo-structure/03-ci.md F1): checks that read the source and build it,
// tests, and the gates that need browsers. Each runs its gates one after
// another in this order; a failed gate does not skip the next.
// 15-01. The bundle budget (FE-GATE-012) runs on every PR: a feature that
// pushes initial JavaScript over budget fails before it merges, not at the
// next tagged release.
merge_gate: ["FE-GATE-001", "FE-GATE-002", "FE-GATE-003", "FE-GATE-004", "FE-GATE-005", "FE-GATE-006", "FE-GATE-007", "FE-GATE-008", "FE-GATE-009", "FE-GATE-010", "FE-GATE-011", "FE-GATE-012", "FE-GATE-013", "FE-GATE-020"],
merge_static: ["FE-GATE-001", "FE-GATE-002", "FE-GATE-003", "FE-GATE-010", "FE-GATE-011", "FE-GATE-012"],
merge_test: ["FE-GATE-004", "FE-GATE-005", "FE-GATE-006", "FE-GATE-007", "FE-GATE-013", "FE-GATE-020"],
merge_browser: ["FE-GATE-008", "FE-GATE-009"],
release_gate: ["FE-GATE-014", "FE-GATE-026", "FE-GATE-028"],
immutable_build: ["FE-GATE-015", "FE-GATE-027"],
vulnerability_provider: [],
@@ -929,7 +935,7 @@ function validateContractSemantics(
documentation_gate: ["FE-GATE-017"],
};
if (JSON.stringify(contract.jobs.map(({ id }) => id)) !== JSON.stringify(Object.keys(expectedJobOwnership))) {
issue("job registry must contain the exact ten canonical jobs in semantic order");
issue("job registry must contain the exact twelve canonical jobs in semantic order");
}
for (const [jobId, gateIds] of Object.entries(expectedJobOwnership)) {
const job = contract.jobs.find(({ id }) => id === jobId);
@@ -938,8 +944,10 @@ function validateContractSemantics(
}
}
const expectedJobGraph: Readonly<Record<string, readonly [CiWorkflowJob["kind"], readonly string[], CiWorkflowJob["condition"]]>> = {
merge_gate: ["gate-matrix", [], "merge"],
release_gate: ["gate-matrix", ["merge_gate"], "release"],
merge_static: ["gate-sequence", [], "merge"],
merge_test: ["gate-sequence", [], "merge"],
merge_browser: ["gate-sequence", [], "merge"],
release_gate: ["gate-matrix", ["merge_static", "merge_test", "merge_browser"], "release"],
immutable_build: ["immutable", ["release_gate"], "release"],
vulnerability_provider: ["provider", ["immutable_build"], "always"],
provenance_provider: ["provider", ["immutable_build"], "always"],
@@ -956,7 +964,9 @@ function validateContractSemantics(
}
}
const expectedStepKinds: Readonly<Record<string, readonly CiWorkflowStep["kind"][]>> = {
merge_gate: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"],
merge_static: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"],
merge_test: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"],
merge_browser: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"],
release_gate: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"],
immutable_build: ["checkout", "setup-node", "frozen-install", "run-gate", "archive-candidate", "upload", "upload"],
vulnerability_provider: ["checkout", "setup-node", "frozen-install", "download", "run-provider", "validate-provider-evidence", "upload"],
@@ -974,7 +984,9 @@ function validateContractSemantics(
}
}
const expectedEnvironmentBindings: Readonly<Record<string, readonly Readonly<{ name: string; value: string }> []>> = {
merge_gate: [],
merge_static: [],
merge_test: [],
merge_browser: [],
release_gate: [],
immutable_build: [
// FE-GATE-027 admits the built artifact to a named environment, so both
@@ -1361,6 +1373,7 @@ function validateJobStepKinds(
): void {
const allowed: Readonly<Record<z.infer<typeof jobSchema>["kind"], ReadonlySet<string>>> = {
"gate-matrix": new Set(["checkout", "setup-node", "frozen-install", "browser-install", "download", "extract", "run-gate", "upload"]),
"gate-sequence": new Set(["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"]),
"gate-single": new Set(["checkout", "setup-node", "frozen-install", "run-gate", "upload"]),
immutable: new Set(["checkout", "setup-node", "frozen-install", "run-gate", "archive-candidate", "upload"]),
provider: new Set(["checkout", "setup-node", "frozen-install", "download", "extract", "run-provider", "validate-provider-evidence", "upload"]),
+12 -1
View File
@@ -231,7 +231,7 @@ function renderJob(
}
}
lines.push(" steps:");
for (const step of job.steps) lines.push(...renderStep(job, step, transfers));
for (const step of job.steps) lines.push(...renderStep(job, step, transfers, index));
return lines;
}
@@ -257,6 +257,7 @@ function renderStep(
job: CiWorkflowJob,
step: CiWorkflowStep,
transfers: ReadonlyMap<string, Readonly<{ name: string }>>,
index: ReturnType<typeof indexCiGateContract>,
): string[] {
switch (step.kind) {
case "checkout":
@@ -294,6 +295,16 @@ function renderStep(
return [" - name: Run blocking gate", " run: corepack pnpm ci:gate -- ${{ matrix.gate }}"];
}
if (job.gateIds.length === 0) throw new TypeError(`run-gate step lacks ownership: ${job.id}`);
// F1 (design-docs repo-structure/03-ci.md). A job of several gates shares
// one install; each gate is a step named by its id, and a failed gate
// does not skip the ones after it, as the matrix entries did not.
if (job.kind === "gate-sequence") {
return job.gateIds.flatMap((gateId) => [
` - name: ${yamlScalar(`${gateId} / ${index.gates.get(gateId)?.name ?? ""}`)}`,
" if: ${{ !cancelled() }}",
` run: corepack pnpm ci:gate -- ${gateId}`,
]);
}
// 12-02: every gate the job owns runs, in order. Rendering only the first
// left FE-GATE-027 (release admission) out of the workflow.
return job.gateIds.flatMap((gateId) => [
+1 -1
View File
@@ -8,7 +8,7 @@ export const ciContractReportSchema = z
commandDefinitionCount: z.number().int().positive(),
commandReferenceCount: z.number().int().positive(),
artifactCount: z.number().int().positive(),
jobCount: z.literal(10),
jobCount: z.literal(12),
workflowSha256: z.string().regex(/^[a-f0-9]{64}$/u),
durationStatus: z.string().min(1),
negativeFixtures: z.array(
+1 -1
View File
@@ -17,7 +17,7 @@ import type { RemovalCheck } from "./removal-fixture.ts";
*/
const BROWSER =
"needs Playwright browsers. FE-GATE-020 runs in a merge job without them " +
"(merge_gate matrix browser: false). The generated routes in the browser " +
"(merge_test installs none). The generated routes in the browser " +
"gates are reviewed as 1103/12-01 and 12-03.";
const DRILL =
"a removal drill copies the repository again. The drill runs the generated " +
+1 -1
View File
@@ -1,4 +1,4 @@
{
"jobId": "merge_gate",
"jobId": "merge_static",
"needs": ["release_gate"]
}
+1 -1
View File
@@ -1,4 +1,4 @@
{
"jobId": "merge_gate",
"jobId": "merge_static",
"needs": ["missing"]
}
+1 -1
View File
@@ -1,4 +1,4 @@
{
"jobId": "merge_gate",
"jobId": "merge_static",
"removeGateId": "FE-GATE-001"
}
@@ -34,31 +34,97 @@ env:
CI_RUNNER_IMAGE: "\${{ vars.RUNNER_IMAGE_DIGEST }}"
jobs:
merge_gate:
name: "\${{ matrix.gate }} / \${{ matrix.name }}"
merge_static:
name: "merge / static checks"
if: \${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-001 / manifest-lockfile"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-001
- name: "FE-GATE-002 / lint"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-002
- name: "FE-GATE-003 / typecheck"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-003
- name: "FE-GATE-010 / architecture"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-010
- name: "FE-GATE-011 / build"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-011
- name: "FE-GATE-012 / bundle"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-012
- name: Upload merge static evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-static-\${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_test:
name: "merge / tests"
if: \${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}
# FE-GATE-013 runner requirement: Linux with executable /usr/bin/bwrap (with --size), /usr/bin/prlimit, /usr/bin/systemd-run, /usr/bin/systemctl and /usr/bin/tar, an active systemd user manager 254 or newer, and unified cgroup v2 with delegated memory, pids and cpu controllers
# FE-GATE-013 runner requirement: unprivileged user and network namespaces for bwrap (the provider sandbox runs bwrap --unshare-pid --unshare-ipc --unshare-uts --unshare-net); Ubuntu 23.10 and later refuse them while kernel.apparmor_restrict_unprivileged_userns=1 unless /usr/bin/bwrap has an AppArmor profile that allows userns; scripts/check-system-test-prerequisites.ts probes this before test:system runs
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- { gate: FE-GATE-001, name: manifest-lockfile, browser: false }
- { gate: FE-GATE-002, name: lint, browser: false }
- { gate: FE-GATE-003, name: typecheck, browser: false }
- { gate: FE-GATE-004, name: runtime-schema, browser: false }
- { gate: FE-GATE-005, name: unit, browser: false }
- { gate: FE-GATE-006, name: component, browser: false }
- { gate: FE-GATE-007, name: integration, browser: false }
- { gate: FE-GATE-008, name: e2e, browser: true }
- { gate: FE-GATE-009, name: accessibility, browser: true }
- { gate: FE-GATE-010, name: architecture, browser: false }
- { gate: FE-GATE-011, name: build, browser: false }
- { gate: FE-GATE-012, name: bundle, browser: false }
- { gate: FE-GATE-013, name: security, browser: false }
- { gate: FE-GATE-020, name: removability, browser: false }
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-004 / runtime-schema"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-004
- name: "FE-GATE-005 / unit"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-005
- name: "FE-GATE-006 / component"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-006
- name: "FE-GATE-007 / integration"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-007
- name: "FE-GATE-013 / security"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-013
- name: "FE-GATE-020 / removability"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-020
- name: Upload merge test evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-test-\${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_browser:
name: "merge / browser tests"
if: \${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
@@ -71,23 +137,26 @@ jobs:
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers
if: \${{ matrix.browser }}
run: |
corepack pnpm exec playwright install --with-deps chromium firefox webkit
$(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
- name: Run blocking gate
run: corepack pnpm ci:gate -- \${{ matrix.gate }}
- name: Upload merge gate evidence
- name: "FE-GATE-008 / e2e"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-008
- name: "FE-GATE-009 / accessibility"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-009
- name: Upload merge browser evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "\${{ matrix.gate }}-\${{ gitea.run_id }}"
name: "merge-browser-\${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
release_gate:
name: "\${{ matrix.gate }} / \${{ matrix.name }}"
needs: merge_gate
needs: [merge_static, merge_test, merge_browser]
if: \${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}
runs-on: ubuntu-latest
timeout-minutes: 45
+9 -8
View File
@@ -195,7 +195,7 @@ describe("CI gate contract", () => {
`FE-GATE-${String(index + 1).padStart(3, "0")}`,
).filter((gateId) => gateId !== "FE-GATE-016"),
);
expect(contract.jobs).toHaveLength(10);
expect(contract.jobs).toHaveLength(12);
expect(contract.commands).toHaveLength(76);
expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(80);
expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(8);
@@ -492,16 +492,16 @@ describe("CI gate contract", () => {
["empty gate evidence refs", (value: Record<string, any>) => (value.gates[0].evidenceArtifactIds = []), /too small|at least 1/i],
["unowned gate", (value: Record<string, any>) => (value.jobs[0].gateIds = value.jobs[0].gateIds.filter((id: string) => id !== "FE-GATE-001")), /unowned gate: FE-GATE-001/i],
["multiply owned gate", (value: Record<string, any>) => value.jobs[1].gateIds.push("FE-GATE-001"), /multiply owned gate: FE-GATE-001/i],
["duplicated immutable gate", (value: Record<string, any>) => value.jobs[1].gateIds.push("FE-GATE-015"), /release matrix duplicates FE-GATE-015/i],
["duplicated immutable gate", (value: Record<string, any>) => value.jobs.find((job: any) => job.id === "release_gate").gateIds.push("FE-GATE-015"), /release matrix duplicates FE-GATE-015/i],
["unreachable producer", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "promotion").needs = ["immutable_build", "provenance_provider"]), /download producer vulnerability_provider is unreachable/i],
["missing producer", (value: Record<string, any>) => { const producer = value.jobs.find((job: any) => job.id === "immutable_build"); producer.steps = producer.steps.filter((step: any) => step.kind !== "upload"); }, /unknown download transfer release-candidate|job step sequence drift/i],
["promotion rebuild authority", (value: Record<string, any>) => value.jobs.find((job: any) => job.id === "promotion").steps.splice(3, 0, { kind: "archive-candidate", stepId: "bad", archivePath: ".release/bad.tar.gz", members: ["dist"], archiveOutputName: "bad", distOutputName: "bad-dist" }), /promotion job must not build|step kind archive-candidate is forbidden/i],
["browser gate drift", (value: Record<string, any>) => (value.jobs[0].browserGateIds = ["FE-GATE-008"]), /browser gate set drift/i],
["missing gate execution step", (value: Record<string, any>) => (value.jobs[0].steps = value.jobs[0].steps.filter((step: any) => step.kind !== "run-gate")), /canonical job step sequence drift/i],
["browser install drift", (value: Record<string, any>) => (value.jobs[0].steps = value.jobs[0].steps.filter((step: any) => step.kind !== "browser-install")), /browser install step drift|job step sequence drift/i],
["browser install drift", (value: Record<string, any>) => { const job = value.jobs.find((candidate: any) => candidate.id === "merge_browser"); job.steps = job.steps.filter((step: any) => step.kind !== "browser-install"); }, /browser install step drift|job step sequence drift/i],
["job environment drift", (value: Record<string, any>) => value.jobs[0].environment.push({ name: "UNOWNED", value: "x" }), /job environment binding drift/i],
["job kind drift", (value: Record<string, any>) => (value.jobs[0].kind = "gate-single"), /job graph drift/i],
["job needs drift", (value: Record<string, any>) => (value.jobs[1].needs = []), /job graph drift/i],
["job needs drift", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "release_gate").needs = []), /job graph drift/i],
["job condition drift", (value: Record<string, any>) => (value.jobs[1].condition = "always"), /job graph drift/i],
["promotion success condition drift", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "promotion").condition = "always"), /job graph drift|promotion.*condition/i],
["candidate output identity drift", (value: Record<string, any>) => { const job = value.jobs.find((candidate: any) => candidate.id === "immutable_build"); job.steps.find((step: any) => step.kind === "archive-candidate").archiveOutputName = "renamed"; }, /candidate output identity drift/i],
@@ -1640,7 +1640,7 @@ describe("CI workflow generation", () => {
expect(first).toContain("persist-credentials: false");
expect(
first.match(/corepack pnpm install --frozen-lockfile --ignore-scripts/gu),
).toHaveLength(9);
).toHaveLength(11);
expect(first).not.toMatch(/corepack pnpm install --frozen-lockfile$/mu);
expect(first).toContain("verify-ci-candidate-archive.ts --archive");
// Providers and promotion read the archive without extracting it; only the
@@ -1676,7 +1676,7 @@ describe("CI workflow generation", () => {
'if [ -n "$PROMOTION_STAGING_ROOT" ] && [ -n "$PROMOTION_CLEANUP_TOKEN" ] && [ -n "$PROMOTION_RUNNER_TEMP_DEV" ] && [ -n "$PROMOTION_RUNNER_TEMP_INO" ] && [ -n "$PROMOTION_STAGING_DEV" ] && [ -n "$PROMOTION_STAGING_INO" ]; then',
);
const actionUses = [...first.matchAll(/^\s+-?\s*uses: (.+)$/gmu)].map((match) => match[1]);
expect(actionUses).toHaveLength(34);
expect(actionUses).toHaveLength(40);
expect(new Set(actionUses)).toEqual(
new Set([
"https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5",
@@ -1732,7 +1732,7 @@ describe("CI workflow generation", () => {
expect(requirements.join("\n")).toContain("scripts/check-system-test-prerequisites.ts");
const workflow = renderCiWorkflow(contract);
const merge = workflow.slice(workflow.indexOf(" merge_gate:\n"), workflow.indexOf(" release_gate:\n"));
const merge = workflow.slice(workflow.indexOf(" merge_test:\n"), workflow.indexOf(" merge_browser:\n"));
const header = merge.slice(0, merge.indexOf(" runs-on: ubuntu-latest\n"));
expect(header.split("\n").filter((line) => line.startsWith(" # "))).toEqual(
requirements.map((requirement) => ` # FE-GATE-013 runner requirement: ${requirement}`),
@@ -1866,7 +1866,8 @@ describe("CI workflow generation", () => {
it.each([
["a non-matrix gate step", " run: corepack pnpm ci:gate -- FE-GATE-027\n", "FE-GATE-027"],
["a matrix entry", " - { gate: FE-GATE-020, name: removability, browser: false }\n", "FE-GATE-020"],
["a matrix entry", " - { gate: FE-GATE-028, name: manual-accessibility-review, browser: false }\n", "FE-GATE-028"],
["a gate step of a merge job", " run: corepack pnpm ci:gate -- FE-GATE-020\n", "FE-GATE-020"],
])("rejects a workflow that drops %s", async (_name, line, gateId) => {
const contract = await loadCiGateContract(process.cwd());
const workflow = renderCiWorkflow(contract);
+2 -2
View File
@@ -54,8 +54,8 @@ const DEPLOYMENT = {
const DEPLOY_SCRIPTS = { "deploy:desktop": "node scripts/deploy-desktop.ts" };
const GATE = { id: "PRODUCT-GATE-001", name: "backend-contract", script: "check:backend-contract" };
const GATE_SCRIPTS = { "check:backend-contract": "node scripts/check-backend-contract.ts" };
const RELEASE_HELD_BY_TEMPLATE = " needs: merge_gate\n";
const RELEASE_HELD_BY_PRODUCT = " needs: [merge_gate, product_merge_gate]\n";
const RELEASE_HELD_BY_TEMPLATE = " needs: [merge_static, merge_test, merge_browser]\n";
const RELEASE_HELD_BY_PRODUCT = " needs: [merge_static, merge_test, merge_browser, product_merge_gate]\n";
describe("product CI overlay (1103/12-07)", () => {
it("ships empty, so the template's own workflow is unchanged", async () => {