-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (99 loc) · 3.28 KB
/
Copy pathci.yml
File metadata and controls
110 lines (99 loc) · 3.28 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── Backend: lint + format + typecheck ───────────────────────────────
backend-lint:
name: "Backend · Lint & Format & Typecheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- run: uv run --only-group lint ruff check core/ api/ db/ tests/
- run: uv run --only-group lint ruff format --check core/ api/ db/ tests/
- run: uv sync --frozen --group lint --group test
- run: uv run pyright core/ api/ db/
# ── Backend: tests (with PostgreSQL) ─────────────────────────────────
backend-test:
name: "Backend · Tests"
runs-on: ubuntu-latest
needs: backend-lint
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: data_agent
POSTGRES_PASSWORD: data_agent
POSTGRES_DB: data_agent
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U data_agent"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql+asyncpg://data_agent:data_agent@localhost:5432/data_agent
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- run: uv sync --frozen --group test
- name: Check Alembic migration heads
run: uv run alembic heads | grep -c head | xargs test 1 -eq
- name: Apply Alembic migrations
run: uv run alembic upgrade head
- run: uv run pytest tests/ -v --tb=short
# ── Frontend: lint + typecheck + tests ───────────────────────────────
frontend-checks:
name: "Frontend · Lint & Typecheck & Tests"
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test
# ── Docker builds (parallel) ───────────────────────────────────────
docker-backend:
name: "Docker · Backend"
runs-on: ubuntu-latest
needs: backend-test
steps:
- uses: actions/checkout@v4
- run: docker build -t data-agent-backend:ci .
docker-sandbox:
name: "Docker · Sandbox"
runs-on: ubuntu-latest
needs: backend-test
steps:
- uses: actions/checkout@v4
- run: docker build -t data-agent-sandbox:ci sandbox/
docker-frontend:
name: "Docker · Frontend"
runs-on: ubuntu-latest
needs: frontend-checks
steps:
- uses: actions/checkout@v4
- run: >
docker build
--build-arg REWRITE_API_ORIGIN=http://backend:8000
-t data-agent-frontend:ci
frontend/