From e8482c40b80145f87d0befbd6f0f42823911f48a Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Thu, 12 Nov 2026 01:01:18 +0100 Subject: [PATCH 1/4] ci: prepare publishing artifacts on self-hosted runners --- .github/scripts/verify-storybook-pages.sh | 42 +++++++++++++++++++++++ .github/workflows/npm_release.yml | 4 ++- .github/workflows/storybook_pages.yml | 34 ++++-------------- docs/storybook.md | 5 +++ tests/architecture.test.mjs | 32 +++++++++++++---- 5 files changed, 83 insertions(+), 34 deletions(-) create mode 100644 .github/scripts/verify-storybook-pages.sh diff --git a/.github/scripts/verify-storybook-pages.sh b/.github/scripts/verify-storybook-pages.sh new file mode 100644 index 0000000..96cb446 --- /dev/null +++ b/.github/scripts/verify-storybook-pages.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Do not mount the runner's Docker client configuration into the build. +docker_host=$(docker context inspect --format '{{.Endpoints.docker.Host}}') +docker_config=$(mktemp -d "${RUNNER_TEMP:?}/ha-ui-docker.XXXXXX") +container="ha-ui-pages-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}" +export DOCKER_HOST="$docker_host" DOCKER_CONFIG="$docker_config" +unset DOCKER_CONTEXT + +cleanup() { + docker rm --force "$container" >/dev/null 2>&1 || true + rm -rf -- "$docker_config" +} +trap cleanup EXIT + +docker run --rm --init --interactive --name "$container" --platform linux/arm64 \ + --shm-size 1g \ + --mount "type=bind,source=$(pwd -P),target=/workspace" \ + --workdir /workspace \ + --env CI=1 --env STORYBOOK_DISABLE_TELEMETRY=1 \ + --env npm_config_store_dir=/tmp/ha-ui-pnpm-store \ + "${HA_UI_PLAYWRIGHT_IMAGE:?}" bash -euo pipefail <<'LINUX' +HA_UI_NODE_VERSION=$(tr -d '\r\n' < .node-version) +package_manager=$(node --print 'require("./package.json").packageManager') +HA_UI_PNPM_VERSION=${package_manager#pnpm@} +export HA_UI_NODE_VERSION HA_UI_PNPM_VERSION + +npm exec --yes --package="node@$HA_UI_NODE_VERSION" --package="$package_manager" -c ' + set -eu + test "$(node --version)" = "v$HA_UI_NODE_VERSION" + test "$(pnpm --version)" = "$HA_UI_PNPM_VERSION" + pnpm install --frozen-lockfile --ignore-scripts + pnpm check + pnpm test + GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=/workspace pnpm test:package + pnpm test:ssr + pnpm storybook:build + pnpm test:engines + pnpm test:storybook +' +LINUX diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index f864a9f..4258805 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -13,7 +13,9 @@ permissions: jobs: candidate: - runs-on: ubuntu-latest + runs-on: + group: vypdev + labels: [self-hosted, codex, Linux] timeout-minutes: 5 permissions: actions: read diff --git a/.github/workflows/storybook_pages.yml b/.github/workflows/storybook_pages.yml index ccf4599..02d0a0d 100644 --- a/.github/workflows/storybook_pages.yml +++ b/.github/workflows/storybook_pages.yml @@ -13,41 +13,21 @@ concurrency: jobs: build: if: github.ref == 'refs/heads/master' - runs-on: ubuntu-latest - container: - image: mcr.microsoft.com/playwright:v1.64.1-noble@sha256:2f05f8a734509a7b3f26a912639488ee08f58a7b292d14d62271bcff9038768f - options: --ipc=host + runs-on: + group: vypdev + labels: [self-hosted, macOS, ARM64] env: - npm_config_store_dir: /tmp/ha-ui-pnpm-store + # Linux ARM64 manifest from the same Playwright 1.64.1 Noble index as CI. + HA_UI_PLAYWRIGHT_IMAGE: mcr.microsoft.com/playwright@sha256:f609973e8fd93f38a5ddfd706a65805294247dae8d81b2541c0afe2787746197 # The published catalog runs the same browser gates as CI. timeout-minutes: 20 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version-file: .node-version - package-manager-cache: false - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - with: - run_install: false - cache: false - - run: pnpm install --frozen-lockfile --ignore-scripts - - run: pnpm check - - run: pnpm test - - run: pnpm test:package - - run: pnpm test:ssr - - run: pnpm storybook:build - - name: Run the browser engine matrix + - name: Build and verify Storybook in Linux shell: bash - run: | - test "$HOME" = /github/home - original_owner=$(stat -c '%u:%g' /github/home) - trap 'chown -- "$original_owner" /github/home' EXIT - chown -- "$(id -u):$(id -g)" /github/home - pnpm test:engines - - run: pnpm test:storybook + run: bash .github/scripts/verify-storybook-pages.sh - uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4 with: path: build/storybook diff --git a/docs/storybook.md b/docs/storybook.md index c83d5de..ad15809 100644 --- a/docs/storybook.md +++ b/docs/storybook.md @@ -92,6 +92,11 @@ coverage and browser evidence. This makes a candidate reviewable before merge. T workflow builds and rechecks trusted `master` before upload; only its deployment job receives Pages write and OIDC permission. It never executes PR code with deployment permissions. +The Pages build uses the Apple Silicon runner in the organization's `vypdev` group. +It runs the verified Linux build in a job-specific Docker container and keeps the +runner's Docker credentials outside the container. The Pages deployment job uses +a GitHub-hosted runner for OIDC publication. + Both validation jobs use the [official Playwright Noble image](https://playwright.dev/docs/docker) pinned by digest to the version in the lockfile. The image supplies Chromium, Firefox, WebKit and their system libraries. Each job still installs the project's exact Node and pnpm toolchain and diff --git a/tests/architecture.test.mjs b/tests/architecture.test.mjs index 3270ff0..e52ea48 100644 --- a/tests/architecture.test.mjs +++ b/tests/architecture.test.mjs @@ -177,13 +177,33 @@ test('Pages builds only the trusted default branch and grants write permissions const build=workflow.jobs.build,deploy=workflow.jobs.deploy; expect(build.if).toBe("github.ref == 'refs/heads/master'");expect(build.permissions).toBeUndefined(); const quality = parse(readFileSync('.github/workflows/ci_check.yml', 'utf8')).jobs.quality; - expect(build.container).toEqual(quality.container); - expect(build.env.npm_config_store_dir).toBe(quality.env.npm_config_store_dir); + expect(build.container).toBeUndefined(); + expect(build.env.HA_UI_PLAYWRIGHT_IMAGE).toBe('mcr.microsoft.com/playwright@sha256:f609973e8fd93f38a5ddfd706a65805294247dae8d81b2541c0afe2787746197'); + expect(quality.container.image).toBe('mcr.microsoft.com/playwright:v1.64.1-noble@sha256:2f05f8a734509a7b3f26a912639488ee08f58a7b292d14d62271bcff9038768f'); expect(deploy.container).toBeUndefined(); - expect(build.steps.some(step => step.run?.startsWith('pnpm exec playwright install'))).toBe(false); - expect(build.steps.find(step=>step.name==='Run the browser engine matrix')) - .toEqual(quality.steps.find(step=>step.name==='Run the browser engine matrix')); - for(const command of ['pnpm install --frozen-lockfile --ignore-scripts','pnpm check','pnpm test','pnpm test:package','pnpm test:ssr','pnpm storybook:build','pnpm test:storybook','pnpm test:engines'])expect(build.steps.flatMap(step=>step.run?.split('\n')??[])).toContain(command); + expect(build.steps.some(step => step.run === 'bash .github/scripts/verify-storybook-pages.sh')).toBe(true); + const verify = readFileSync('.github/scripts/verify-storybook-pages.sh', 'utf8'); + expect(verify).toContain('--platform linux/arm64'); + expect(verify).toContain('--env npm_config_store_dir='+quality.env.npm_config_store_dir); + expect(verify).not.toContain('playwright install'); + for (const command of ['pnpm install --frozen-lockfile --ignore-scripts', 'pnpm check', 'pnpm test', + 'pnpm test:package', 'pnpm test:ssr', 'pnpm storybook:build', 'pnpm test:storybook', 'pnpm test:engines']) { + expect(verify.split('\n').some(line => line.trimEnd().endsWith(' '+command))).toBe(true); + } expect(deploy.needs).toBe('build');expect(deploy.permissions).toEqual({pages:'write','id-token':'write'}); expect(deploy.environment.name).toBe('github-pages');expect(workflow.concurrency['cancel-in-progress']).toBe(false); }); + +test('publication preparation uses organization runners and OIDC jobs use GitHub runners', () => { + const pages = parse(readFileSync('.github/workflows/storybook_pages.yml', 'utf8')); + const npm = parse(readFileSync('.github/workflows/npm_release.yml', 'utf8')); + expect(pages.jobs.build['runs-on']).toEqual({group: 'vypdev', labels: ['self-hosted', 'macOS', 'ARM64']}); + expect(npm.jobs.candidate['runs-on']).toEqual({group: 'vypdev', labels: ['self-hosted', 'codex', 'Linux']}); + for (const job of [pages.jobs.build, npm.jobs.candidate]) { + expect(job.permissions?.['id-token']).toBeUndefined(); + } + for (const job of [pages.jobs.deploy, npm.jobs.publish]) { + expect(job['runs-on']).toBe('ubuntu-latest'); + expect(job.permissions['id-token']).toBe('write'); + } +}); From 173e15bcc2b380f24481650a19001e01f6405380 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Thu, 12 Nov 2026 09:27:42 +0100 Subject: [PATCH 2/4] ci: validate internal ha-ui pull requests on Apple Silicon --- ...y-storybook-pages.sh => verify-catalog.sh} | 6 ++- .github/workflows/ci_check.yml | 43 +++++-------------- .github/workflows/storybook_pages.yml | 2 +- docs/storybook.md | 9 ++-- tests/architecture.test.mjs | 40 ++++++----------- 5 files changed, 35 insertions(+), 65 deletions(-) rename .github/scripts/{verify-storybook-pages.sh => verify-catalog.sh} (88%) diff --git a/.github/scripts/verify-storybook-pages.sh b/.github/scripts/verify-catalog.sh similarity index 88% rename from .github/scripts/verify-storybook-pages.sh rename to .github/scripts/verify-catalog.sh index 96cb446..73c3113 100644 --- a/.github/scripts/verify-storybook-pages.sh +++ b/.github/scripts/verify-catalog.sh @@ -4,7 +4,7 @@ set -euo pipefail # Do not mount the runner's Docker client configuration into the build. docker_host=$(docker context inspect --format '{{.Endpoints.docker.Host}}') docker_config=$(mktemp -d "${RUNNER_TEMP:?}/ha-ui-docker.XXXXXX") -container="ha-ui-pages-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}" +container="ha-ui-catalog-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}" export DOCKER_HOST="$docker_host" DOCKER_CONFIG="$docker_config" unset DOCKER_CONTEXT @@ -20,6 +20,7 @@ docker run --rm --init --interactive --name "$container" --platform linux/arm64 --workdir /workspace \ --env CI=1 --env STORYBOOK_DISABLE_TELEMETRY=1 \ --env npm_config_store_dir=/tmp/ha-ui-pnpm-store \ + --env HA_UI_PACKED_EXPECTED_REVISION \ "${HA_UI_PLAYWRIGHT_IMAGE:?}" bash -euo pipefail <<'LINUX' HA_UI_NODE_VERSION=$(tr -d '\r\n' < .node-version) package_manager=$(node --print 'require("./package.json").packageManager') @@ -33,6 +34,9 @@ npm exec --yes --package="node@$HA_UI_NODE_VERSION" --package="$package_manager" pnpm install --frozen-lockfile --ignore-scripts pnpm check pnpm test + if [ -n "${HA_UI_PACKED_EXPECTED_REVISION:-}" ]; then + pnpm build + fi GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=/workspace pnpm test:package pnpm test:ssr pnpm storybook:build diff --git a/.github/workflows/ci_check.yml b/.github/workflows/ci_check.yml index 6254d0b..0a280c9 100644 --- a/.github/workflows/ci_check.yml +++ b/.github/workflows/ci_check.yml @@ -13,49 +13,28 @@ permissions: jobs: quality: name: CI Check - runs-on: ubuntu-latest - container: - image: mcr.microsoft.com/playwright:v1.64.1-noble@sha256:2f05f8a734509a7b3f26a912639488ee08f58a7b292d14d62271bcff9038768f - options: --ipc=host + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} + runs-on: + group: vypdev + labels: [self-hosted, macOS, ARM64] env: - npm_config_store_dir: /tmp/ha-ui-pnpm-store + # Linux ARM64 manifest from the Playwright 1.64.1 Noble index. + HA_UI_PLAYWRIGHT_IMAGE: mcr.microsoft.com/playwright@sha256:f609973e8fd93f38a5ddfd706a65805294247dae8d81b2541c0afe2787746197 # The catalog has its own phase deadlines; this job also verifies packages and SSR. timeout-minutes: 20 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + - name: Validate the catalog and bind packed consumers to the checked commit + shell: bash + env: + HA_UI_PACKED_EXPECTED_REVISION: ${{ github.sha }} + run: bash .github/scripts/verify-catalog.sh - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version-file: .node-version package-manager-cache: false - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - with: - run_install: false - cache: false - - run: pnpm install --frozen-lockfile --ignore-scripts - - run: pnpm check - - run: pnpm test - - run: pnpm build - - name: Verify packed consumers and candidate provenance - env: - HA_UI_PACKED_EXPECTED_REVISION: ${{ github.sha }} - run: | - export GIT_CONFIG_COUNT=1 - export GIT_CONFIG_KEY_0=safe.directory - export GIT_CONFIG_VALUE_0="$(pwd -P)" - pnpm test:package - - run: pnpm test:ssr - - run: pnpm storybook:build - - name: Run the browser engine matrix - shell: bash - run: | - test "$HOME" = /github/home - original_owner=$(stat -c '%u:%g' /github/home) - trap 'chown -- "$original_owner" /github/home' EXIT - chown -- "$(id -u):$(id -g)" /github/home - pnpm test:engines - - run: pnpm test:storybook # Read the original catalog SDK at the reviewed revision; never rewrite it. - name: Read the original specification SDK uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/storybook_pages.yml b/.github/workflows/storybook_pages.yml index 02d0a0d..2f265b6 100644 --- a/.github/workflows/storybook_pages.yml +++ b/.github/workflows/storybook_pages.yml @@ -27,7 +27,7 @@ jobs: persist-credentials: false - name: Build and verify Storybook in Linux shell: bash - run: bash .github/scripts/verify-storybook-pages.sh + run: bash .github/scripts/verify-catalog.sh - uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4 with: path: build/storybook diff --git a/docs/storybook.md b/docs/storybook.md index ad15809..adf2c03 100644 --- a/docs/storybook.md +++ b/docs/storybook.md @@ -86,14 +86,15 @@ shared fixes. No additional browser engine, owner HA installation or human accep ## Delivery -Every PR update runs `CI Check`, including strict types, full coverage, compiled package consumers, +Every PR update from a branch in this repository runs `CI Check`, including strict types, full coverage, compiled package consumers, static catalog build and the static browser gate. Its retained artifact includes `build/storybook/`, coverage and browser evidence. This makes a candidate reviewable before merge. The separate Pages workflow builds and rechecks trusted `master` before upload; only its deployment job receives Pages write and OIDC permission. It never executes PR code with deployment permissions. -The Pages build uses the Apple Silicon runner in the organization's `vypdev` group. -It runs the verified Linux build in a job-specific Docker container and keeps the +Fork workflows require maintainer approval in GitHub, and CI restricts execution to same-repository PRs. +CI and the Pages build use Apple Silicon runners in the organization's `vypdev` group. +Each runs the Linux build in a job-specific Docker container and keeps the runner's Docker credentials outside the container. The Pages deployment job uses a GitHub-hosted runner for OIDC publication. @@ -102,8 +103,6 @@ pinned by digest to the version in the lockfile. The image supplies Chromium, Fi their system libraries. Each job still installs the project's exact Node and pnpm toolchain and uses the frozen dependency lock. The workspace and offline package fixtures share a container-local pnpm store even when their directories are on different mounts. -The browser matrix temporarily matches the isolated job home ownership to the -container user for Firefox and restores its owner when the step exits. The intended public destination is the repository Pages subpath `/ha-ui/`. Public hosting is pending until the complete feature can merge and Pages is enabled for Actions. The existence of a workflow diff --git a/tests/architecture.test.mjs b/tests/architecture.test.mjs index e52ea48..3f357d7 100644 --- a/tests/architecture.test.mjs +++ b/tests/architecture.test.mjs @@ -58,37 +58,25 @@ test('every actual core module respects the dependency boundary', () => { if (dependency.startsWith('.')) expect(relative(resolve('packages/core/src'), resolve(dirname(file), dependency)).startsWith('..')).toBe(false); } }); -test('CI Check runs for every PR update with frozen tools and all implemented quality gates', () => { +test('CI Check runs for internal PR updates with frozen tools and all implemented quality gates', () => { const workflow = parse(readFileSync('.github/workflows/ci_check.yml', 'utf8')); expect(workflow.name).toBe('CI Check'); expect(workflow.on.pull_request.types).toEqual(expect.arrayContaining(['opened','reopened','synchronize','ready_for_review','converted_to_draft'])); expect(workflow.on.pull_request.paths).toBeUndefined(); const job = workflow.jobs.quality; - expect(job.name).toBe('CI Check'); expect(job.if).toBeUndefined(); + expect(job.name).toBe('CI Check'); + expect(job.if).toBe("${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}"); + expect(job['runs-on']).toEqual({group: 'vypdev', labels: ['self-hosted', 'macOS', 'ARM64']}); expect(job['continue-on-error']).toBeUndefined(); expect(job.steps.every(step => step['continue-on-error'] === undefined)).toBe(true); - const playwright = JSON.parse(readFileSync('package.json', 'utf8')).devDependencies.playwright; - const [image, digest] = job.container.image.split('@'); - expect(image).toBe(`mcr.microsoft.com/playwright:v${playwright}-noble`); - expect(digest).toMatch(/^sha256:[a-f0-9]{64}$/u); - expect(job.container.options).toBe('--ipc=host'); - expect(job.env.npm_config_store_dir).toBe('/tmp/ha-ui-pnpm-store'); const commands = job.steps.flatMap(step => step.run?.split('\n') ?? []); - expect(commands.some(command => command.startsWith('pnpm exec playwright install'))).toBe(false); - for (const command of ['pnpm install --frozen-lockfile --ignore-scripts', 'pnpm check', 'pnpm test', 'pnpm build', 'pnpm test:package','pnpm test:ssr','pnpm storybook:build','pnpm test:storybook','pnpm test:engines']) expect(commands).toContain(command); - const packed = job.steps.find(step => step.name === 'Verify packed consumers and candidate provenance'); + const packed = job.steps.find(step => step.run === 'bash .github/scripts/verify-catalog.sh'); expect(packed.env.HA_UI_PACKED_EXPECTED_REVISION).toBe('${{ github.sha }}'); - expect(packed.run.trim().split('\n')).toEqual([ - 'export GIT_CONFIG_COUNT=1', - 'export GIT_CONFIG_KEY_0=safe.directory', - 'export GIT_CONFIG_VALUE_0="$(pwd -P)"', - 'pnpm test:package', - ]); - expect(commands.indexOf('pnpm test:engines')).toBeLessThan(commands.indexOf('pnpm test:storybook')); - const engines = job.steps.find(step => step.name === 'Run the browser engine matrix'); - expect(engines.shell).toBe('bash'); - expect(engines.run).toContain('test "$HOME" = /github/home'); - expect(engines.run).toContain('trap \'chown -- "$original_owner" /github/home\' EXIT'); + const verify = readFileSync('.github/scripts/verify-catalog.sh', 'utf8'); + expect(verify).toContain('--env HA_UI_PACKED_EXPECTED_REVISION'); + expect(verify).toContain('GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=/workspace pnpm test:package'); + expect(verify).toContain('pnpm build'); + expect(verify.indexOf('pnpm test:engines')).toBeLessThan(verify.indexOf('pnpm test:storybook')); const sdk = job.steps.find(step => step.with?.repository === 'vypdev/copilot'); expect(sdk.with.ref).toBe('3e7ceea08e6131360e026937d1c0cc1b120472e0'); expect(sdk.with['persist-credentials']).toBe(false); @@ -179,12 +167,12 @@ test('Pages builds only the trusted default branch and grants write permissions const quality = parse(readFileSync('.github/workflows/ci_check.yml', 'utf8')).jobs.quality; expect(build.container).toBeUndefined(); expect(build.env.HA_UI_PLAYWRIGHT_IMAGE).toBe('mcr.microsoft.com/playwright@sha256:f609973e8fd93f38a5ddfd706a65805294247dae8d81b2541c0afe2787746197'); - expect(quality.container.image).toBe('mcr.microsoft.com/playwright:v1.64.1-noble@sha256:2f05f8a734509a7b3f26a912639488ee08f58a7b292d14d62271bcff9038768f'); + expect(quality.env.HA_UI_PLAYWRIGHT_IMAGE).toBe(build.env.HA_UI_PLAYWRIGHT_IMAGE); expect(deploy.container).toBeUndefined(); - expect(build.steps.some(step => step.run === 'bash .github/scripts/verify-storybook-pages.sh')).toBe(true); - const verify = readFileSync('.github/scripts/verify-storybook-pages.sh', 'utf8'); + expect(build.steps.some(step => step.run === 'bash .github/scripts/verify-catalog.sh')).toBe(true); + const verify = readFileSync('.github/scripts/verify-catalog.sh', 'utf8'); expect(verify).toContain('--platform linux/arm64'); - expect(verify).toContain('--env npm_config_store_dir='+quality.env.npm_config_store_dir); + expect(verify).toContain('--env npm_config_store_dir=/tmp/ha-ui-pnpm-store'); expect(verify).not.toContain('playwright install'); for (const command of ['pnpm install --frozen-lockfile --ignore-scripts', 'pnpm check', 'pnpm test', 'pnpm test:package', 'pnpm test:ssr', 'pnpm storybook:build', 'pnpm test:storybook', 'pnpm test:engines']) { From 09e877c2d9b5dc4f96cc28b11f511a35c8dd466a Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Thu, 12 Nov 2026 09:31:13 +0100 Subject: [PATCH 3/4] ci: pass the package revision without npm config substitution --- .github/scripts/verify-catalog.sh | 4 ++-- tests/architecture.test.mjs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/scripts/verify-catalog.sh b/.github/scripts/verify-catalog.sh index 73c3113..3e40fda 100644 --- a/.github/scripts/verify-catalog.sh +++ b/.github/scripts/verify-catalog.sh @@ -20,7 +20,7 @@ docker run --rm --init --interactive --name "$container" --platform linux/arm64 --workdir /workspace \ --env CI=1 --env STORYBOOK_DISABLE_TELEMETRY=1 \ --env npm_config_store_dir=/tmp/ha-ui-pnpm-store \ - --env HA_UI_PACKED_EXPECTED_REVISION \ + --env "HA_UI_PACKED_EXPECTED_REVISION=${HA_UI_PACKED_EXPECTED_REVISION:-}" \ "${HA_UI_PLAYWRIGHT_IMAGE:?}" bash -euo pipefail <<'LINUX' HA_UI_NODE_VERSION=$(tr -d '\r\n' < .node-version) package_manager=$(node --print 'require("./package.json").packageManager') @@ -34,7 +34,7 @@ npm exec --yes --package="node@$HA_UI_NODE_VERSION" --package="$package_manager" pnpm install --frozen-lockfile --ignore-scripts pnpm check pnpm test - if [ -n "${HA_UI_PACKED_EXPECTED_REVISION:-}" ]; then + if [ -n "$HA_UI_PACKED_EXPECTED_REVISION" ]; then pnpm build fi GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=/workspace pnpm test:package diff --git a/tests/architecture.test.mjs b/tests/architecture.test.mjs index 3f357d7..e7e5117 100644 --- a/tests/architecture.test.mjs +++ b/tests/architecture.test.mjs @@ -73,7 +73,8 @@ test('CI Check runs for internal PR updates with frozen tools and all implemente const packed = job.steps.find(step => step.run === 'bash .github/scripts/verify-catalog.sh'); expect(packed.env.HA_UI_PACKED_EXPECTED_REVISION).toBe('${{ github.sha }}'); const verify = readFileSync('.github/scripts/verify-catalog.sh', 'utf8'); - expect(verify).toContain('--env HA_UI_PACKED_EXPECTED_REVISION'); + expect(verify).toContain('--env "HA_UI_PACKED_EXPECTED_REVISION=${HA_UI_PACKED_EXPECTED_REVISION:-}"'); + expect(verify).toContain('if [ -n "$HA_UI_PACKED_EXPECTED_REVISION" ]; then'); expect(verify).toContain('GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=/workspace pnpm test:package'); expect(verify).toContain('pnpm build'); expect(verify.indexOf('pnpm test:engines')).toBeLessThan(verify.indexOf('pnpm test:storybook')); From db43193388099598100d859b9f274f61c6a5db5a Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Thu, 12 Nov 2026 09:44:53 +0100 Subject: [PATCH 4/4] ci: run self-hosted validation on repository branch pushes --- .github/workflows/ci_check.yml | 7 +------ docs/compatibility.md | 2 +- docs/storybook.md | 7 ++++--- tests/architecture.test.mjs | 6 ++---- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci_check.yml b/.github/workflows/ci_check.yml index 0a280c9..8a830fe 100644 --- a/.github/workflows/ci_check.yml +++ b/.github/workflows/ci_check.yml @@ -1,11 +1,7 @@ name: CI Check on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review, converted_to_draft] push: - branches: [develop, master] - merge_group: - types: [checks_requested] + branches: ['**'] env: STORYBOOK_DISABLE_TELEMETRY: "1" permissions: @@ -13,7 +9,6 @@ permissions: jobs: quality: name: CI Check - if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} runs-on: group: vypdev labels: [self-hosted, macOS, ARM64] diff --git a/docs/compatibility.md b/docs/compatibility.md index b5bbefb..88d69a6 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -33,7 +33,7 @@ Disabled defaults to false. Labels and links retain their original values; snaps Invalid/extra fields, conflicting selection and unsafe or credential-bearing links raise the bounded NavigationInputError with code invalid_navigation. This validates data, not authorization or rendering. -CI Check runs for each PR head with no path filter. Current gates are strict types, all implemented +CI Check runs for each branch push to this repository with no path filter. Current gates are strict types, all implemented tests, independent source-inventory coverage, architecture/CI contracts, compiled declarations, real Chromium component behavior, actual reproducible packed consumption with a DOM-free contract and a compiled browser client, and the original pinned Copilot catalog validator. The packed browser fixture exercises real links, panel slots, keyboard, live Spanish labels/theme, diff --git a/docs/storybook.md b/docs/storybook.md index adf2c03..7c42913 100644 --- a/docs/storybook.md +++ b/docs/storybook.md @@ -86,13 +86,14 @@ shared fixes. No additional browser engine, owner HA installation or human accep ## Delivery -Every PR update from a branch in this repository runs `CI Check`, including strict types, full coverage, compiled package consumers, -static catalog build and the static browser gate. Its retained artifact includes `build/storybook/`, +Every branch push to this repository runs `CI Check`, including strict types, full coverage, compiled package consumers, +the static catalog build and the static browser gate. An internal pull request shows CI for its pushed head. +Bring the head up to date with the target branch before merging. Its retained artifact includes `build/storybook/`, coverage and browser evidence. This makes a candidate reviewable before merge. The separate Pages workflow builds and rechecks trusted `master` before upload; only its deployment job receives Pages write and OIDC permission. It never executes PR code with deployment permissions. -Fork workflows require maintainer approval in GitHub, and CI restricts execution to same-repository PRs. +Fork workflows require maintainer approval in GitHub. CI and the Pages build use Apple Silicon runners in the organization's `vypdev` group. Each runs the Linux build in a job-specific Docker container and keeps the runner's Docker credentials outside the container. The Pages deployment job uses diff --git a/tests/architecture.test.mjs b/tests/architecture.test.mjs index e7e5117..ec517a7 100644 --- a/tests/architecture.test.mjs +++ b/tests/architecture.test.mjs @@ -58,14 +58,12 @@ test('every actual core module respects the dependency boundary', () => { if (dependency.startsWith('.')) expect(relative(resolve('packages/core/src'), resolve(dirname(file), dependency)).startsWith('..')).toBe(false); } }); -test('CI Check runs for internal PR updates with frozen tools and all implemented quality gates', () => { +test('CI Check runs on branch pushes with frozen tools and all implemented quality gates', () => { const workflow = parse(readFileSync('.github/workflows/ci_check.yml', 'utf8')); expect(workflow.name).toBe('CI Check'); - expect(workflow.on.pull_request.types).toEqual(expect.arrayContaining(['opened','reopened','synchronize','ready_for_review','converted_to_draft'])); - expect(workflow.on.pull_request.paths).toBeUndefined(); + expect(workflow.on).toEqual({push: {branches: ['**']}}); const job = workflow.jobs.quality; expect(job.name).toBe('CI Check'); - expect(job.if).toBe("${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}"); expect(job['runs-on']).toEqual({group: 'vypdev', labels: ['self-hosted', 'macOS', 'ARM64']}); expect(job['continue-on-error']).toBeUndefined(); expect(job.steps.every(step => step['continue-on-error'] === undefined)).toBe(true);