chore: v0.13.0 — CI pipeline (build → unit → e2e) on PRs to master + push, dind-isolated e2e stack (docker-compose.ci.yml), playwright config env-var overrides (PW_REMOTE_BROWSER/E2E_DEPLOY_CMD/E2E_BASE_URL/E2E_COMPOSE_ARGS, backward-compatible), @playwright/test pinned as devDependency; AGENTS.md switched to pull-request workflow
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: build + unit + e2e
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
docker:
|
||||
image: docker:dind
|
||||
ports:
|
||||
- "2375:2375"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Resolve the dind daemon endpoint up front (fail fast if the runner's dind is
|
||||
# misconfigured). Gitea Actions services are sibling containers on the job network,
|
||||
# reachable by service id; depending on runner config published ports may also land
|
||||
# on localhost — try both and export whichever answers. The app URL follows the same
|
||||
# endpoint: the flight container's port 3000 is published inside dind, so it is
|
||||
# reachable wherever the daemon itself is.
|
||||
- name: Resolve dind endpoint
|
||||
run: |
|
||||
for host in tcp://localhost:2375 tcp://docker:2375; do
|
||||
for i in $(seq 1 15); do
|
||||
if DOCKER_HOST="$host" docker version --format '{{.Server.Version}}' >/dev/null 2>&1; then
|
||||
echo "DOCKER_HOST=$host" >> "$GITHUB_ENV"
|
||||
case "$host" in
|
||||
*localhost*) echo "E2E_BASE_URL=http://localhost:3000" >> "$GITHUB_ENV" ;;
|
||||
*) echo "E2E_BASE_URL=http://docker:3000" >> "$GITHUB_ENV" ;;
|
||||
esac
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
done
|
||||
echo "::error::no reachable dind endpoint (tried tcp://localhost:2375 and tcp://docker:2375)" >&2
|
||||
exit 1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
# bun drives installs (repo ships bun.lock, no package-lock.json); pinned to the
|
||||
# same major as oven/bun in the Dockerfile.
|
||||
- name: Install bun
|
||||
run: npm i -g bun@1.4.2
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Unit tests
|
||||
run: npx vitest run
|
||||
|
||||
# Browsers run locally in CI (PW_REMOTE_BROWSER=0 below): the shared remote browser
|
||||
# server at 192.168.1.4 cannot reach a stack inside dind, and local chromium keeps
|
||||
# the job self-contained.
|
||||
- name: Install browsers (local)
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
# E2E against an isolated stack inside dind — never the production instance.
|
||||
# docker-compose.ci.yml mirrors docker-compose.yml minus Traefik; fresh named-volume
|
||||
# DB per run. E2E_DEPLOY_CMD makes the config's webServer block deploy + wait for
|
||||
# readiness; E2E_COMPOSE_ARGS points state.spec.ts' mid-run `docker compose restart
|
||||
# flight` at the same file. DOCKER_HOST/E2E_BASE_URL come from GITHUB_ENV above.
|
||||
- name: E2E (isolated stack in dind)
|
||||
env:
|
||||
PW_REMOTE_BROWSER: "0"
|
||||
E2E_DEPLOY_CMD: docker compose -f docker-compose.ci.yml up -d --build
|
||||
E2E_COMPOSE_ARGS: "-f docker-compose.ci.yml"
|
||||
run: npx playwright test
|
||||
Reference in New Issue
Block a user