Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 283417fe24 |
+56
-56
@@ -6,13 +6,6 @@ on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
# WHY?: services are executed way before the env can be sourced from .env file
|
||||
# NOTE: still inlining these values because of gitea misbehaving with env loads
|
||||
DB_NAME: piku_test_db
|
||||
DB_USER: test
|
||||
DB_PASSWORD: password123
|
||||
|
||||
jobs:
|
||||
setup-environment:
|
||||
name: Generate Certificates
|
||||
@@ -33,6 +26,62 @@ jobs:
|
||||
path: certs/
|
||||
retention-days: 1
|
||||
|
||||
backend:
|
||||
name: Backend CI
|
||||
runs-on: ubuntu-latest
|
||||
needs: setup-environment
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_DB: piku_test
|
||||
POSTGRES_USER: test
|
||||
POSTGRES_PASSWORD: password123
|
||||
# WHY?: gitea act runner seems to persist volumes (veryyy stubborn -_-)
|
||||
# Redirecting PGDATA to /tmp ensures a fresh init every run.
|
||||
PGDATA: /tmp/pgdata
|
||||
ports:
|
||||
- 5442:5432
|
||||
options: --tmpfs /var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./backend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "backend/uv.lock"
|
||||
|
||||
- name: Restore certificates
|
||||
uses: christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
path: certs/
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
cp ../.env.example ../.env
|
||||
uv sync
|
||||
if [ "$GITEA_ACTIONS" = "true" ]; then
|
||||
export DB_HOST="postgres"
|
||||
export DB_PORT="5432"
|
||||
else
|
||||
export DB_HOST="127.0.0.1"
|
||||
export DB_PORT="5442"
|
||||
fi
|
||||
export DB_PASSWORD='password123'
|
||||
export DB_NAME="piku_test"
|
||||
export DB_USER="test"
|
||||
|
||||
- name: Lint & Test
|
||||
run: |
|
||||
|
||||
|
||||
uv run ruff check
|
||||
uv run python manage.py test
|
||||
|
||||
frontend:
|
||||
name: Frontend CI
|
||||
runs-on: ubuntu-latest
|
||||
@@ -64,55 +113,6 @@ jobs:
|
||||
- name: Unit Tests
|
||||
run: bun run test
|
||||
|
||||
backend:
|
||||
name: Backend CI
|
||||
runs-on: ubuntu-latest
|
||||
needs: setup-environment
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_DB: piku_test_db
|
||||
POSTGRES_USER: test
|
||||
POSTGRES_PASSWORD: password123
|
||||
ports:
|
||||
- 5442:5432
|
||||
options: --tmpfs /var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./backend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "backend/uv.lock"
|
||||
|
||||
- name: Restore certificates
|
||||
uses: christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
name: ssl-certs
|
||||
path: certs/
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
cp ../.env.example ../.env
|
||||
uv sync
|
||||
|
||||
- name: Lint & Test
|
||||
run: |
|
||||
if [ "$GITEA_ACTIONS" = "true" ]; then
|
||||
export DB_HOST="postgres"
|
||||
export DB_PORT="5432"
|
||||
else
|
||||
export DB_HOST="127.0.0.1"
|
||||
export DB_PORT="5442"
|
||||
fi
|
||||
|
||||
uv run ruff check
|
||||
uv run python manage.py test
|
||||
|
||||
e2e:
|
||||
name: E2E Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user