Files
ZitPlane/.gitea/workflows/p05-ci.yml
T

149 lines
5.6 KiB
YAML

name: ZitPlane P05 CI Verification
# Manual only. Docker socket is accessible to CI; do not enable untrusted PR triggers.
on:
workflow_dispatch:
permissions:
contents: read
jobs:
account:
name: Account Portal reproducible build
runs-on: ubuntu-latest
container: node:22-bookworm
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
github-server-url: https://dev.ivib.cc
- name: Preflight source, npm lock and OIDC guard contracts
run: |
set -eu
node --version
npm --version
python3 --version
python3 tests/ci/source_contract.py
- name: Account Portal npm ci, TypeScript and Next.js build
working-directory: users/ui
run: |
set -eu
npm ci --no-audit --no-fund
npm run typecheck
npm run build
echo ZITPLANE_ACCOUNT_BUILD_PASS
login:
name: Upstream Login V2 frozen workspace build
runs-on: ubuntu-latest
container: node:22-bookworm
timeout-minutes: 45
env:
NX_NO_CLOUD: "true"
NX_DAEMON: "false"
CI: "true"
steps:
- uses: actions/checkout@v4
with:
github-server-url: https://dev.ivib.cc
- name: Prepare pinned pnpm and frozen workspace
working-directory: auth/ui/v2
run: |
set -eu
corepack enable
corepack prepare pnpm@10.30.3 --activate
pnpm --version
pnpm install --frozen-lockfile
echo ZITPLANE_LOGIN_FROZEN_INSTALL_PASS
- name: Build ZITADEL proto, client and Login V2
working-directory: auth/ui/v2
run: |
set -eu
# Upstream build expects a transient .env to remove from standalone output.
# No real token or credential is injected; source snapshots are untouched.
: > apps/login/.env
trap 'rm -f apps/login/.env' EXIT
pnpm exec nx run @zitadel/login:build --skip-nx-cache
test -f apps/login/.next/standalone/apps/login/server.js
echo ZITPLANE_LOGIN_BUILD_PASS
- name: Run upstream Login V2 unit suite
working-directory: auth/ui/v2
run: |
set -eu
pnpm --filter @zitadel/login run test-unit
echo ZITPLANE_LOGIN_UNIT_PASS
security:
name: Account and Login dependency security triage
runs-on: ubuntu-latest
container: node:22-bookworm
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
github-server-url: https://dev.ivib.cc
- name: Account production dependency advisories (high and critical)
working-directory: users/ui
run: |
set -eu
npm audit --omit=dev --audit-level=high
echo ZITPLANE_ACCOUNT_ADVISORY_GATE_PASS
- name: Login workspace production dependency advisories (high and critical)
working-directory: auth/ui/v2
run: |
set -eu
corepack enable
corepack prepare pnpm@10.30.3 --activate
pnpm audit --prod --audit-level high
echo ZITPLANE_LOGIN_ADVISORY_GATE_PASS
backend:
name: Disposable ZITADEL Docker and OIDC discovery
runs-on: ubuntu-latest
container: node:22-alpine
timeout-minutes: 35
steps:
- uses: actions/checkout@v4
with:
github-server-url: https://dev.ivib.cc
- name: Docker runner capability and prior backend contracts
run: |
set -eu
apk add --no-cache python3 docker-cli docker-cli-compose git
docker --version
docker compose version
docker info --format 'Docker driver={{.Driver}}'
python3 -m unittest discover -s tests -p test_backend_dev.py -v
# The P02 Compose has a literal network name and loopback port.
# Refuse to attach to an existing network belonging to a different run.
if docker network inspect zitplane-backend-dev-internal >/dev/null 2>&1; then
echo '::error::CI local network already exists; refusing to touch another stack'
exit 1
fi
echo ZITPLANE_DOCKER_PREFLIGHT_PASS
- name: Start disposable backend and verify OIDC discovery/JWKS
run: |
set -eu
project="zitplane-p05-${GITHUB_RUN_ID:-0}"
python3 core/backend/zitadel/dev.py init
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml config --quiet
# Cleanup is allowed only after the preflight confirmed the network was absent.
touch .p05-ci-started
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml up -d --wait
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml ps
docker run --rm --network zitplane-backend-dev-internal \
-e ZITPLANE_CI_PROXY=http://proxy \
python:3.12-alpine python -c "$(cat tests/ci/oidc_discovery.py)"
echo ZITPLANE_DOCKER_DISCOVERY_PASS
echo '::warning::OIDC interactive callback, MFA and Account Portal session E2E require a future disposable-client integration gate; NOT VERIFIED.'
- name: Always remove only P05 disposable Docker state
if: always()
run: |
set +e
if [ -f .p05-ci-started ] && [ -f .env ]; then
project="zitplane-p05-${GITHUB_RUN_ID:-0}"
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml down -v --remove-orphans
fi
rm -f .env .p05-ci-started
echo ZITPLANE_DISPOSABLE_CLEANUP_COMPLETE