mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
134 lines
3.4 KiB
YAML
134 lines
3.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
certs:
|
|
name: Certificates
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup SSL using mkcert
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y mkcert libnss3-tools
|
|
mkdir -p certs
|
|
mkcert -install
|
|
mkcert localhost 127.0.0.1 ::1 -cert-file certs/localhost.pem -key-file certs/localhost-key.pem
|
|
|
|
frontend:
|
|
name: Frontend CI
|
|
runs-on: ubuntu-latest
|
|
needs: certs
|
|
defaults:
|
|
run:
|
|
working-directory: ./frontend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Create .env from example
|
|
run: cp ../.env.example ../.env
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
- name: Code Quality (Biome)
|
|
run: bun run check
|
|
- name: Type Check & Build
|
|
run: bun run build
|
|
- name: Run Unit Tests
|
|
run: bun run test
|
|
|
|
backend:
|
|
name: Backend CI
|
|
runs-on: ubuntu-latest
|
|
needs: certs
|
|
defaults:
|
|
run:
|
|
working-directory: ./backend
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_DB: piku
|
|
POSTGRES_USER: user
|
|
POSTGRES_PASSWORD: password123
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 # wait till up before starting (integrating) django app
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Create .env from example
|
|
run: cp ../.env.example ../.env
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
version: "latest"
|
|
enable-cache: true
|
|
cache-dependency-glob: backend/uv.lock
|
|
- name: Install dependencies
|
|
run: uv sync
|
|
- name: Lint (Ruff)
|
|
run: uv run ruff check
|
|
- name: Run Tests
|
|
run: uv run python manage.py test
|
|
|
|
e2e:
|
|
name: E2E Tests
|
|
runs-on: ubuntu-latest
|
|
needs: certs
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_DB: piku_e2e
|
|
POSTGRES_USER: piku_test
|
|
POSTGRES_PASSWORD: piku_test
|
|
ports:
|
|
- 5433:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
mailpit:
|
|
image: axllent/mailpit:latest
|
|
ports:
|
|
- 8025:8025
|
|
- 1025:1025
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
version: "latest"
|
|
enable-cache: true
|
|
cache-dependency-glob: backend/uv.lock
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install Frontend dependencies
|
|
run: cd frontend && bun install
|
|
|
|
- name: Install Playwright Browsers
|
|
run: cd frontend && bun x playwright install --with-deps
|
|
|
|
- name: Create .env.e2e
|
|
run: cp .env.e2e.example .env.e2e
|
|
|
|
- name: Run E2E Script
|
|
run: ./scripts/run-e2e.sh
|
|
env:
|
|
CI: "true"
|
|
|
|
- name: Upload Playwright Report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: frontend/playwright-report/
|
|
retention-days: 10
|