PEP-22: CI job uses host Postgres with a per-run database, installs openspec

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Асель 2026-11-13 14:34:04 +05:00
parent 8fee68f8eb
commit 961cb558a4
2 changed files with 10 additions and 13 deletions

View File

@ -1,6 +1,6 @@
# CI for Peppa itself (PEP-22): typecheck, web build and the e2e suite on mocks — the same
# scripts/ci.sh that runs locally. Runs on Peppa's act_runner (`peppa-trusted`, registered for
# peppa-bot's repos, PEP-57); Postgres is a throwaway service container, tmux is installed in the job.
# peppa-bot's repos, PEP-57); tmux and the openspec CLI are installed in the job.
name: peppa-ci
on:
pull_request:
@ -12,14 +12,11 @@ jobs:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: peppa-trusted
timeout-minutes: 30
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: peppa
POSTGRES_PASSWORD: peppa
env:
PEPPA_TEST_PG: postgres://peppa:peppa@postgres:5432
# Peppa's Postgres on the host, a database per run (dropped by ci.sh). A service container
# doesn't isolate here: every job shares the traefik_default network and its `postgres` alias.
PEPPA_TEST_PG: postgres://peppa:peppa@host.docker.internal:5433
PEPPA_TEST_DB: peppa_test_ci_r${{ github.run_id }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@ -28,7 +25,7 @@ jobs:
- name: tools
run: |
apt-get update -qq && apt-get install -y -qq tmux >/dev/null
npm install -g pnpm@12.18.0 >/dev/null
npm install -g pnpm@12.18.0 @fission-ai/openspec@2.0.0 >/dev/null
- name: install
run: pnpm install --frozen-lockfile
- name: ci

View File

@ -7,7 +7,7 @@
# scripts/ci.sh --repeat <N> run the e2e suite N times in a row (flake hunting)
# scripts/ci.sh --skip-build skip `next build`
#
# Every run uses its own database peppa_test_ci_<pid> (dropped at exit), so it can run next
# Every run uses its own database peppa_test_ci_<pid> or $PEPPA_TEST_DB (dropped at exit), so it can run next
# to other worktrees' suites. Logs of --pr runs: ~/.peppa/ci/<sha>.log.
set -uo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
@ -57,9 +57,9 @@ if [ -n "$PR" ]; then
fi
cd "$ROOT"
DB="peppa_test_ci_$$"
# A CI job's Postgres (PEPPA_TEST_PG) is a throwaway service container: nothing to drop there.
cleanup() { [ -n "${PEPPA_TEST_PG:-}" ] || docker exec peppa-postgres dropdb -U peppa --if-exists "$DB" >/dev/null 2>&1; }
# The Actions job passes PEPPA_TEST_DB per run: pids inside job containers repeat.
DB="${PEPPA_TEST_DB:-peppa_test_ci_$$}"
cleanup() { docker exec peppa-postgres dropdb -U peppa --if-exists "$DB" >/dev/null 2>&1; }
trap cleanup EXIT
step() { # <name> <command...>