Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,7 +1,7 @@
|
||||
name: Sentry Release
|
||||
|
||||
# Reusable workflow for Gitea Actions. Mirrors the GitHub equivalent at
|
||||
# .github/workflows/_sentry-release.yml. Requires Gitea Actions runner
|
||||
# Requires a Gitea Actions runner
|
||||
# capable of workflow_call (Gitea >= 1.21). For older runners use the
|
||||
# composite action at .gitea/actions/sentry-release/action.yml instead.
|
||||
|
||||
@@ -57,19 +57,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Download source-map artifact
|
||||
if: ${{ inputs.sourcemaps-artifact != 'none' }}
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
|
||||
with:
|
||||
name: ${{ inputs.sourcemaps-artifact }}
|
||||
path: ${{ inputs.sourcemaps-path }}
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
name: Accessibility
|
||||
|
||||
# Runs the axe-core vitest suites (apps/web ui components, SkipToContent)
|
||||
# and the WCAG-2.2-AA color-contrast verifier on every PR + push to main.
|
||||
#
|
||||
# Mirror of .github/workflows/a11y.yml for the Gitea runner.
|
||||
# and the WCAG-2.2-AA color-contrast verifier on manual demand.
|
||||
#
|
||||
# Docs: docs/contributing/wcag-audit.md
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
# TEMPORARY RUNNER RELIEF (2026-07-19): automatic PR/main triggers are paused
|
||||
# through 2026-07-22. Re-enable them with UI-focused path filters afterwards.
|
||||
# The fast accessibility contracts in ci.yml remain active meanwhile.
|
||||
|
||||
# Cancel superseded runs so rapid pushes don't pile up unclaimed on the runner
|
||||
# (mirrors ci.yml). Without this each push stacked a new a11y run on the queue.
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
# Keep duplicate manual runs from occupying the shared runner queue.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
@@ -52,19 +50,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
name: Bundle Budget Baseline
|
||||
|
||||
# Captures the main-branch bundle report. The report is both attached to the
|
||||
# run and cached under a main-only prefix consumed by the pull-request gate.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "apps/web/**"
|
||||
- "packages/brand/**"
|
||||
- "packages/config/**"
|
||||
- "packages/entitlements/**"
|
||||
- "packages/form-widget/**"
|
||||
- "packages/foundation/**"
|
||||
- "packages/i18n/**"
|
||||
- "packages/plugin-runtime/**"
|
||||
- "packages/ui*/**"
|
||||
- "packages/url/**"
|
||||
- "packages/view-models/**"
|
||||
- "package.json"
|
||||
- "pnpm-lock.yaml"
|
||||
- "scripts/bundle-budgets.json"
|
||||
- "scripts/verify-bundle-size.mjs"
|
||||
- ".gitea/workflows/bundle-budget-baseline.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
HIVEGRID_GITEA_HOST_IP: ${{ vars.HIVEGRID_GITEA_HOST_IP }}
|
||||
|
||||
jobs:
|
||||
capture:
|
||||
name: Capture bundle baseline
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
DATABASE_URL: postgresql://hivegrid:hivegrid@localhost:5432/hivegrid?schema=public
|
||||
steps:
|
||||
- name: Resolve internal Gitea host
|
||||
run: |
|
||||
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
||||
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
||||
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
||||
exit 1
|
||||
fi
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
- name: Checkout main
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
|
||||
- name: Prepare baseline cache
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: baseline/main-bundle-report.json
|
||||
key: bundle-baseline-main-${{ gitea.sha }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Build web
|
||||
run: pnpm --filter @hivegrid/web build
|
||||
|
||||
- name: Verify aggregate bundle budgets
|
||||
run: pnpm run verify:bundle-size
|
||||
|
||||
- name: Measure bundle sizes
|
||||
run: |
|
||||
mkdir -p baseline
|
||||
node scripts/verify-bundle-size.mjs --json > baseline/main-bundle-report.json
|
||||
|
||||
- name: Upload baseline report
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: bundle-baseline-main-${{ gitea.run_id }}
|
||||
path: baseline/main-bundle-report.json
|
||||
retention-days: 30
|
||||
@@ -1,8 +1,7 @@
|
||||
name: Bundle Budget
|
||||
|
||||
# Gitea variant of .github/workflows/bundle-budget.yml. Uses Gitea-API to
|
||||
# post / upsert a sticky PR comment with per-route gzip sizes.
|
||||
# Docs: docs/architecture/bundle-budgets.md
|
||||
# Enforces aggregate bundle budgets for pull requests. The current report and
|
||||
# its comparison with the latest cached main baseline are attached to the run.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -22,14 +21,20 @@ on:
|
||||
- "pnpm-lock.yaml"
|
||||
- "scripts/bundle-budgets.json"
|
||||
- "scripts/verify-bundle-size.mjs"
|
||||
- "scripts/render-bundle-budget-comment.mjs"
|
||||
- ".gitea/workflows/bundle-budget.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
HIVEGRID_GITEA_HOST_IP: ${{ vars.HIVEGRID_GITEA_HOST_IP }}
|
||||
|
||||
jobs:
|
||||
measure:
|
||||
name: Measure & report bundle sizes
|
||||
name: Measure and report bundle sizes
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
@@ -45,56 +50,65 @@ jobs:
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
- name: Checkout PR head
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout pull request
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
|
||||
- name: Restore latest main bundle baseline
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: baseline/main-bundle-report.json
|
||||
key: bundle-baseline-pr-${{ gitea.sha }}
|
||||
restore-keys: |
|
||||
bundle-baseline-main-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Build web (PR head)
|
||||
- name: Build web
|
||||
run: pnpm --filter @hivegrid/web build
|
||||
|
||||
- name: Verify aggregate bundle budgets
|
||||
run: pnpm run verify:bundle-size
|
||||
|
||||
- name: Measure PR bundle sizes
|
||||
- name: Measure bundle sizes
|
||||
if: always()
|
||||
run: node scripts/verify-bundle-size.mjs --json > pr-bundle-report.json
|
||||
|
||||
- name: Render PR comment markdown
|
||||
# Baseline download from Gitea artifact storage is opt-in via
|
||||
# BUNDLE_BASELINE_URL; falls back to no-diff mode otherwise.
|
||||
run: |
|
||||
if [ -n "${BUNDLE_BASELINE_URL:-}" ]; then
|
||||
curl -sSfL "$BUNDLE_BASELINE_URL" -o main-bundle-report.json || true
|
||||
fi
|
||||
node scripts/render-bundle-budget-comment.mjs \
|
||||
--current pr-bundle-report.json \
|
||||
--baseline main-bundle-report.json \
|
||||
--out bundle-comment.md
|
||||
env:
|
||||
BUNDLE_BASELINE_URL: ${{ vars.BUNDLE_BASELINE_URL }}
|
||||
- name: Render bundle report
|
||||
if: always()
|
||||
run: node scripts/render-bundle-budget-comment.mjs --current pr-bundle-report.json --baseline baseline/main-bundle-report.json --out bundle-report.md
|
||||
|
||||
- name: Upsert Gitea PR comment
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_HOST: ${{ vars.GITEA_HOST || 'git.tool-ctrl.de' }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: node scripts/post-bundle-budget-gitea-comment.mjs
|
||||
- name: Upload bundle report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: bundle-report-pr-${{ gitea.run_id }}
|
||||
path: |
|
||||
pr-bundle-report.json
|
||||
bundle-report.md
|
||||
retention-days: 14
|
||||
@@ -6,12 +6,81 @@ on:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
# Every Docker runtime resource is run-scoped; mutable pnpm stores are exclusively
|
||||
# locked, and root production closures share one atomic parallel bundle vertex.
|
||||
# Superseded runs can therefore stop instead of occupying the shared runner queue.
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
HIVEGRID_GITEA_HOST_IP: ${{ vars.HIVEGRID_GITEA_HOST_IP }}
|
||||
|
||||
jobs:
|
||||
# Keep the longest independent job at the front of Gitea's dispatch order. On the
|
||||
# eight-slot shared runner this prevents short service jobs from making Docker wait
|
||||
# for a second scheduling wave; all runtime resources remain run-scoped.
|
||||
docker-smoke:
|
||||
name: Docker Smoke
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
DOCKER_SMOKE_RUN_ID: ${{ gitea.run_id }}-${{ gitea.run_attempt }}
|
||||
DOCKER_SMOKE_REVISION: ${{ gitea.sha }}
|
||||
DOCKER_SMOKE_COMMAND_TIMEOUT_SECONDS: "90"
|
||||
DOCKER_SMOKE_ARTIFACT_TIMEOUT_SECONDS: "180"
|
||||
DOCKER_SMOKE_SUITE_TIMEOUT_SECONDS: "2520"
|
||||
# No needs: the Docker images are built from source inside this job (no dependency on the
|
||||
# quality/build jobs' outputs), so it runs fully in parallel instead of waiting on the
|
||||
# ~4 min quality phase -> off the critical tail. Trade-off: if quality fails, the images
|
||||
# still build (wasted compute), but the run fails overall anyway.
|
||||
steps:
|
||||
- name: Setup hosts override and Docker CLI
|
||||
run: |
|
||||
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
||||
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
||||
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
||||
exit 1
|
||||
fi
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1 || ! docker buildx version >/dev/null 2>&1 || ! docker compose version >/dev/null 2>&1; then
|
||||
if ! command -v apt-get >/dev/null 2>&1 || [ "$(id -u)" != "0" ]; then
|
||||
echo "Docker CLI/buildx missing and apt-get is not available as root"
|
||||
exit 1
|
||||
fi
|
||||
apt-get update -qq
|
||||
apt-get install -qq -y --no-install-recommends ca-certificates curl
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
. /etc/os-release
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list
|
||||
apt-get update -qq
|
||||
apt-get install -qq -y --no-install-recommends docker-ce-cli docker-buildx-plugin docker-compose-plugin
|
||||
fi
|
||||
|
||||
docker --version
|
||||
docker buildx version
|
||||
docker compose version
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
# Run/attempt-scoped runtime resources and one locked parallel closure bundle let the suite
|
||||
# build all images in parallel, then validate all isolated runtimes in parallel. The
|
||||
# two-wave barrier guarantees the web migrator image exists before service validation;
|
||||
# the Node hard cap remains authoritative on older runners.
|
||||
- name: Run isolated Docker smoke suite
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
node scripts/lib/run-command-with-timeout.mjs \
|
||||
--stage docker-smoke:suite \
|
||||
--timeout-seconds "$DOCKER_SMOKE_SUITE_TIMEOUT_SECONDS" \
|
||||
--grace-seconds 45 \
|
||||
-- bash scripts/ci/docker-smoke-suite.sh all
|
||||
|
||||
# The former single "verify" gate is split into two parallel jobs (verify-1 + verify-2)
|
||||
# to halve CI wallclock. The two heavy UI checks (ui-visual + hot-swap) sit in verify-1,
|
||||
# the two heavy accessibility checks (a11y-coverage + a11y smoke) in verify-2, with the
|
||||
@@ -35,19 +104,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -57,8 +134,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Verify GitHub CI workflow
|
||||
run: pnpm run verify:github-ci-workflow
|
||||
- name: Verify immutable action pins
|
||||
run: pnpm run verify:action-pins
|
||||
|
||||
- name: Verify Gitea CI workflow
|
||||
run: pnpm run verify:gitea-ci-workflow
|
||||
@@ -69,6 +146,12 @@ jobs:
|
||||
- name: Verify deploy readiness
|
||||
run: pnpm run verify:deploy-readiness
|
||||
|
||||
- name: Verify production dependency licenses
|
||||
run: pnpm run verify:licenses
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: pnpm audit --prod --audit-level high
|
||||
|
||||
- name: Verify Docker baseline
|
||||
run: pnpm run verify:docker-baseline
|
||||
|
||||
@@ -117,19 +200,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -142,7 +233,7 @@ jobs:
|
||||
- name: Verify tenant isolation report
|
||||
run: pnpm run verify:tenant-isolation-report
|
||||
|
||||
- name: Verify cross-cutting model registry completeness
|
||||
- name: Verify tenant-scope manifest and lifecycle registries
|
||||
run: pnpm run verify:cross-cutting-models
|
||||
|
||||
- name: Verify sidebar routes
|
||||
@@ -159,7 +250,7 @@ jobs:
|
||||
- name: Verify Phase C package boundaries
|
||||
run: pnpm run verify:phase-c-boundaries
|
||||
|
||||
- name: Verify Feature Manifest removed modules
|
||||
- name: Verify removed modules
|
||||
run: pnpm run verify:removed-modules
|
||||
|
||||
- name: Verify accessibility coverage
|
||||
@@ -169,11 +260,7 @@ jobs:
|
||||
run: pnpm run test:a11y
|
||||
|
||||
- name: Verify documentation gates
|
||||
run: |
|
||||
pnpm run verify:porting-docs-baseline
|
||||
pnpm run verify:production-docs
|
||||
pnpm run verify:release-docs
|
||||
pnpm run verify:docs-links
|
||||
run: pnpm run verify:docs-links
|
||||
|
||||
typecheck-test:
|
||||
name: Quality Typecheck and Tests
|
||||
@@ -193,19 +280,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -215,20 +310,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Typecheck
|
||||
run: pnpm typecheck
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
|
||||
- name: Foundation package tests
|
||||
run: pnpm run test:foundation
|
||||
|
||||
- name: Workspace package tests
|
||||
run: pnpm run test:packages
|
||||
|
||||
- name: Unit tests
|
||||
run: pnpm test
|
||||
- name: Run parallel quality groups
|
||||
run: bash scripts/ci/run-quality-groups.sh
|
||||
|
||||
build:
|
||||
name: Quality Build and Bundle
|
||||
@@ -248,19 +331,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -278,17 +369,17 @@ jobs:
|
||||
HIVEGRID_BUILD_SOURCEMAPS: "1"
|
||||
run: pnpm run build:ci
|
||||
|
||||
- name: Verify bundle size
|
||||
run: pnpm run verify:bundle-size
|
||||
- name: Verify web runtime dependency closure
|
||||
run: pnpm run verify:runtime-closures -- --runtime=web
|
||||
|
||||
- name: Verify web Sentry sourcemaps
|
||||
run: test -n "$(find apps/web/build/client -type f -name '*.map' -print -quit)"
|
||||
run: test -n "$(find apps/web/build-sourcemaps/core -type f -name '*.map' -print -quit)" && test -n "$(find apps/web/build-sourcemaps/portal -type f -name '*.map' -print -quit)"
|
||||
|
||||
- name: Upload web Sentry sourcemaps
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: web-client-sourcemaps
|
||||
path: apps/web/build/client
|
||||
path: apps/web/build-sourcemaps
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
@@ -313,19 +404,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -347,6 +446,9 @@ jobs:
|
||||
- name: Build API
|
||||
run: pnpm --filter @hivegrid/api build
|
||||
|
||||
- name: Verify API runtime dependency closure
|
||||
run: pnpm run verify:runtime-closures -- --runtime=api
|
||||
|
||||
mcp:
|
||||
name: MCP Service
|
||||
runs-on: toolctrl-ci
|
||||
@@ -365,19 +467,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -396,6 +506,69 @@ jobs:
|
||||
- name: Build MCP
|
||||
run: pnpm --filter @hivegrid/mcp build
|
||||
|
||||
- name: Verify MCP runtime dependency closure
|
||||
run: pnpm run verify:runtime-closures -- --runtime=mcp
|
||||
|
||||
hocuspocus:
|
||||
name: Hocuspocus Service
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
DATABASE_URL: postgresql://hivegrid:hivegrid@localhost:5432/hivegrid?schema=public
|
||||
steps:
|
||||
- name: Resolve internal Gitea host
|
||||
run: |
|
||||
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
||||
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
||||
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
||||
exit 1
|
||||
fi
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Typecheck Hocuspocus
|
||||
run: pnpm --filter @hivegrid/hocuspocus typecheck
|
||||
|
||||
- name: Test Hocuspocus
|
||||
run: pnpm --filter @hivegrid/hocuspocus test
|
||||
|
||||
- name: Build Hocuspocus
|
||||
run: pnpm --filter @hivegrid/hocuspocus build
|
||||
|
||||
- name: Verify Hocuspocus runtime dependency closure
|
||||
run: pnpm run verify:runtime-closures -- --runtime=hocuspocus
|
||||
|
||||
worker:
|
||||
name: Worker Service
|
||||
runs-on: toolctrl-ci
|
||||
@@ -414,19 +587,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -448,11 +629,75 @@ jobs:
|
||||
- name: Build Worker
|
||||
run: pnpm --filter @hivegrid/worker build
|
||||
|
||||
- name: Verify worker runtime dependency closure
|
||||
run: pnpm run verify:runtime-closures -- --runtime=worker
|
||||
|
||||
- name: Health Check Worker
|
||||
run: pnpm --filter @hivegrid/worker health
|
||||
env:
|
||||
WORKER_ENABLED: "false"
|
||||
|
||||
portal-domain-controller:
|
||||
name: Portal Domain Controller Service
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Resolve internal Gitea host
|
||||
run: |
|
||||
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
||||
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
||||
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
||||
exit 1
|
||||
fi
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Typecheck portal-domain controller
|
||||
run: pnpm --filter @hivegrid/portal-domain-controller typecheck
|
||||
|
||||
- name: Test portal-domain controller
|
||||
run: pnpm --filter @hivegrid/portal-domain-controller test
|
||||
|
||||
- name: Build portal-domain controller
|
||||
run: pnpm --filter @hivegrid/portal-domain-controller build
|
||||
|
||||
- name: Verify portal-domain controller runtime dependency closure
|
||||
run: pnpm run verify:runtime-closures -- --runtime=portal-domain-controller
|
||||
|
||||
- name: Verify portal-domain controller deploy contract
|
||||
run: pnpm run verify:portal-domain-controller-deploy
|
||||
|
||||
database:
|
||||
name: Database Checks
|
||||
runs-on: toolctrl-ci
|
||||
@@ -469,19 +714,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -516,9 +769,29 @@ jobs:
|
||||
|
||||
docker --version
|
||||
|
||||
- name: Verify tenant policy contract
|
||||
run: pnpm run verify:tenant-policy-contract
|
||||
|
||||
- name: Verify RLS release readiness
|
||||
run: pnpm run verify:rls-release-readiness
|
||||
|
||||
- name: Verify identity and invite legacy migration
|
||||
run: pnpm run verify:identity-invite-migration
|
||||
|
||||
- name: Verify SHK first-steps legacy migration
|
||||
run: pnpm run verify:shk-first-steps-migration
|
||||
|
||||
- name: Verify migrations schema parity
|
||||
run: pnpm run verify:migrations-parity
|
||||
|
||||
- name: Verify Prisma baseline equivalence
|
||||
run: pnpm run verify:prisma-baseline-equivalence
|
||||
|
||||
- name: Verify RLS against fresh PostgreSQL
|
||||
run: pnpm run verify:rls-live
|
||||
env:
|
||||
HIVEGRID_RLS_REQUIRE_MIGRATION_CHAIN_PARITY: "1"
|
||||
|
||||
- name: Verify database migration status
|
||||
if: gitea.event_name != 'pull_request'
|
||||
run: pnpm run verify:db-migrate-status:staging
|
||||
@@ -530,102 +803,3 @@ jobs:
|
||||
|
||||
- name: Test database package
|
||||
run: pnpm --filter @hivegrid/db test
|
||||
|
||||
docker-smoke:
|
||||
name: Docker Smoke
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 30
|
||||
# No needs: the Docker images are built from source inside this job (no dependency on the
|
||||
# quality/build jobs' outputs), so it runs fully in parallel instead of waiting on the
|
||||
# ~4 min quality phase -> off the critical tail. Trade-off: if quality fails, the images
|
||||
# still build (wasted compute), but the run fails overall anyway.
|
||||
steps:
|
||||
- name: Setup hosts override and Docker CLI
|
||||
run: |
|
||||
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
||||
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
||||
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
||||
exit 1
|
||||
fi
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1 || ! docker buildx version >/dev/null 2>&1 || ! docker compose version >/dev/null 2>&1; then
|
||||
if ! command -v apt-get >/dev/null 2>&1 || [ "$(id -u)" != "0" ]; then
|
||||
echo "Docker CLI/buildx missing and apt-get is not available as root"
|
||||
exit 1
|
||||
fi
|
||||
apt-get update -qq
|
||||
apt-get install -qq -y --no-install-recommends ca-certificates curl
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
. /etc/os-release
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list
|
||||
apt-get update -qq
|
||||
apt-get install -qq -y --no-install-recommends docker-ce-cli docker-buildx-plugin docker-compose-plugin
|
||||
fi
|
||||
|
||||
docker --version
|
||||
docker buildx version
|
||||
docker compose version
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Layer-cache strategy: this job runs on the self-hosted toolctrl-ci runner against the
|
||||
# mounted host Docker daemon, whose BuildKit keeps a persistent local layer cache between
|
||||
# CI runs (proven by the fact the `docker run hivegrid-*:smoke` steps below find images the
|
||||
# build loaded into the host store). The Dockerfile additionally persists the pnpm store via
|
||||
# `RUN --mount=type=cache,id=hivegrid-pnpm-store`. The three targets share base/deps/build
|
||||
# stages, so a single daemon dedupes them within a run. No explicit `--cache-to/--cache-from`
|
||||
# (type=local/registry) is configured: it would add cold first runs, import/export overhead
|
||||
# and would require `--load` for the smoke steps, for no gain over the warm host cache.
|
||||
# `type=gha` is intentionally not used here — it is GitHub-hosted-runner-only.
|
||||
- name: Build Docker smoke targets
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
docker build --target web --build-arg APP_REVISION=ci-smoke-revision --tag hivegrid-web:smoke . &
|
||||
web_pid=$!
|
||||
docker build --target api --build-arg APP_REVISION=ci-smoke-revision --tag hivegrid-api:smoke . &
|
||||
api_pid=$!
|
||||
docker build --target mcp --build-arg APP_REVISION=ci-smoke-revision --tag hivegrid-mcp:smoke . &
|
||||
mcp_pid=$!
|
||||
docker build --target worker --build-arg APP_REVISION=ci-smoke-revision --tag hivegrid-worker:smoke . &
|
||||
worker_pid=$!
|
||||
|
||||
status=0
|
||||
wait "$web_pid" || status=$?
|
||||
wait "$api_pid" || status=$?
|
||||
wait "$mcp_pid" || status=$?
|
||||
wait "$worker_pid" || status=$?
|
||||
exit "$status"
|
||||
|
||||
- name: Validate web Docker artifacts
|
||||
run: docker run --rm --entrypoint /bin/sh hivegrid-web:smoke -lc 'test -f /myapp/apps/web/build/server/index.js && test -d /myapp/apps/web/build/client && test -f /myapp/build/server-runtime/server.js'
|
||||
|
||||
- name: Validate web Docker runtime
|
||||
run: bash scripts/docker-web-runtime-smoke.sh hivegrid-web:smoke
|
||||
env:
|
||||
DOCKER_WEB_SMOKE_TRANSPORT: exec
|
||||
|
||||
- name: Validate API Docker runtime
|
||||
run: bash scripts/docker-api-runtime-smoke.sh hivegrid-api:smoke
|
||||
env:
|
||||
DOCKER_API_SMOKE_TRANSPORT: exec
|
||||
|
||||
- name: Validate MCP Docker runtime
|
||||
run: bash scripts/docker-mcp-runtime-smoke.sh hivegrid-mcp:smoke
|
||||
env:
|
||||
DOCKER_MCP_SMOKE_TRANSPORT: exec
|
||||
|
||||
- name: Validate worker Docker runtime
|
||||
run: bash scripts/docker-worker-runtime-smoke.sh hivegrid-worker:smoke
|
||||
|
||||
- name: Validate Docker Compose config
|
||||
run: docker compose config
|
||||
@@ -1,10 +1,8 @@
|
||||
name: Coverage
|
||||
|
||||
# Gitea variant of .github/workflows/coverage.yml. Runs vitest with --coverage
|
||||
# and the per-path gate (scripts/verify-test-coverage.mjs) and upserts a
|
||||
# sticky PR comment via the Gitea API.
|
||||
#
|
||||
# Docs: docs/architecture/test-coverage.md
|
||||
# Enforces the per-path Vitest coverage thresholds on the self-hosted Gitea
|
||||
# runner. The rendered report is attached to the run so it remains available
|
||||
# without a GitHub-specific PR-comment action.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -16,6 +14,13 @@ on:
|
||||
- "scripts/coverage-summary.mjs"
|
||||
- "vitest.config.ts"
|
||||
- ".gitea/workflows/coverage.yml"
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
HIVEGRID_GITEA_HOST_IP: ${{ vars.HIVEGRID_GITEA_HOST_IP }}
|
||||
@@ -36,20 +41,28 @@ jobs:
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
- name: Checkout PR head
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -59,20 +72,21 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Run vitest with coverage (enforces per-path gates)
|
||||
- name: Run Vitest coverage gate
|
||||
run: pnpm run verify:test-coverage
|
||||
|
||||
- name: Render PR coverage comment
|
||||
if: always()
|
||||
run: node scripts/coverage-summary.mjs --pr-comment > coverage-comment.md
|
||||
|
||||
- name: Upsert Gitea PR comment
|
||||
- name: Render coverage report
|
||||
if: always()
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_HOST: ${{ vars.GITEA_HOST || 'git.tool-ctrl.de' }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
COMMENT_PATH: coverage-comment.md
|
||||
COMMENT_MARKER: "<!-- coverage-report -->"
|
||||
run: node scripts/post-coverage-gitea-comment.mjs
|
||||
COVERAGE_SUMMARY_PATH: coverage-gate/coverage-summary.json
|
||||
run: node scripts/coverage-summary.mjs --pr-comment > coverage-report.md
|
||||
|
||||
- name: Upload coverage report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: coverage-report-${{ gitea.run_id }}
|
||||
path: |
|
||||
coverage-gate/
|
||||
coverage-report.md
|
||||
retention-days: 14
|
||||
File diff suppressed because it is too large.
Load diff
@@ -9,6 +9,11 @@ name: E2E Readiness
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
customer_portal_invitation:
|
||||
description: "Operator-approved disposable VA-P26a invitation, delivered-mail, setup and replay proof"
|
||||
required: false
|
||||
default: "false"
|
||||
type: boolean
|
||||
plugin_lifecycle_mutation:
|
||||
description: "Operator-approved disposable run: persist plugin grant/revoke and enable/disable state"
|
||||
required: false
|
||||
@@ -64,27 +69,23 @@ env:
|
||||
E2E_TENANT_ACCOUNT_NAME: E2E Readiness
|
||||
E2E_TENANT_ACCOUNT_SLUG: e2e-readiness
|
||||
E2E_TENANT_DASHBOARD_PATH: /e2e-readiness/dashboard
|
||||
E2E_TENANT_SETTINGS_ACCOUNT_PATH: /e2e-readiness/settings/account
|
||||
E2E_TENANT_CHAT_PATH: /e2e-readiness/chat/chat_e2e_readiness
|
||||
E2E_TENANT_SETTINGS_ACCOUNT_PATH: /e2e-readiness/settings/workspace
|
||||
E2E_TENANT_SETTINGS_PROFILE_PATH: /e2e-readiness/settings/profile
|
||||
E2E_TENANT_SUBSCRIPTION_PATH: /e2e-readiness/settings/subscription
|
||||
E2E_TENANT_MEMBERS_PATH: /e2e-readiness/settings/members
|
||||
E2E_TENANT_ROLES_AND_PERMISSIONS_PATH: /e2e-readiness/settings/roles-and-permissions
|
||||
E2E_TENANT_NOTIFICATIONS_PATH: /e2e-readiness/settings/notifications
|
||||
E2E_TENANT_LOGS_PATH: /e2e-readiness/settings/logs
|
||||
E2E_TENANT_LOG_EVENTS_PATH: /e2e-readiness/settings/logs/events
|
||||
E2E_TENANT_AUDIT_EXPORT_PATH: /e2e-readiness/settings/audit-export
|
||||
E2E_TENANT_PRIVACY_PATH: /e2e-readiness/settings/privacy
|
||||
E2E_TENANT_CHATBOT_PATH: /e2e-readiness/settings/chatbot
|
||||
E2E_TENANT_AI_USAGE_PATH: /e2e-readiness/settings/ai-usage
|
||||
E2E_TENANT_API_PATH: /e2e-readiness/settings/api
|
||||
E2E_TENANT_API_KEYS_PATH: /e2e-readiness/settings/api/keys
|
||||
E2E_TENANT_API_DOCS_PATH: /e2e-readiness/settings/api/docs
|
||||
E2E_TENANT_API_LOGS_PATH: /e2e-readiness/settings/api/logs
|
||||
E2E_TENANT_POLICIES_PATH: /e2e-readiness/settings/policies
|
||||
E2E_TENANT_PORTAL_ANALYTICS_PATH: /e2e-readiness/portals/e2e-readiness/analytics
|
||||
E2E_TENANT_PORTAL_SETTINGS_PATH: /e2e-readiness/portals/e2e-readiness/settings
|
||||
E2E_TENANT_SUBSCRIPTION_PATH: /e2e-readiness/settings/billing
|
||||
E2E_TENANT_MEMBERS_PATH: /e2e-readiness/settings/team
|
||||
E2E_TENANT_ROLES_AND_PERMISSIONS_PATH: /e2e-readiness/settings/team/roles
|
||||
E2E_TENANT_NOTIFICATIONS_PATH: /e2e-readiness/settings/profile/notifications
|
||||
E2E_TENANT_LOGS_PATH: /e2e-readiness/settings/compliance
|
||||
E2E_TENANT_LOG_EVENTS_PATH: /e2e-readiness/settings/compliance/events
|
||||
E2E_TENANT_AUDIT_EXPORT_PATH: /e2e-readiness/settings/compliance/audit-export
|
||||
E2E_TENANT_PRIVACY_PATH: /e2e-readiness/settings/profile/data
|
||||
E2E_TENANT_API_PATH: /e2e-readiness/settings/integrations/api
|
||||
E2E_TENANT_API_KEYS_PATH: /e2e-readiness/settings/integrations/api/keys
|
||||
E2E_TENANT_API_LOGS_PATH: /e2e-readiness/settings/integrations/api/logs
|
||||
E2E_TENANT_POLICIES_PATH: /e2e-readiness/settings/workspace/policies
|
||||
E2E_ADMIN_EMAIL_SEQUENCES_PATH: /email-sequences
|
||||
E2E_PLUGIN_SETTINGS_PATH: /e2e-readiness/settings/plugins
|
||||
E2E_PLUGIN_SETTINGS_PATH: /e2e-readiness/settings/integrations/plugins
|
||||
E2E_WORKFLOW_ENGINE_PATH: /e2e-readiness/workflow-engine/workflows
|
||||
E2E_WORKFLOW_BUILDER_PATH: /e2e-readiness/workflow-engine/workflows/wf_123
|
||||
E2E_WORKFLOW_RUN_API_PATH: /e2e-readiness/workflow-engine/workflows/wf_123/run/api
|
||||
@@ -122,19 +123,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -142,7 +151,7 @@ jobs:
|
||||
${{ runner.os }}-pnpm-
|
||||
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
@@ -199,9 +208,40 @@ jobs:
|
||||
- name: Run strict E2E readiness suite
|
||||
run: pnpm run verify:e2e-a11y
|
||||
|
||||
- name: Run operator-gated VA-P26a invitation lifecycle
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.customer_portal_invitation }}
|
||||
env:
|
||||
E2E_BASE_URL: https://staging-app.hivegrid.de
|
||||
E2E_TENANT_EMAIL: ${{ secrets.E2E_PORTAL_INVITATION_ADMIN_EMAIL }}
|
||||
E2E_TENANT_PASSWORD: ${{ secrets.E2E_PORTAL_INVITATION_ADMIN_PASSWORD }}
|
||||
E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH: /demo-pro-crm/settings/customer-portal
|
||||
E2E_PORTAL_BASE_URL: https://staging-portal.hivegrid.de
|
||||
E2E_PORTAL_TENANT_SLUG: demo-pro-crm
|
||||
E2E_PORTAL_INVITATION_ENTRYPOINT: admin
|
||||
E2E_PORTAL_INVITATION_EXPECTED_PROJECT: ${{ vars.E2E_PORTAL_INVITATION_EXPECTED_PROJECT }}
|
||||
E2E_PORTAL_INVITATION_SETUP_PASSWORD: ${{ secrets.E2E_PORTAL_INVITATION_SETUP_PASSWORD }}
|
||||
E2E_PORTAL_SETUP_MAIL_FIXTURE_URL: ${{ secrets.E2E_PORTAL_SETUP_MAIL_FIXTURE_URL }}
|
||||
E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN: ${{ secrets.E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN }}
|
||||
E2E_PORTAL_SETUP_MAIL_FIXTURE_TIMEOUT_MS: "90000"
|
||||
E2E_ALLOW_CUSTOMER_PORTAL_P26A_INVITATION_MUTATION: "1"
|
||||
REQUIRE_E2E_READINESS: "1"
|
||||
REQUIRE_E2E_MUTATING_READINESS: "1"
|
||||
run: |
|
||||
run_id="${GITHUB_RUN_ID:-}"
|
||||
run_attempt="${GITHUB_RUN_ATTEMPT:-1}"
|
||||
case "$run_id:$run_attempt" in
|
||||
*[!0-9:]*|":"|*:*:*) echo "Invalid workflow run identity" >&2; exit 1 ;;
|
||||
esac
|
||||
correlation_key="p26a-${run_id}-${run_attempt}"
|
||||
export E2E_PORTAL_SETUP_MAIL_FIXTURE_KEY="$correlation_key"
|
||||
export E2E_PORTAL_INVITATION_EMAIL="customer-portal-invitation+${correlation_key}@saas-ctrl.com"
|
||||
export E2E_PORTAL_INVITATION_FIRST_NAME="Portal"
|
||||
export E2E_PORTAL_INVITATION_LAST_NAME="Invitation E2E"
|
||||
pnpm run verify:e2e-customer-portal-invitation
|
||||
|
||||
- name: Upload Playwright traces
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: e2e-readiness-results
|
||||
path: test-results/
|
||||
|
||||
@@ -37,7 +37,15 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Mint Lighthouse session cookie
|
||||
run: node scripts/rotate-lighthouse-session-cookie.mjs
|
||||
@@ -46,11 +54,11 @@ jobs:
|
||||
LIGHTHOUSE_LOGIN_EMAIL: ${{ secrets.LIGHTHOUSE_LOGIN_EMAIL }}
|
||||
LIGHTHOUSE_LOGIN_PASSWORD: ${{ secrets.LIGHTHOUSE_LOGIN_PASSWORD }}
|
||||
LIGHTHOUSE_SESSION_COOKIE: ${{ secrets.LIGHTHOUSE_SESSION_COOKIE }}
|
||||
LIGHTHOUSE_SESSION_COOKIE_NAME: hivegrid_session
|
||||
LIGHTHOUSE_SESSION_COOKIE_NAME: __Host-hivegrid_app_session
|
||||
LIGHTHOUSE_COOKIE_DOMAIN: app.hivegrid.de
|
||||
|
||||
- name: Install Chromium
|
||||
# The Gitea runner image (node:20-bookworm) ships no browser; LHCI's
|
||||
# The Gitea runner base image ships no browser; LHCI's
|
||||
# healthcheck otherwise fails with "Chrome installation not found".
|
||||
run: |
|
||||
apt-get update
|
||||
@@ -58,14 +66,14 @@ jobs:
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
- name: Run Lighthouse-CI against staging
|
||||
run: npx --yes @lhci/cli@0.13.x autorun --config=./.lighthouserc.staging.json
|
||||
run: npx --yes @lhci/cli@0.13.0 autorun --config=./.lighthouserc.staging.json
|
||||
env:
|
||||
# chromium installs to /usr/bin/chromium on Debian bookworm.
|
||||
CHROME_PATH: /usr/bin/chromium
|
||||
|
||||
- name: Upload Lighthouse artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: lighthouse-ci-results
|
||||
path: .lighthouseci/
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
name: Repository Metrics
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: loc-history-main
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
GITEA_HOST: ${{ vars.GITEA_HOST || 'git.tool-ctrl.de' }}
|
||||
HIVEGRID_GITEA_HOST_IP: ${{ vars.HIVEGRID_GITEA_HOST_IP }}
|
||||
LOC_METRICS_OUTPUT_DIR: /tmp/hivegrid-loc-history
|
||||
SOURCE_REF: ${{ gitea.ref }}
|
||||
SOURCE_SHA: ${{ gitea.sha }}
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Generate and publish repository metrics
|
||||
runs-on: toolctrl-ci
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Resolve internal Gitea host
|
||||
run: |
|
||||
if [ -n "${HIVEGRID_GITEA_HOST_IP:-}" ]; then
|
||||
if ! HIVEGRID_GITEA_HOST_IP="$HIVEGRID_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.HIVEGRID_GITEA_HOST_IP || "") ? 0 : 1)'; then
|
||||
echo "HIVEGRID_GITEA_HOST_IP must be a single IPv4 or IPv6 token"
|
||||
exit 1
|
||||
fi
|
||||
printf '%s git.tool-ctrl.de\n' "$HIVEGRID_GITEA_HOST_IP" >> /etc/hosts
|
||||
fi
|
||||
|
||||
- name: Checkout full mainline history
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Verify source revision
|
||||
run: |
|
||||
set -eu
|
||||
if [ "$SOURCE_REF" != "refs/heads/main" ]; then
|
||||
echo "Repository metrics may only be published from refs/heads/main"
|
||||
exit 1
|
||||
fi
|
||||
if ! printf '%s' "$SOURCE_SHA" | grep -Eq '^[0-9a-f]{40}$'; then
|
||||
echo "Gitea SHA must be a full 40-character commit SHA"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(git rev-parse HEAD)" != "$SOURCE_SHA" ]; then
|
||||
echo "Checked-out HEAD does not match the Gitea event SHA"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Generate repository metrics
|
||||
run: |
|
||||
mkdir -p "$LOC_METRICS_OUTPUT_DIR"
|
||||
node scripts/metrics/loc-history.mjs \
|
||||
--ref HEAD \
|
||||
--label origin/main \
|
||||
--output-dir "$LOC_METRICS_OUTPUT_DIR"
|
||||
node scripts/metrics/commit-history.mjs \
|
||||
--ref HEAD \
|
||||
--label origin/main \
|
||||
--days 60 \
|
||||
--output-dir "$LOC_METRICS_OUTPUT_DIR"
|
||||
test -s "$LOC_METRICS_OUTPUT_DIR/commit-history.csv"
|
||||
test -s "$LOC_METRICS_OUTPUT_DIR/commit-history.svg"
|
||||
test -s "$LOC_METRICS_OUTPUT_DIR/loc-history.csv"
|
||||
test -s "$LOC_METRICS_OUTPUT_DIR/loc-history.svg"
|
||||
|
||||
- name: Verify repository-scoped Actions token
|
||||
env:
|
||||
LOC_METRICS_GITEA_TOKEN: ${{ gitea.token }}
|
||||
run: |
|
||||
node --input-type=module <<'NODE'
|
||||
const host = process.env.GITEA_HOST ?? "";
|
||||
const token = process.env.LOC_METRICS_GITEA_TOKEN ?? "";
|
||||
|
||||
if (!/^[A-Za-z0-9.-]+(?::\d+)?$/.test(host)) {
|
||||
throw new Error("GITEA_HOST must be a hostname with an optional port");
|
||||
}
|
||||
if (!token) {
|
||||
throw new Error("The built-in Gitea Actions token is required");
|
||||
}
|
||||
|
||||
const response = await fetch(`https://${host}/api/v1/repos/toolctrl-labs/HiveGrid-Cloud`, {
|
||||
headers: { Accept: "application/json", Authorization: `token ${token}` },
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`Actions token repository lookup failed with HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
const repository = await response.json();
|
||||
if (
|
||||
repository.full_name !== "toolctrl-labs/HiveGrid-Cloud" ||
|
||||
repository.private !== true ||
|
||||
repository.permissions?.pull !== true ||
|
||||
repository.permissions?.push !== true ||
|
||||
repository.permissions?.admin === true
|
||||
) {
|
||||
throw new Error("Actions token must have non-admin write access to exactly HiveGrid-Cloud");
|
||||
}
|
||||
const releases = await fetch(`https://${host}/api/v1/repos/toolctrl-labs/HiveGrid-Cloud/releases?limit=1`, {
|
||||
headers: { Accept: "application/json", Authorization: `token ${token}` },
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
});
|
||||
if (releases.status === 403) {
|
||||
throw new Error(
|
||||
"The Actions token cannot read releases. Releases sit in Gitea's repository scope, which the workflow grants via `permissions: contents: write` — `code: write` only covers Git pushes.",
|
||||
);
|
||||
}
|
||||
if (!releases.ok) {
|
||||
throw new Error(`Actions token release lookup failed with HTTP ${releases.status}`);
|
||||
}
|
||||
|
||||
console.log("Verified repository-scoped non-admin Actions write token with release access");
|
||||
NODE
|
||||
|
||||
- name: Publish repository metrics as release assets
|
||||
env:
|
||||
LOC_METRICS_GITEA_TOKEN: ${{ gitea.token }}
|
||||
run: |
|
||||
node --input-type=module <<'NODE'
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
// The LOC artefacts used to live on a long-lived `loc-metrics` branch, which
|
||||
// showed up as abandoned work in every branch listing. They are release
|
||||
// assets now: one reusable container, stable download URLs for the README,
|
||||
// and nothing pushed into the repository's Git history.
|
||||
const REPOSITORY = "toolctrl-labs/HiveGrid-Cloud";
|
||||
const TAG = "loc-metrics";
|
||||
const FILES = ["commit-history.csv", "commit-history.svg", "loc-history.csv", "loc-history.svg"];
|
||||
|
||||
const host = process.env.GITEA_HOST ?? "";
|
||||
const token = process.env.LOC_METRICS_GITEA_TOKEN ?? "";
|
||||
const outputDir = process.env.LOC_METRICS_OUTPUT_DIR ?? "";
|
||||
const sourceSha = process.env.SOURCE_SHA ?? "";
|
||||
|
||||
if (!/^[A-Za-z0-9.-]+(?::\d+)?$/.test(host)) {
|
||||
throw new Error("GITEA_HOST must be a hostname with an optional port");
|
||||
}
|
||||
if (!token) {
|
||||
throw new Error("The built-in Gitea Actions token is required");
|
||||
}
|
||||
|
||||
const api = `https://${host}/api/v1/repos/${REPOSITORY}`;
|
||||
async function call(path, init = {}) {
|
||||
return fetch(`${api}${path}`, {
|
||||
...init,
|
||||
headers: { Accept: "application/json", Authorization: `token ${token}`, ...(init.headers ?? {}) },
|
||||
signal: AbortSignal.timeout(30_000),
|
||||
});
|
||||
}
|
||||
|
||||
let release;
|
||||
const lookup = await call(`/releases/tags/${TAG}`);
|
||||
if (lookup.ok) {
|
||||
release = await lookup.json();
|
||||
} else if (lookup.status === 404) {
|
||||
const created = await call("/releases", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
tag_name: TAG,
|
||||
target_commitish: sourceSha,
|
||||
name: "Repository metrics",
|
||||
body: "Automatically maintained LOC and commit-history artefacts. Not a product release.",
|
||||
draft: false,
|
||||
prerelease: false,
|
||||
}),
|
||||
});
|
||||
if (!created.ok) {
|
||||
throw new Error(`Creating the ${TAG} release failed with HTTP ${created.status}`);
|
||||
}
|
||||
release = await created.json();
|
||||
} else {
|
||||
throw new Error(`Looking up the ${TAG} release failed with HTTP ${lookup.status}`);
|
||||
}
|
||||
|
||||
const listed = await call(`/releases/${release.id}/assets`);
|
||||
if (!listed.ok) {
|
||||
throw new Error(`Listing release assets failed with HTTP ${listed.status}`);
|
||||
}
|
||||
const assets = await listed.json();
|
||||
|
||||
for (const name of FILES) {
|
||||
// Gitea cannot replace an asset in place, so the old one is removed
|
||||
// first. The README link is unavailable for those few seconds.
|
||||
for (const asset of assets.filter((candidate) => candidate.name === name)) {
|
||||
const removed = await call(`/releases/${release.id}/assets/${asset.id}`, { method: "DELETE" });
|
||||
if (!removed.ok && removed.status !== 404) {
|
||||
throw new Error(`Deleting the previous ${name} failed with HTTP ${removed.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
const attachment = new FormData();
|
||||
attachment.set("attachment", new Blob([await readFile(`${outputDir}/${name}`)]), name);
|
||||
const uploaded = await call(`/releases/${release.id}/assets?name=${encodeURIComponent(name)}`, {
|
||||
method: "POST",
|
||||
body: attachment,
|
||||
});
|
||||
if (!uploaded.ok) {
|
||||
throw new Error(`Uploading ${name} failed with HTTP ${uploaded.status}`);
|
||||
}
|
||||
console.log(`Published ${name} to the ${TAG} release`);
|
||||
}
|
||||
NODE
|
||||
@@ -1,7 +1,6 @@
|
||||
name: SDK Codegen Drift
|
||||
|
||||
# Gitea variant of .github/workflows/sdk-codegen.yml. Re-runs the
|
||||
# @hivegrid/api-client-ts generation pipeline on PRs that touch the
|
||||
# Re-runs the @hivegrid/api-client-ts generation pipeline on PRs that touch the
|
||||
# upstream OpenAPI surface or the SDK package, then verifies the
|
||||
# committed src/generated/ tree is in sync with openapi.json.
|
||||
#
|
||||
@@ -36,19 +35,27 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout PR head
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Persist Node.js toolchain
|
||||
run: bash scripts/ci/persist-node-toolchain.sh
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
run: corepack enable --install-directory /usr/local/bin
|
||||
|
||||
- name: Prepare pnpm 10.33.0
|
||||
run: corepack prepare pnpm@10.33.0 --activate
|
||||
- name: Prepare pnpm 11.12.0
|
||||
run: corepack prepare pnpm@11.12.0 --activate
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir .pnpm-store
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: .pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
|
||||
Reference in new issue
Block a user