59 lines
1.4 KiB
YAML
59 lines
1.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_DB: calendar_run_test
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres -d calendar_run_test"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: |
|
|
backend/package-lock.json
|
|
frontend/package-lock.json
|
|
|
|
- name: Backend — install, build, test
|
|
working-directory: backend
|
|
env:
|
|
NODE_ENV: test
|
|
DB_HOST: 127.0.0.1
|
|
DB_PORT: "5432"
|
|
DB_NAME: calendar_run_test
|
|
DB_USER: postgres
|
|
DB_PASSWORD: postgres
|
|
SESSION_SECRET: test-session-secret
|
|
TURNSTILE_BYPASS_TOKEN: mock-turnstile-token
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
npm run db:migrate
|
|
npm test
|
|
|
|
- name: Frontend — install, build
|
|
working-directory: frontend
|
|
run: |
|
|
npm ci
|
|
npm run build
|