diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index ba165286..e97b18e6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -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 diff --git a/scripts/ci.sh b/scripts/ci.sh index fdfc1100..5349a5f3 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -7,7 +7,7 @@ # scripts/ci.sh --repeat 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_ (dropped at exit), so it can run next +# Every run uses its own database peppa_test_ci_ or $PEPPA_TEST_DB (dropped at exit), so it can run next # to other worktrees' suites. Logs of --pr runs: ~/.peppa/ci/.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() { #