# Tier 3 gate. Copy to .gitea/workflows/verify.yml in task 01.
#
# Known trap: this Gitea's act-runner registration lives in an emptyDir, so a
# pod restart silently kills CI. If the site stops updating, check the runner
# BEFORE debugging the workflow.
name: verify
on:
  push:
    branches: [main]
  pull_request:

jobs:
  gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 # gate.sh compares assertion counts against origin/main

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - run: npm ci --prefer-offline
      - run: npm run lint
      - run: ./.agents/scripts/gate.sh

      # Tier 3 only: too slow for pre-push, essential before publishing.
      - name: visual regression
        run: |
          npx playwright install --with-deps chromium
          node .agents/scripts/visual-regression.mjs

      - uses: actions/upload-artifact@v4
        if: failure()
        with:
          name: screenshots
          path: .agents/snapshots/diff/
