ci / olares chart · sanity (pull_request) Successful in 5s
ci / app · types + tests + build (pull_request) Successful in 3m54s
release / which version (pull_request) Successful in 1s
release / olares chart · sanity (pull_request) Successful in 3s
release / app (pull_request) Successful in 1m25s
release / tag and release (pull_request) Skipped
Next.js 15 with next-intl (de, en, fr, es; locale per person, no URL prefix), Tailwind v4 tokens for the warm palette with dark mode, a shadcn/ui button, Serwist service worker and PWA manifest with icons. One Postgres pool with withHousehold() setting app.household_id per transaction; the first migration creates households with FORCE ROW LEVEL SECURITY, and a two-household test checks the isolation as the table owner. scripts/migrate.mjs applies db/migrations once each with a checksum and retries until the database is reachable. Olares chart with one deployment (init: chown, migrate from the same image), ClusterIP service, entrance internal until the own sign-in exists, image path fixed in the template and tag from appVersion. scripts/check-chart.sh carries the rules from Rocket; CI runs it, type check, tests against Postgres and the build; release builds lunch-app, tags and attaches the chart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUc2nv7rJVU2gp3Bgtha3q
108 lines
3.6 KiB
YAML
108 lines
3.6 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
|
|
# 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';"
|
|
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"
|