Migration 0003 adds the concept's tables: dishes with ingredients, steps and translations, stores and aisles, rounds, wishes, slots, shopping items, pantry staples, receipts and lines, ingredient aliases, price points, ratings, kudos, helper points, achievements, plus global canonical ingredients (readable by all, writable only in migrations). Every household table carries household_id with FORCE RLS, and references inside a household are paired foreign keys so a row can never point at another household's data (E-0007). Roles follow the concept: admin, member, child, guest; households.created_by marks who set up (E-0008). The two-household test seeds every table for two households and reads each one against the other. lib/backup.ts writes a backup to /app/data/sicherungen after changes (checked every five minutes, at least every six hours, last 14 kept); an empty database offers it on /einrichten for restore with the setup code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUc2nv7rJVU2gp3Bgtha3q
109 lines
3.7 KiB
YAML
109 lines
3.7 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"
|