-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (81 loc) · 2.62 KB
/
Copy pathci.yml
File metadata and controls
99 lines (81 loc) · 2.62 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
name: CI
on:
push:
pull_request:
workflow_dispatch:
env:
# Opt into Node.js 24 before the June 2, 2026 mandatory switch
# (actions/checkout@v4, actions/setup-python@v5, actions/cache@v4
# all run on Node.js 20 which will be blocked after that date)
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install ruff==0.15.12 mypy==1.14.1
- name: Make quant_platform importable
run: echo "PYTHONPATH=$GITHUB_WORKSPACE/.." >> "$GITHUB_ENV"
- name: Lint with ruff
continue-on-error: true
run: ruff check . --output-format=concise || true
- name: Type check with mypy
continue-on-error: true
run: mypy quant_platform/ --config-file=pyproject.toml
- name: Run tests
run: pytest tests/ -v --tb=short
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install and build frontend
working-directory: frontend
run: |
npm ci
npm run build
docker:
runs-on: ubuntu-latest
needs: [test, build-frontend]
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t quant-platform:latest .
- name: Verify container starts
run: |
docker run -d --name test-container -p 8000:8000 quant-platform:latest
# Retry health check up to 12 times (2 min total)
for i in $(seq 1 12); do
sleep 10
if curl -sf http://localhost:8000/api/health > /dev/null 2>&1; then
echo "Health check passed!"
docker stop test-container
exit 0
fi
echo "Attempt $i/12 — not ready yet..."
done
echo "Container logs:"
docker logs test-container 2>&1 || true
docker stop test-container || true
exit 1