Closes the Phase 5 P2 checkbox (second half — first half: pino logging
in 1e64d75). Phase 5 is now fully green.
Two changes:
1. `web/e2e/hermes.spec.ts` now intercepts `/api/hermes/ops` with a
fixture snapshot. The backend's hermes-ops endpoint shells out to
`systemctl` / `git` / `ps` / `du` on the live VM and is therefore
neither available nor deterministic in CI. Mocking it lets the
suite run against the web stack alone (no backend, no live VM).
Fixture shape mirrors the Zod schema in
`backend/src/modules/hermes-ops/types.ts`.
2. `.gitea/workflows/ci.yml` re-enables the previously-commented-out
E2E step. Adds a preceding `playwright install --with-deps
chromium` step so the runner pulls the browser fresh per run.
The web suite starts its own Next dev server via Playwright's
`webServer` config (`pnpm exec next dev -p 3200`), so we do NOT
start the backend in CI — every backend route used by the suite
is mocked via `page.route` (auth, csrf, services, deployments,
health/cache, seed, hermes-ops).
Verified locally: `pnpm exec playwright test` → 6 passed in 19.5s
(2 hermes specs + 4 dashboard/login specs across desktop + mobile).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
115 lines
3.3 KiB
YAML
115 lines
3.3 KiB
YAML
name: CI — DevOps Dashboard
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'backend/**'
|
|
- 'web/**'
|
|
- 'shared/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'pnpm-workspace.yaml'
|
|
- '.pnpmfile.cjs'
|
|
- '.gitea/workflows/ci.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'backend/**'
|
|
- 'web/**'
|
|
- 'shared/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'pnpm-workspace.yaml'
|
|
- '.pnpmfile.cjs'
|
|
- '.gitea/workflows/ci.yml'
|
|
|
|
concurrency:
|
|
group: ci-devops-dashboard-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# Self-contained CI: resolve @bytelyst/* deps from the local Gitea registry
|
|
# rather than a sibling learning_ai_common_plat checkout on the runner.
|
|
BYTELYST_PACKAGE_SOURCE: gitea
|
|
|
|
jobs:
|
|
build-and-test:
|
|
name: Build, Test & Typecheck
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
# Check out into the runner workspace (${{ gitea.workspace }}) instead of
|
|
# cd-ing into a hard-coded host path and `git reset --hard` on the live
|
|
# checkout. CI must never mutate an operator's working tree.
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Enable pnpm
|
|
run: |
|
|
corepack enable
|
|
corepack prepare pnpm@10.6.5 --activate
|
|
|
|
- name: Secret scan
|
|
run: pnpm secret-scan
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install:gitea
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Unit tests
|
|
run: pnpm test:run
|
|
|
|
# Coverage gate for the backend's tested modules (auth, csrf, health,
|
|
# hermes-ops, deployments/orchestrator, services). Thresholds live in
|
|
# `backend/vitest.config.ts`. Add files there as they gain real tests
|
|
# — ratchet up, never relax.
|
|
- name: Coverage gate (backend)
|
|
run: pnpm --filter @bytelyst/devops-backend test:coverage
|
|
|
|
# Playwright browsers are pulled per-CI-run. The web suite (`pnpm
|
|
# test:e2e`) starts its own Next dev server via Playwright's
|
|
# `webServer` config; the backend is intentionally NOT started — the
|
|
# hermes spec intercepts `/api/hermes/ops` (which would otherwise
|
|
# need to shell out to systemctl/git/ps on a live VM) and the
|
|
# dashboard spec mocks every other backend route via `page.route`.
|
|
# See `docs/prompts/ci-e2e-hardening.md` for the design.
|
|
- name: Install Playwright browsers
|
|
run: pnpm --filter @bytelyst/devops-web exec playwright install --with-deps chromium
|
|
|
|
- name: E2E tests
|
|
run: pnpm --filter @bytelyst/devops-web test:e2e
|
|
|
|
docker-build:
|
|
name: Build Docker Images
|
|
runs-on: ubuntu-latest
|
|
needs: [build-and-test]
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build backend Docker image
|
|
run: docker build -f backend/Dockerfile -t devops-backend:latest .
|
|
|
|
- name: Build web Docker image
|
|
run: docker build -f web/Dockerfile -t devops-web:latest .
|
|
|
|
- name: Test Docker Compose
|
|
run: |
|
|
docker compose up -d
|
|
sleep 10
|
|
docker compose down
|