-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (116 loc) · 3.56 KB
/
Copy pathnode.js.yml
File metadata and controls
137 lines (116 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI Pipeline
on:
workflow_dispatch:
push:
branches: [main, dev]
pull_request:
jobs:
# ----------------------------
# 1. Linting & Type Checks
# ----------------------------
lint-and-typecheck:
name: Run pre-commit (Ruff, mypy, format checks)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install backend deps
working-directory: backend
run: uv sync
# If your mypy hook needs src on sys.path, expose it here too
- name: Run pre-commit hooks
env:
PYTHONPATH: backend/src
run: |
pip install pre-commit
pre-commit run --all-files
# ----------------------------
# 2. Backend Tests (Python + PostGIS)
# ----------------------------
backend-tests:
name: Backend Tests
runs-on: ubuntu-latest
needs: lint-and-typecheck
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_DB: seatcheck
POSTGRES_USER: seatcheck
POSTGRES_PASSWORD: seatcheck
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U seatcheck -d seatcheck"
--health-interval=10s
--health-timeout=5s
--health-retries=10
env:
DATABASE_URL: postgresql+psycopg2://seatcheck:seatcheck@localhost:5432/seatcheck
DEV_AUTH: "1"
APP_BASE: "http://localhost:8081"
PYTHONPATH: backend/src
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install backend deps
working-directory: backend
run: uv sync
- name: Wait for PostgreSQL to be ready
run: |
for i in {1..30}; do
if pg_isready -h localhost -U seatcheck -d seatcheck 2>/dev/null; then
echo "PostgreSQL is ready"
exit 0
fi
echo "Waiting for PostgreSQL... ($i/30)"
sleep 1
done
echo "PostgreSQL did not become ready in time"
exit 1
- name: Run Alembic migrations
working-directory: backend
run: uv run alembic upgrade head
- name: Seed database
working-directory: backend
run: uv run python scripts/seed_db.py
- name: Run backend tests with coverage
working-directory: backend
run: uv run pytest --cov=app --cov-report=xml --cov-report=term-missing
# ----------------------------
# 3. Frontend Tests (Node.js)
# ----------------------------
frontend-tests:
name: Frontend Tests
runs-on: ubuntu-latest
needs: lint-and-typecheck
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: seat-check/package-lock.json
- name: Install dependencies
working-directory: seat-check
run: yarn install --frozen-lockfile
- name: Run frontend tests
working-directory: seat-check
env:
# So frontend code builds/tests against the same base as dev
EXPO_PUBLIC_API_BASE: "http://localhost:8000"
run: npm test -- --run