100 lines
2.7 KiB
YAML
100 lines
2.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
pull_request:
|
|
|
|
jobs:
|
|
frontend:
|
|
name: Frontend Build + Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- name: Install frontend dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint frontend
|
|
run: npm run lint
|
|
|
|
- name: Build frontend
|
|
run: npm run build
|
|
|
|
backend:
|
|
name: Backend Build + Test + Prisma Checks
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: proxpanel
|
|
POSTGRES_PASSWORD: proxpanel
|
|
POSTGRES_DB: proxpanel
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U proxpanel -d proxpanel"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
DATABASE_URL: postgresql://proxpanel:proxpanel@localhost:5432/proxpanel?schema=public
|
|
SHADOW_DATABASE_URL: postgresql://proxpanel:proxpanel@localhost:5432/proxpanel_shadow?schema=public
|
|
JWT_SECRET: ci_super_secret_key_for_testing_12345
|
|
JWT_REFRESH_SECRET: ci_super_refresh_secret_key_67890
|
|
CORS_ORIGIN: http://localhost:5173
|
|
NODE_ENV: test
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
cache-dependency-path: backend/package-lock.json
|
|
|
|
- name: Install backend dependencies
|
|
working-directory: backend
|
|
run: npm ci
|
|
|
|
- name: Prepare shadow database
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y postgresql-client
|
|
PGPASSWORD=proxpanel psql -h localhost -U proxpanel -d proxpanel -c 'CREATE DATABASE proxpanel_shadow;'
|
|
|
|
- name: Prisma generate
|
|
working-directory: backend
|
|
run: npm run prisma:generate
|
|
|
|
- name: Prisma validate
|
|
working-directory: backend
|
|
run: npm run prisma:validate
|
|
|
|
- name: Prisma migrate deploy
|
|
working-directory: backend
|
|
run: npm run prisma:deploy
|
|
|
|
- name: Prisma migration drift check
|
|
working-directory: backend
|
|
run: npx prisma migrate diff --from-migrations prisma/migrations --to-schema-datamodel prisma/schema.prisma --shadow-database-url "$SHADOW_DATABASE_URL" --exit-code
|
|
|
|
- name: Build backend
|
|
working-directory: backend
|
|
run: npm run build
|
|
|
|
- name: Run backend tests
|
|
working-directory: backend
|
|
run: npm run test
|