61 lines
1.3 KiB
YAML
61 lines
1.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: randomayzer
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
env:
|
|
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/randomayzer?schema=public"
|
|
STORAGE_DRIVER: "memory"
|
|
NODE_ENV: "test"
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Generate Prisma Client
|
|
run: npx prisma generate
|
|
|
|
- name: Push Database Schema
|
|
run: npx prisma db push
|
|
|
|
- name: Run Unit & Integration Tests
|
|
run: npm test
|
|
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
- name: Run Production Build
|
|
run: npm run build
|
|
env:
|
|
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/randomayzer?schema=public"
|