90 lines
2.4 KiB
YAML
90 lines
2.4 KiB
YAML
name: CI Quality Gates
|
|
|
|
on:
|
|
push:
|
|
branches: [main, "codex/**"]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
quality-gates:
|
|
name: Lint, Typecheck, Unit Tests & Build
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
env:
|
|
POSTGRES_DB: portal_test
|
|
POSTGRES_USER: portal_test
|
|
POSTGRES_PASSWORD: portal_test_password
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js 24
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.34.5
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
shell: bash
|
|
run: |
|
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Lint check
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Unit and Integration Tests
|
|
env:
|
|
DATABASE_URL: postgres://portal_test:portal_test_password@localhost:5432/portal_test
|
|
run: pnpm test
|
|
|
|
- name: Next.js Production Build
|
|
env:
|
|
DATABASE_URL: postgres://portal_test:portal_test_password@localhost:5432/portal_test
|
|
BETTER_AUTH_SECRET: ci-testing-secret-key-32-characters-min
|
|
BETTER_AUTH_URL: http://localhost:3000
|
|
IMMICH_BASE_URL: http://localhost:2283
|
|
IMMICH_API_KEY: ci-test-immich-api-key
|
|
SMTP_HOST: localhost
|
|
SMTP_PORT: 587
|
|
SMTP_USER: portal@localhost
|
|
SMTP_PASSWORD: ci-password
|
|
SMTP_FROM: portal@localhost
|
|
LEGAL_IMPRINT_URL: https://example.com/imprint
|
|
LEGAL_PRIVACY_URL: https://example.com/privacy
|
|
LEGAL_TERMS_URL: https://example.com/terms
|
|
run: pnpm build
|
|
|
|
- name: Build Docker Container
|
|
run: docker build -t portal-app:ci .
|