echos-ocr/.github/workflows/preview-smoke.yml
Randall Stillwell 9c1aaaa61f Bootstrap agent-context pipeline (L1 + L2 + L3)
Installs a 3-layer Cursor-aligned agent pipeline so future agent
sessions can orient quickly and stay inside guard rails:

L1 — context for any agent reading the repo:
  - AGENTS.md (top-level orientation, conventions, no-go zones)
  - .cursor/rules/ (no-go-zones, api-routes, prisma, prisma-schema-map)
  - .cursor/skills/ (add-api-route, add-prisma-model)
  - docs/SCHEMA_MAP.md generated from prisma/schema.prisma
  - scripts/generate-schema-map.ts (regenerate the map; wired up as
    `npm run schema:map`)

L2 — subagent roles for the 9-stage idea-to-feature pipeline:
  - .cursor/agents/role-*.md (conductor, architect, ia-architect,
    design-system-auditor, implementer, reviewer, ux-reviewer,
    a11y-auditor, doc-writer) with explicit multitask annotations.

L3 — pipeline scaffolding:
  - .github/CODEOWNERS, PR template, and CI workflows (ci.yml,
    preview-smoke.yml, visual-diff.yml, pr-health-rollup.yml).
    Test job is intentionally disabled until Playwright is wired up.
  - .convoys/ folder for per-feature run notes + scripts/log-convoy-event.sh.
  - scripts/wt.sh worktree helper.
  - src/lib/flags/index.ts simple env-driven feature flag wrapper.
  - tests/smoke/app.smoke.spec.ts (Playwright smoke; excluded from
    tsc until @playwright/test is installed — see tsconfig change).

Also writes .agent-context-manifest.yml so the sync-agent-context
skill can detect drift and offer selective updates from upstream.

Follow-ups (not in this commit):
  - Install @playwright/test and re-enable the test job in ci.yml.
  - Review .cursor/agents/role-*.md and trim any roles that don't
    apply to this codebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 14:55:18 -05:00

79 lines
2.5 KiB
YAML

name: Preview smoke
on:
pull_request:
branches: [main]
types: [labeled, opened, synchronize, reopened]
# Only run when:
# - The PR has the 'preview-ready' label, OR
# - The PR body / commits do not contain 'pipeline:.*skip.*smoke'
#
# Skip semantics: convoy-classified docs/infra/config-only PRs add 'skip: smoke'
# to the body and this job no-ops via the gate step below.
concurrency:
group: preview-smoke-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
gate:
name: Should run?
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- name: Decide
id: check
run: |
if echo "${{ github.event.pull_request.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: ubuntu-latest
timeout-minutes: 15
env:
# Set this in repo secrets/vars to your preview URL pattern, e.g.
# https://pr-${{ github.event.pull_request.number }}.preview.example.com
PREVIEW_URL: ${{ vars.PREVIEW_URL_PATTERN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Wait for preview to respond
run: |
PREVIEW="${PREVIEW_URL//\$\{PR\}/${{ github.event.pull_request.number }}}"
for i in {1..30}; do
if curl -fsS "$PREVIEW" > /dev/null; then
echo "Preview ready at $PREVIEW"
echo "PREVIEW_RESOLVED=$PREVIEW" >> $GITHUB_ENV
exit 0
fi
echo "Waiting for preview ($i/30)..."
sleep 10
done
echo "::error::Preview never responded at $PREVIEW"
exit 1
- name: Run smoke tests
run: npx playwright test --project=smoke
env:
BASE_URL: ${{ env.PREVIEW_RESOLVED }}
- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7