806 lines
29 KiB
YAML
806 lines
29 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
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
|
|
# lighter static gates spread evenly. Every required command still runs exactly once
|
|
# across both jobs and keeps its canonical relative order WITHIN its owning job.
|
|
verify-1:
|
|
name: Quality Static Verify (1/2)
|
|
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: Verify immutable action pins
|
|
run: pnpm run verify:action-pins
|
|
|
|
- name: Verify Gitea CI workflow
|
|
run: pnpm run verify:gitea-ci-workflow
|
|
|
|
- name: Verify Gitea deploy workflow
|
|
run: pnpm run verify:deploy-workflow
|
|
|
|
- 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
|
|
|
|
- name: Verify Docker non-root runtime
|
|
run: pnpm run verify:docker-non-root
|
|
|
|
- name: Verify CI baseline
|
|
run: pnpm run verify:ci-baseline
|
|
|
|
- name: Verify source health
|
|
run: pnpm run verify:source-health
|
|
|
|
- name: Verify ESLint baseline
|
|
run: pnpm run verify:eslint-baseline
|
|
|
|
- name: Verify env drift
|
|
run: pnpm run verify:env-drift
|
|
|
|
- name: Verify health baseline
|
|
run: pnpm run verify:health-baseline
|
|
|
|
- name: Verify API inventory
|
|
run: pnpm run verify:api-inventory
|
|
|
|
- name: Verify UI mock static baseline
|
|
run: pnpm run verify:ui-visual
|
|
|
|
- name: Test UI mock hot-swap
|
|
run: pnpm run test:hot-swap
|
|
|
|
verify-2:
|
|
name: Quality Static Verify (2/2)
|
|
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: Verify tenant isolation report
|
|
run: pnpm run verify:tenant-isolation-report
|
|
|
|
- name: Verify tenant-scope manifest and lifecycle registries
|
|
run: pnpm run verify:cross-cutting-models
|
|
|
|
- name: Verify sidebar routes
|
|
run: pnpm run verify:sidebar-routes
|
|
|
|
- name: Verify i18n keys
|
|
run: pnpm run verify:i18n
|
|
|
|
- name: Verify Tenant Auth tenant and onboarding gates
|
|
run: |
|
|
pnpm run verify:tenant-auth-baseline
|
|
pnpm run verify:onboarding-flow
|
|
|
|
- name: Verify Phase C package boundaries
|
|
run: pnpm run verify:phase-c-boundaries
|
|
|
|
- name: Verify removed modules
|
|
run: pnpm run verify:removed-modules
|
|
|
|
- name: Verify accessibility coverage
|
|
run: pnpm run verify:a11y-coverage
|
|
|
|
- name: Test accessibility smoke
|
|
run: pnpm run test:a11y
|
|
|
|
- name: Verify documentation gates
|
|
run: pnpm run verify:docs-links
|
|
|
|
typecheck-test:
|
|
name: Quality Typecheck and Tests
|
|
runs-on: toolctrl-ci
|
|
timeout-minutes: 25
|
|
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: Run parallel quality groups
|
|
run: bash scripts/ci/run-quality-groups.sh
|
|
|
|
build:
|
|
name: Quality Build and Bundle
|
|
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 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: Verify Feature Manifest core without plugins
|
|
run: pnpm run verify:core-build-without-plugins-smoke
|
|
|
|
- name: Build
|
|
env:
|
|
HIVEGRID_BUILD_SOURCEMAPS: "1"
|
|
run: pnpm run build:ci
|
|
|
|
- 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-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@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
|
with:
|
|
name: web-client-sourcemaps
|
|
path: apps/web/build-sourcemaps
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
- name: Verify production seed artifact
|
|
run: pnpm run verify:production-seed-artifact
|
|
|
|
api:
|
|
name: API Service
|
|
runs-on: toolctrl-ci
|
|
timeout-minutes: 25
|
|
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: Verify OpenAPI security
|
|
run: pnpm run verify:openapi-security
|
|
|
|
- name: Typecheck API
|
|
run: pnpm --filter @hivegrid/api typecheck
|
|
|
|
- name: Test API
|
|
run: pnpm exec vitest run apps/api/src
|
|
|
|
- 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
|
|
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 MCP
|
|
run: pnpm --filter @hivegrid/mcp typecheck
|
|
|
|
- name: Test MCP
|
|
run: pnpm --filter @hivegrid/mcp test
|
|
|
|
- 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
|
|
timeout-minutes: 25
|
|
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 Worker
|
|
run: pnpm --filter @hivegrid/worker typecheck
|
|
|
|
- name: Test Worker
|
|
run: pnpm --filter @hivegrid/worker exec vitest run
|
|
|
|
- name: Verify workflow outbox native readiness
|
|
run: pnpm run verify:workflow-outbox-native
|
|
|
|
- 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
|
|
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: Generate database client
|
|
run: pnpm run db:generate
|
|
env:
|
|
DATABASE_URL: postgresql://hivegrid:hivegrid@localhost:5432/hivegrid?schema=public
|
|
|
|
- name: Setup Docker CLI
|
|
run: |
|
|
if ! command -v docker >/dev/null 2>&1; then
|
|
if ! command -v apt-get >/dev/null 2>&1 || [ "$(id -u)" != "0" ]; then
|
|
echo "Docker CLI 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
|
|
fi
|
|
|
|
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
|
|
env:
|
|
COOLIFY_STAGING_SSH_HOST: ${{ vars.COOLIFY_STAGING_SSH_HOST }}
|
|
COOLIFY_STAGING_SSH_USER: ${{ vars.COOLIFY_STAGING_SSH_USER }}
|
|
COOLIFY_STAGING_WEB_RESOURCE_UUID: ${{ vars.COOLIFY_STAGING_WEB_RESOURCE_UUID }}
|
|
COOLIFY_STAGING_SSH_KEY: ${{ secrets.COOLIFY_STAGING_SSH_KEY }}
|
|
|
|
- name: Test database package
|
|
run: pnpm --filter @hivegrid/db test
|