diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index 2c76e9eb..4bf9eb16 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -175,6 +175,7 @@ jobs: timeout-minutes: 45 container: image: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07" + options: "--shm-size=2g" env: CI_RUNNER_IMAGE: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07" steps: diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index 5be5aff5..ae54a31d 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -8,7 +8,10 @@ 출력을 거절한다. `corepack pnpm check:ci`는 산출물 schema 검사, 타입이 있는 계약 검사기, 이 workflow drift 검사를 돈다. merge 단계는 job 셋(`merge_static`, `merge_test`, `merge_browser`)으로 돌고 job마다 설치를 한 번 한다. 게이트마다 ID 이름의 step이 하나씩 -있고, 실패한 게이트가 다음 게이트를 건너뛰게 하지 않는다. +있고, 실패한 게이트가 다음 게이트를 건너뛰게 하지 않는다. `merge_browser` 컨테이너는 `/dev/shm`을 +2 GB로 연다(`--shm-size=2g`). Firefox 시험 프로필을 RAM에 두기 위해서다 +(`tests/support/browser/browser-test.ts`). Docker 기본값 64 MB면 프로필이 runner 디스크에 남아 +Firefox의 첫 localStorage 접근이 수 초씩 기다렸다. merge job 셋만 의존성 캐시를 쓴다(권하는 안으로 정함 2026-11-13, 총괄). setup-node 앞에서 Node toolcache, corepack이 받은 pnpm, pnpm store와 메타데이터 캐시를 `.nvmrc`와 diff --git a/scripts/generate-ci-workflow.ts b/scripts/generate-ci-workflow.ts index dd1a400a..85860be5 100644 --- a/scripts/generate-ci-workflow.ts +++ b/scripts/generate-ci-workflow.ts @@ -210,7 +210,13 @@ function renderJob( ` timeout-minutes: ${job.timeoutMinutes}`, ); const image = jobImage(job); - if (image) lines.push(" container:", ` image: ${yamlScalar(image)}`); + if (image) { + lines.push( + " container:", + ` image: ${yamlScalar(image)}`, + ` options: ${yamlScalar(`--shm-size=${BROWSER_JOB_SHARED_MEMORY}`)}`, + ); + } if (job.kind === "immutable") { const archive = job.steps.find((step) => step.kind === "archive-candidate"); if (!archive || archive.kind !== "archive-candidate") throw new TypeError("immutable job lacks archive step"); @@ -291,6 +297,16 @@ function gateHostPrefix(gate: Readonly<{ hostEnvironment?: "system-container" | return gate?.hostEnvironment === "system-container" ? "scripts/run-in-system-container.sh " : ""; } +/** + * /dev/shm of a browser job's container. Firefox's test profiles go there when + * it has room for every worker (tests/support/browser/browser-test.ts): with a + * profile on the runner's shared disk, Firefox's first localStorage access in + * a context waited up to 8.2 s and failed first-screen waits (FE-GATE-008 and + * FE-GATE-009, runs 127 and 266). Docker's default of 64 MB holds none; six + * Firefox workers' profiles peaked at 211 MB together (2026-11-13). + */ +export const BROWSER_JOB_SHARED_MEMORY = "2g"; + /** The Playwright image a browser job runs in (`browser-install.image`), if any. */ function jobImage(job: CiWorkflowJob): string | undefined { for (const step of job.steps) { diff --git a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap index 4f08cf2c..cbb87091 100644 --- a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap +++ b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap @@ -178,6 +178,7 @@ jobs: timeout-minutes: 45 container: image: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07" + options: "--shm-size=2g" env: CI_RUNNER_IMAGE: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07" steps: diff --git a/tests/unit/ci-browser-image.test.ts b/tests/unit/ci-browser-image.test.ts index 127c9b1c..6cadc273 100644 --- a/tests/unit/ci-browser-image.test.ts +++ b/tests/unit/ci-browser-image.test.ts @@ -3,7 +3,7 @@ import { readFileSync } from "node:fs"; import { describe, expect, it } from "vitest"; import { loadCiGateContract, PLAYWRIGHT_JOB_IMAGE_PATTERN } from "../../scripts/contracts/ci-gates.ts"; -import { renderCiWorkflow } from "../../scripts/generate-ci-workflow.ts"; +import { BROWSER_JOB_SHARED_MEMORY, renderCiWorkflow } from "../../scripts/generate-ci-workflow.ts"; /** * merge_browser runs in Playwright's own image so it does not download the @@ -36,7 +36,9 @@ describe("browser job image", () => { const job = workflow.slice(workflow.indexOf(" merge_browser:\n"), workflow.indexOf(" release_gate:\n")); expect(image?.kind === "browser-install" && image.image).toBeTruthy(); const ref = image?.kind === "browser-install" ? image.image! : ""; - expect(job).toContain(` container:\n image: "${ref}"\n`); + expect(job).toContain( + ` container:\n image: "${ref}"\n options: "--shm-size=${BROWSER_JOB_SHARED_MEMORY}"\n`, + ); expect(job).toContain(` env:\n CI_RUNNER_IMAGE: "${ref}"\n`); expect(job).not.toContain("playwright install"); });