diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index fee9c99..ab17b8f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI (SIAX Cloud) # Self-hosted CI on SIAX Cloud (Gitea Actions, runners siax-runner-1/2). -# Blocking quality/security gate for the Next.js 16 web console + 0pt capability layer. +# Blocking quality/security + real-dependency gates for the 0pt capability layer. on: push: branches: ["**"] @@ -59,6 +59,17 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 60 + opt-ci-postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: opt_ci + POSTGRES_PASSWORD: ci_${{ github.run_id }}_${{ github.run_attempt }} + POSTGRES_DB: opt_ci + options: >- + --health-cmd "pg_isready -U opt_ci -d opt_ci || exit 1" + --health-interval 5s + --health-timeout 5s + --health-retries 30 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -95,6 +106,33 @@ jobs: [ -n "$FOUND" ] || { echo "FATAL: no ClickHouse behind the alias accepts this run's credentials"; exit 1; } echo "CLICKHOUSE_URL=http://$FOUND:8123" >> "$GITHUB_ENV" echo "CLICKHOUSE_AUTH=opt_ci:$PASS" >> "$GITHUB_ENV" + - name: Select THIS run's Postgres by run-unique credentials + run: | + set -eu + PASS="ci_${{ github.run_id }}_${{ github.run_attempt }}" + FOUND="" + for ip in $(getent ahostsv4 opt-ci-postgres | awk '{print $1}' | sort -u); do + if PG_CANDIDATE="postgres://opt_ci:$PASS@$ip:5432/opt_ci" node --input-type=module - <<'NODE' + import postgres from 'postgres'; + const sql = postgres(process.env.PG_CANDIDATE, { max: 1, connect_timeout: 3, onnotice: () => undefined }); + try { + const rows = await sql`SELECT current_user AS u, current_database() AS d`; + if (rows[0]?.u !== 'opt_ci' || rows[0]?.d !== 'opt_ci') process.exitCode = 2; + } catch { + process.exitCode = 1; + } finally { + await sql.end({ timeout: 1 }).catch(() => undefined); + } + NODE + then + FOUND="$ip" + break + fi + done + [ -n "$FOUND" ] || { echo "FATAL: no Postgres behind the alias accepts this run's credentials"; exit 1; } + URL="postgres://opt_ci:$PASS@$FOUND:5432/opt_ci" + echo "TEST_DATABASE_URL=$URL" >> "$GITHUB_ENV" + echo "DATASET_TEST_DATABASE_URL=$URL" >> "$GITHUB_ENV" - name: Integration tests against LIVE OpenSearch + ClickHouse (blocking) run: | set -eu @@ -103,6 +141,16 @@ jobs: if grep -qE "skipped" /tmp/itest.log && ! grep -qE "Tests [0-9]+ passed" /tmp/itest.log; then echo "FATAL: integration suites skipped instead of running"; exit 1 fi + - name: Durable AUD0 outbox against LIVE Postgres (blocking) + run: | + set -eu + [ -n "${TEST_DATABASE_URL:-}" ] + pnpm vitest run tests/p0/aud0-outbox-postgres.realinfra.test.ts + - name: Dataset registry + versions against LIVE Postgres (blocking) + run: | + set -eu + [ -n "${DATASET_TEST_DATABASE_URL:-}" ] + pnpm vitest run tests/p0/dataset-postgres.realinfra.test.ts security: runs-on: ubuntu-latest