* convoy: migrate CI to self-hosted axiom runners (briefs 1+2) Moves 4 of 5 GitHub Actions workflows from `ubuntu-latest` to the new `stwl-labs` org-level self-hosted pool (CT 111 axiom-runner-1..4) and rewires the `migrate` job to use CT 102's shared Postgres via per-run databases. Changes: - ci.yml: lint, schema-map-fresh, forbidden-patterns, migrate, test -> `[self-hosted, axiom]`. migrate job drops `services.postgres` (saved ~30s/run of image pull) and switches to `HOMELAB_CI_POSTGRES_BASE_URL` secret + per-run DB (`ci_run_<run_id>_<run_attempt>`) with `always()` cleanup so failed migrations don't leak DBs. - preview-smoke.yml: gate + smoke -> self-hosted. Playwright browser cache lives under /opt/appdata/gha-runner/shared-cache/playwright on the host bind mount; first PR primes it, subsequent runs reuse. - visual-diff.yml: gate + visual -> self-hosted (same Playwright cache). - pr-health-rollup.yml: rollup -> self-hosted. - agent-context-drift.yml: deliberately LEFT on ubuntu-latest (D4 in convoy doc). Weekly cron stays GitHub-hosted so it runs even when axiom is down. Why on this side and not the runner side: - migrate adds an explicit `sudo apt-get install -y postgresql-client` step (~10s, amortized via apt-cache survival). The runner image doesn't ship psql; baking it in would require a custom image and doesn't earn its keep for one job. Repo prereqs (set before this PR opens): - `HOMELAB_CI_POSTGRES_BASE_URL` repo secret set (value pattern: `postgres://deckhearth_ci:<pw>@192.168.68.102:5432`) - `deckhearth_ci` Postgres user created on CT 102 with CREATEDB, no superuser - stwl-labs org Actions settings: "Require approval for all outside collaborators" + runner group rejects public repos - 4 runners online: `axiom-runner-1..4`, status Idle Follow-ups (per convoy): - Brief 3: forbidden-pattern gate to catch `runs-on: ubuntu-latest` re-introduction outside the agent-context-drift allowlist - Brief 4: AGENTS.md updates + 1-line revert path (D5) - Weekly cron on CT 102 to GC any `ci_run_*` DBs older than 7d (Risk #4 mitigation) Co-authored-by: Cursor <cursoragent@cursor.com> * fix(migrate): use PGHOST/PGUSER/PGPASSWORD instead of URL secret First Brief 1+2 validation run failed on the migrate job with `psql: invalid option -- '/'` despite the secret being set correctly and a direct CT-111 → CT-102 psql connection working fine. The URL-parse path in `psql "$PGBASE/postgres"` was the fragile bit. Splitting the connection into discrete `PG*` env vars (which psql picks up automatically) sidesteps URL parsing entirely. The `HOMELAB_CI_POSTGRES_BASE_URL` repo secret is now `HOMELAB_CI_POSTGRES_PASSWORD` — password only — and the workflow hardcodes the (non-sensitive) host/port/user. `node-pg-migrate` still reads `POSTGRES_URL` from `.env.local`, so we assemble that URL inline for it; the runner is ephemeral so the leaked-to-disk password is bounded to one job. Convoy doc updated to reflect the shipped approach + lesson learned in prerequisites. Co-authored-by: Cursor <cursoragent@cursor.com> * ci: trigger vercel preview after stwl-labs reauth Co-authored-by: Cursor <cursoragent@cursor.com> * ci: re-test playwright after vercel project rebind Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
148 lines
5.6 KiB
YAML
148 lines
5.6 KiB
YAML
name: Preview smoke
|
|
|
|
# Waits for Vercel's per-PR Preview deployment to be ready, then runs
|
|
# Playwright smoke against its URL.
|
|
#
|
|
# Vercel's GitHub integration auto-deploys every push and posts a Deployment
|
|
# to the GitHub API once ready. We wait on that Deployment so we always hit
|
|
# the canonical preview URL Vercel just published.
|
|
#
|
|
# REQUIRES: @playwright/test installed. Until then, this workflow will fail
|
|
# on `npx playwright install`. See .convoys/ for the testing convoy.
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
types: [labeled, opened, synchronize, reopened]
|
|
# Skip the heavy Playwright smoke on doc-only PRs. Same set as
|
|
# ci.yml's paths-ignore — see `slash-ci-minutes` convoy
|
|
# (2026-06-04). Code/style/UI PRs still trigger smoke normally.
|
|
paths-ignore:
|
|
- '.convoys/**'
|
|
- '**/*.md'
|
|
- 'docs/**'
|
|
- 'AGENTS.md'
|
|
- '.cursor/**'
|
|
- 'README.md'
|
|
|
|
concurrency:
|
|
group: preview-smoke-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
# Default workflow token is read-only on this repo. The `wait-for-vercel-preview`
|
|
# action needs `deployments: read` to query Vercel's GitHub Deployment status,
|
|
# plus `statuses: read` because some Vercel deployments use commit statuses
|
|
# instead of the Deployments API. `pull-requests: read` lets it correlate the
|
|
# deployment back to this PR. Without these, the action 403s on the Checks API
|
|
# and the smoke job fails before Playwright even starts.
|
|
permissions:
|
|
contents: read
|
|
deployments: read
|
|
pull-requests: read
|
|
statuses: read
|
|
|
|
jobs:
|
|
gate:
|
|
name: Should run?
|
|
runs-on: [self-hosted, axiom]
|
|
outputs:
|
|
should_run: ${{ steps.check.outputs.should_run }}
|
|
steps:
|
|
- name: Decide
|
|
id: check
|
|
env:
|
|
# Route PR body + fork flag through env vars instead of inline
|
|
# ${{ }} interpolation. Direct ${{ github.event.pull_request.body }}
|
|
# in a shell command pastes arbitrary user-controlled text (parens,
|
|
# backticks, pipes, heredocs) directly into the script — both a
|
|
# syntax-error risk AND a shell-injection vector. Quoting the env
|
|
# vars below makes both safe.
|
|
PR_BODY: ${{ github.event.pull_request.body }}
|
|
PR_IS_FORK: ${{ github.event.pull_request.head.repo.fork }}
|
|
run: |
|
|
if [[ "$PR_IS_FORK" == "true" ]]; then
|
|
echo "should_run=false" >> $GITHUB_OUTPUT
|
|
echo "::notice::Smoke skipped on fork PR (bypass secret unavailable to forks)"
|
|
elif echo "$PR_BODY" | grep -qE 'pipeline:.*skip.*\bsmoke\b'; then
|
|
echo "should_run=false" >> $GITHUB_OUTPUT
|
|
echo "::notice::Smoke skipped via pipeline directive"
|
|
else
|
|
echo "should_run=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
smoke:
|
|
name: Playwright smoke
|
|
needs: gate
|
|
if: needs.gate.outputs.should_run == 'true'
|
|
runs-on: [self-hosted, axiom]
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Wait for Vercel Preview deployment
|
|
id: vercel
|
|
uses: patrickedqvist/wait-for-vercel-preview@v1.3.2
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
max_timeout: 120
|
|
# NOTE: do NOT add `&x-vercel-set-bypass-cookie=true` here. Vercel
|
|
# responds to that with a 307 + Set-Cookie (`_vercel_jwt`), but
|
|
# axios in Node has no cookie jar — the cookie is dropped before
|
|
# the followup request, which then 401s. For this one-shot
|
|
# healthcheck the bare bypass query is enough; the cookie variant
|
|
# belongs in the future Playwright config where the browser does
|
|
# have a cookie jar.
|
|
path: /?x-vercel-protection-bypass=${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: npm
|
|
|
|
- name: Cache node_modules
|
|
id: cache-node-modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ runner.os }}-node20-${{ hashFiles('package-lock.json') }}
|
|
|
|
- run: npm ci
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
|
|
# Cache Playwright's browser binaries (~/.cache/ms-playwright) keyed
|
|
# by the resolved @playwright/test version in the lockfile. Saves
|
|
# ~15-25s/run of chromium download + system-deps install. Cache
|
|
# invalidates automatically on any Playwright version bump.
|
|
- name: Resolve Playwright version
|
|
id: pw-version
|
|
run: |
|
|
VERSION=$(node -p "require('./package-lock.json').packages['node_modules/@playwright/test'].version")
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
- name: Cache Playwright browsers
|
|
id: cache-playwright
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/ms-playwright
|
|
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}-chromium
|
|
|
|
- name: Install Playwright browsers
|
|
run: |
|
|
if [ "${{ steps.cache-playwright.outputs.cache-hit }}" = "true" ]; then
|
|
npx playwright install-deps chromium
|
|
else
|
|
npx playwright install --with-deps chromium
|
|
fi
|
|
|
|
- name: Run smoke tests
|
|
run: npx playwright test --project=smoke
|
|
env:
|
|
BASE_URL: ${{ steps.vercel.outputs.url }}
|
|
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
|
|
|
|
- name: Upload Playwright report on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report/
|
|
retention-days: 7
|