Files
lunch/.github/workflows/ci.yml
T
Kai BöhmandClaude Opus 5.5 f8e2a11d39
ci / olares chart · sanity (pull_request) Successful in 3s
ci / app · types + tests + build (pull_request) Successful in 3m12s
markt / eintrag (pull_request) Successful in 19s
release / which version (pull_request) Successful in 3s
release / olares chart · sanity (pull_request) Successful in 3s
release / app (pull_request) Successful in 51s
release / tag and release (pull_request) Skipped
ci / oberfläche · Browser am iPhone (pull_request) Failing after 10m59s
Seed: ingredients, starter dishes, store layouts; browser tests (26.11.5)
340 canonical ingredients in four languages with base unit, category,
freshness, pack sizes and pantry default; 15 German and 15 British family
classics with per-portion amounts; aisle orders for REWE, EDEKA, Lidl,
ALDI and a generic store. scripts/seed.mjs upserts them after every
migration with ids derived from the key, so household data and backups
keep pointing at the same ingredients. Households adopt copies
(lib/starter.ts, lib/stores.ts). tests/seed.test.ts checks the files.

Playwright joins CI (job oberflaeche): the family flow on an iPhone with a
virtual passkey, and a walk over every page on iPhone light, dark and
desktop checking overflow, 44 px targets, axe and script errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUc2nv7rJVU2gp3Bgtha3q
2026-11-06 20:36:23 +00:00

196 lines
6.9 KiB
YAML

name: ci
on:
pull_request:
branches: [main]
# Nachts alles auf main. Gestaffelt mit den anderen Apps auf dem einen
# Runner (Relay 05:30, Rocket 06:00, Insilo 06:30 MESZ): Lunch 07:00 MESZ.
# Der Cron ist UTC.
schedule:
- cron: "0 5 * * *"
workflow_dispatch:
# Ein neuer Push in einen PR ersetzt seinen älteren Lauf.
concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
chart:
name: olares chart · sanity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# get.helm.sh ist vom Gitea-Runner nicht erreichbar: Helm liegt als
# Release-Anhang in aimighty/ci-tools, get.helm.sh bleibt Rückfall.
- name: install helm 3.16.2
run: |
for url in \
"https://git.aimighty.olares.de/aimighty/ci-tools/releases/download/helm-3.16.2/helm-v3.16.2-linux-amd64.tar.gz" \
"https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz"; do
echo "hole $url"
if curl -fsSL --retry 3 --retry-all-errors --max-time 180 -o /tmp/helm.tgz "$url" \
&& tar -tzf /tmp/helm.tgz >/dev/null 2>&1; then
break
fi
done
tar -C /tmp -xzf /tmp/helm.tgz
install -m 0755 /tmp/linux-amd64/helm /usr/local/bin/helm
helm version --short
- name: codified Olares lessons (scripts/check-chart.sh)
run: bash scripts/check-chart.sh
app:
name: app · types + tests + build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
# Kein ports: — auf Gitea läuft der Job in einem Container neben dem
# Dienst und erreicht ihn über dessen Namen (Muster aimighty/rocket).
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: database host
run: |
if getent hosts postgres >/dev/null 2>&1; then H=postgres; else H=localhost; fi
echo "PGHOST=$H" >> "$GITHUB_ENV"
echo "DB_HOST=$H" >> "$GITHUB_ENV"
echo "TEST_DATABASE_URL=postgres://lunch:lunch_dev_only@$H/lunch" >> "$GITHUB_ENV"
echo "Datenbank unter $H"
- name: psql
run: |
command -v psql >/dev/null && { psql --version; exit 0; }
SUDO=""; [ "$(id -u)" != "0" ] && command -v sudo >/dev/null && SUDO="sudo"
$SUDO apt-get update -qq
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq postgresql-client
psql --version
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: install
run: npm ci
- name: type-check
run: npm run type-check
# Wie auf der Box: Die Migrationen laufen mit der Rolle der App, die
# (createdb nur für die eigene Datenbank von tests/backup.test.ts)
# dadurch Eigentümerin der Tabellen wird — kein Superuser. Nur so prüft
# der Test mit zwei Haushalten, dass FORCE ROW LEVEL SECURITY greift.
- name: database and migrations
run: |
PGPASSWORD=postgres psql -U postgres -c "create role lunch login password 'lunch_dev_only' createdb;"
PGPASSWORD=postgres psql -U postgres -c "create database lunch owner lunch;"
DATABASE_URL="$TEST_DATABASE_URL" MIGRATE_ATTEMPTS=3 npm run migrate
# Ein zweiter Lauf darf nichts tun.
DATABASE_URL="$TEST_DATABASE_URL" MIGRATE_ATTEMPTS=3 npm run migrate
- name: unit and database tests
run: npm test
- name: build
run: npm run build
env:
NEXT_TELEMETRY_DISABLED: "1"
# Der Browser: Ablauf einer Familie am iPhone (einrichten, einladen, anmelden,
# Gerät, entfernen, Rückweg) und der Rundgang über jede Seite am iPhone hell
# und dunkel und am Desktop (Überbreite, Ziele unter 44 px, axe, Skriptfehler).
oberflaeche:
name: oberfläche · Browser am iPhone
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
NEXT_TELEMETRY_DISABLED: "1"
steps:
- uses: actions/checkout@v4
- name: database host
run: |
if getent hosts postgres >/dev/null 2>&1; then H=postgres; else H=localhost; fi
echo "PGHOST=$H" >> "$GITHUB_ENV"
echo "DATABASE_URL=postgres://lunch:lunch_dev_only@$H/lunch" >> "$GITHUB_ENV"
- name: psql
run: |
command -v psql >/dev/null && exit 0
SUDO=""; [ "$(id -u)" != "0" ] && command -v sudo >/dev/null && SUDO="sudo"
$SUDO apt-get update -qq
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq postgresql-client
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: install, migrate, build, start
run: |
npm ci
PGPASSWORD=postgres psql -U postgres -c "create role lunch login password 'lunch_dev_only';"
PGPASSWORD=postgres psql -U postgres -c "create database lunch owner lunch;"
MIGRATE_ATTEMPTS=3 npm run migrate
npm run build
cp -r public .next/standalone/ && cp -r .next/static .next/standalone/.next/
mkdir -p "$RUNNER_TEMP/lunchdaten"
echo "LUNCH_DATA=$RUNNER_TEMP/lunchdaten" >> "$GITHUB_ENV"
(cd .next/standalone && PORT=3020 BACKUP_DISABLED=1 APP_DATA_DIR="$RUNNER_TEMP/lunchdaten" \
nohup node server.js > "$RUNNER_TEMP/server.log" 2>&1 &)
for i in $(seq 30); do curl -sf localhost:3020/api/ready && break; sleep 1; done
# Der Browser im Zwischenspeicher, Schlüssel ist die Version aus dem
# Lockfile. --with-deps ist auf Gitea Pflicht (Muster aimighty/rocket).
- name: playwright version
id: pw
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}
- name: install browser
timeout-minutes: 15
run: npx playwright install --with-deps chromium
- name: browser tests
run: npx playwright test
env:
LUNCH_URL: http://localhost:3020
- name: server log on failure
if: failure()
run: tail -80 "$RUNNER_TEMP/server.log" || true
- uses: actions/upload-artifact@v4
if: failure()
with:
name: browser-report
path: |
e2e-bericht
test-results
retention-days: 7