Files
homebrewery-oidc/.gitea/workflows/ci.yml
T
dev-bot BotandClaude Sonnet 5.5 bbfebc0095
CI / App (npm ci + Build, ESLint, Stylelint, Jest) (pull_request) Successful in 1m47s
CI / Storage (mongo) (pull_request) Successful in 1m30s
CI / Storage (postgres) (pull_request) Successful in 1m3s
feat(storage): Compose-Profil postgres, CI-Matrix mongo/postgres, API-Smoke-Test, Doku
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-25 10:16:55 +00:00

101 lines
3.2 KiB
YAML

# Fork-CI für Pull Requests und main (Gitea #4, FLW-82).
# Nutzt ausschließlich die Upstream-npm-Skripte; die Upstream-CI unter .github/ und
# .circleci/ bleibt unverändert (Merges aus naturalcrit/homebrewery konfliktfrei).
# Läuft auf jedem Gitea act_runner mit dem Label ubuntu-latest.
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# package.json verlangt Node >=26.4.0 und npm >=10.8 <12; das Lockfile zieht das
# npm-Paket "node" ^26.13.0. Lokal verifiziert mit Node 26.13.1 / npm 11.20.0.
NODE_VERSION: 26.13.1
jobs:
app:
name: App (npm ci + Build, ESLint, Stylelint, Jest)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
package-manager-cache: false
# npm-Cache nur mit Repo-Variable CI_CACHE=true: Ist der Cache-Server des
# act_runner aus dem Job-Container nicht erreichbar, kostet jeder
# Cache-Schritt mehrere Minuten Timeout.
- uses: actions/cache@v6
if: vars.CI_CACHE == 'true'
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: npm-${{ runner.os }}-
# postinstall führt "npm run build" (vite build) aus, prüft also auch den Build.
- name: Abhängigkeiten und Build (npm ci)
run: npm ci --no-audit --no-fund
# Upstream hat derzeit nur Warnungen (keine Fehler); Warnungen brechen nicht ab.
- name: ESLint (npm run lint:dry)
run: npm run lint:dry
- name: Stylelint (npm run stylelint:dry)
run: npm run stylelint:dry
# Kommt ohne MongoDB aus (Mongoose wird in den Specs gemockt).
- name: Jest (npm test)
run: npm test
# Storage-Contract-Suite und API-Smoke gegen beide Backends (ADR 0002 §5, Gitea #7).
# Service-Container: act_runner startet sie im selben Docker-Netz, Hostname = Service-Name.
storage:
name: Storage (${{ matrix.backend }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
backend: [mongo, postgres]
services:
mongo:
image: mongo:8
postgres:
image: postgres:18
env:
POSTGRES_PASSWORD: hb-ci-only
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
HB_TEST_MONGODB_URI: ${{ matrix.backend == 'mongo' && 'mongodb://mongo:27017' || '' }}
HB_TEST_POSTGRES_URL: ${{ matrix.backend == 'postgres' && 'postgres://postgres:hb-ci-only@postgres:5432/postgres' || '' }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
package-manager-cache: false
- name: Abhängigkeiten und Build (npm ci)
run: npm ci --no-audit --no-fund
- name: Contract-Suite und API-Smoke (${{ matrix.backend }})
run: npx jest server/storage tests/fork --runInBand