-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (168 loc) · 5.11 KB
/
Copy pathci.yml
File metadata and controls
177 lines (168 loc) · 5.11 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
permissions:
contents: read
jobs:
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install ruff
run: pip install ruff>=0.1
- name: Run ruff check
run: ruff check src tests
- name: Check formatting
run: ruff format --check src tests
typecheck:
name: Type check (mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install package + mypy
run: |
pip install -e ".[dev]"
- name: Run mypy
run: mypy src/chen || true # non-blocking for now; tighten once stable
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
# Skip macos-3.9 combination — setup-python sometimes fails there.
- os: macos-latest
python-version: "3.9"
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package (mock backend only)
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,server]"
- name: Run tests (fast only)
shell: bash
run: |
pytest -m "not slow and not gpu and not integration" \
--ignore=tests/integration \
--ignore=tests/benchmarks \
--cov=chen --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
test-examples:
name: Test example scripts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install package
run: |
pip install -e ".[dev,server]"
- name: Run Phase 1 example
run: python examples/run_phase1.py --backend mock
- name: Run Phase 2 example
run: python examples/run_phase2.py
- name: Run Phase 3 example
run: python examples/run_phase3.py --router logistic
- name: Run benchmarks example
shell: bash
run: python examples/run_benchmarks.py --phase 1 || true # exit code 1 if targets not met
- name: Run CLI info command
run: chen info
- name: Run CLI run command
run: chen run --prompt "Explain recursion." --phase 1 --backend mock
- name: Run CLI bench command
run: chen bench --phase 1
- name: Run integration tests (server)
run: pytest tests/integration/ -m integration
integration:
name: Integration tests (server)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install package with server extra
run: |
pip install --upgrade pip
pip install -e ".[dev,server]"
- name: Run integration tests
run: pytest tests/integration/ -m integration -v
- name: Run property-based tests
run: pytest tests/property/ -v
build:
name: Build package
runs-on: ubuntu-latest
needs: [lint, test, integration]
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install build tools
run: |
pip install --upgrade pip
pip install build
- name: Build sdist + wheel
run: python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v5
with:
name: dist
path: dist/
docker-build:
name: Build Docker image
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image (no push)
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: false
tags: chen:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test the image
shell: bash
run: |
docker run --rm chen:ci info
docker run --rm chen:ci run --prompt "Explain recursion." --phase 1 --backend mock