Repository navigation
356 lines (341 loc) · 14.1 KB
/
Copy pathci.yml
File metadata and controls
356 lines (341 loc) · 14.1 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
name: Refactor checks
on:
push:
branches: [devel]
pull_request:
branches: [main, devel]
workflow_dispatch:
inputs:
run_coverage:
description: Run coverage on the bounded core smoke selection
type: boolean
default: false
run_slow:
description: Run the existing dark p-n junction regression only
type: boolean
default: false
run_ionic_jv_diagnostics:
description: Repeat the real ionic J-V HTTP module and retain native evidence
type: boolean
default: false
ionic_jv_diagnostic_repetitions:
description: Positive integer repeat count for each diagnostic Python version
type: number
default: 20
ionic_jv_measure_curve_64s:
description: Measure only the direct diagnostic curve with a 64s ceiling; no limit recommendation
type: boolean
default: false
permissions:
contents: read
concurrency:
group: refactor-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: .
env:
UV_PROJECT_ENVIRONMENT: ${{ github.workspace }}/.venv-refactor
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
OPENBLAS_NUM_THREADS: "1"
MKL_NUM_THREADS: "1"
VECLIB_MAXIMUM_THREADS: "1"
NUMEXPR_NUM_THREADS: "1"
BLIS_NUM_THREADS: "1"
jobs:
static:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: "3.13.15"
- run: uv lock --check
- run: uv sync --frozen --extra dev
- name: Lint root source, scripts and CI policy tests
run: >-
uv run --frozen --no-sync ruff check --no-cache
src scripts/test_all.py scripts/generate_configuration_schema.py
scripts/generate_readme_figures.py scripts/ci tests/ci
- name: Guard root test discovery and explicit exclusions
working-directory: .
run: >-
uv run --frozen --no-sync python -m pytest -q -s -p no:cacheprovider
tests/ci --junitxml=${{ runner.temp }}/test-discovery.xml
core:
runs-on: ubuntu-24.04
timeout-minutes: 15
defaults:
run:
working-directory: .
env:
PYTEST_CI_JOB: core
strategy:
fail-fast: false
matrix:
python: ["3.11.16", "3.13.15"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: ${{ matrix.python }}
- run: uv sync --frozen --extra dev --extra arb --extra ida
# Test-local prerequisites and strict xfails are documented in
# tests/ci/exclusions.json; no failure is hidden with -k or --deselect.
- name: Discover all root unit kernels and contracts
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/unit
-m 'not slow and not frontend' --durations=20
--junitxml=${{ runner.temp }}/core-${{ matrix.python }}.xml
packages:
runs-on: ubuntu-24.04
# Package/refactor checks run about 8 min plus 1.5 min runtime pools.
timeout-minutes: 25
defaults:
run:
working-directory: .
strategy:
fail-fast: false
matrix:
python: ["3.11.16", "3.13.15"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
# The release-bundle test compares the build commit with HEAD^.
fetch-depth: 2
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: ${{ matrix.python }}
- run: uv lock --check
- run: uv sync --frozen --extra dev --extra server --no-editable
- name: Discover all root integration and package tests
env:
PYTEST_CI_JOB: packages
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/integration tests/refactor -m 'not slow and not frontend'
--durations=20 --junitxml=${{ runner.temp }}/packages-${{ matrix.python }}.xml
- name: Check typed configuration, registry and runtime preparation
run: |
uv run --frozen --no-sync ruff check --no-cache src scripts tests
uv run --frozen --no-sync mypy --cache-dir /dev/null src/solarlab src/solarlab_server
- name: Check generated configuration schema
run: uv run --frozen --no-sync python scripts/generate_configuration_schema.py --check
- name: Installed package imports and resources outside the checkout
working-directory: ${{ runner.temp }}
run: |
"$UV_PROJECT_ENVIRONMENT/bin/python" -I -B - <<'PY'
import importlib.metadata
import importlib.resources
import importlib.util
import pathlib
import sys
import solarlab
import solarlab_research
import solarlab_server
from solarlab.cli import main as cli_main
from solarlab.config import behavior
from solarlab.materials import (
load_packaged_default_catalog,
load_packaged_resource_library,
load_packaged_template_library,
)
from solarlab_server.app import create_app
prefix = pathlib.Path(sys.prefix).resolve()
for module in (solarlab, solarlab_research, solarlab_server):
assert pathlib.Path(module.__file__).resolve().is_relative_to(prefix)
assert importlib.resources.files(module).joinpath("py.typed").is_file()
assert importlib.util.find_spec("perovskite_sim") is None
assert importlib.util.find_spec("backend") is None
assert create_app.__module__ == "solarlab_server.app"
assert cli_main.__module__ == "solarlab.cli"
assert load_packaged_default_catalog().content_sha256
assert load_packaged_resource_library().get("MAPbI3", "nk").shape[1] == 3
assert len(load_packaged_template_library().templates) > 0
assert pathlib.Path(behavior.__file__).resolve().is_relative_to(prefix)
assert importlib.metadata.version("solarlab") == "0.1.0"
PY
backend:
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
PYTEST_CI_JOB: backend
strategy:
fail-fast: false
matrix:
python: ["3.11.16", "3.13.15"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: ${{ matrix.python }}
- name: Install the locked root service and runtime dependencies
working-directory: .
run: uv sync --frozen --extra dev --extra server --no-editable
- name: Discover all root runtime and HTTP tests
working-directory: .
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/runtime --ignore tests/runtime/test_scan_execution.py
--ignore tests/runtime/test_supervisor_control_failure.py
-m 'not slow and not frontend' --durations=20
--junitxml=${{ runner.temp }}/backend-${{ matrix.python }}.xml
# Separate process: pool RSS includes pytest and its process family.
# The discovery guard verifies this group and bulk ignore together.
- name: Isolated scan execution pool contracts
working-directory: .
env:
PYTEST_CI_ISOLATED_GROUP: scan_execution
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/runtime/test_scan_execution.py -m 'not slow and not frontend' --durations=20
--junitxml=${{ runner.temp }}/backend-scan-${{ matrix.python }}.xml
- name: Isolated supervisor control and recovery contracts
working-directory: .
env:
PYTEST_CI_ISOLATED_GROUP: supervisor_control_failure
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/runtime/test_supervisor_control_failure.py -m 'not slow and not frontend' --durations=20
--junitxml=${{ runner.temp }}/backend-control-${{ matrix.python }}.xml
ionic-jv-diagnostics:
if: github.event_name == 'workflow_dispatch' && inputs.run_ionic_jv_diagnostics
runs-on: ubuntu-24.04
timeout-minutes: 90
defaults:
run:
working-directory: .
strategy:
fail-fast: false
matrix:
python: ["3.11.16", "3.13.15"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: ${{ matrix.python }}
- run: uv sync --frozen --extra dev --extra server --no-editable
- name: Repeat ionic J-V HTTP diagnostics
env:
IONIC_JV_DIAGNOSTIC_REPETITIONS: ${{ inputs.ionic_jv_diagnostic_repetitions }}
run: >-
uv run --frozen --no-sync python scripts/ci/ionic_jv_diagnostics.py
--repetitions "$IONIC_JV_DIAGNOSTIC_REPETITIONS"
--output-dir "${{ runner.temp }}/ionic-jv-diagnostics-${{ matrix.python }}"
- name: Uncensored direct ionic J-V child timings
if: always()
env:
IONIC_JV_DIAGNOSTIC_REPETITIONS: ${{ inputs.ionic_jv_diagnostic_repetitions }}
IONIC_JV_MEASURE_CURVE_64S: ${{ inputs.ionic_jv_measure_curve_64s }}
run: |
measurement_args=()
if [ "$IONIC_JV_MEASURE_CURVE_64S" = "true" ]; then
measurement_args+=(--diagnostic-curve-64)
fi
uv run --frozen --no-sync python scripts/ci/ionic_jv_timing.py \
--repetitions "$IONIC_JV_DIAGNOSTIC_REPETITIONS" \
--output-dir "${{ runner.temp }}/ionic-jv-diagnostics-${{ matrix.python }}/uncensored" \
"${measurement_args[@]}"
- name: Upload every diagnostic attempt
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ionic-jv-diagnostics-${{ matrix.python }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/ionic-jv-diagnostics-${{ matrix.python }}/
if-no-files-found: warn
include-hidden-files: true
retention-days: 14
binding:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: "3.13.15"
- run: uv sync --frozen --all-extras
- name: Optional research, notebook, solver and package imports
run: >-
uv run --frozen --no-sync python -c
"import openpyxl, fitz, jupyterlab, celery, sksundae, flint, solarlab, solarlab_research, solarlab_server"
frontend:
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
PYTEST_CI_JOB: frontend
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "24.21.0"
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci --no-audit --no-fund
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: "3.13.15"
- name: Install locked Python schema and service dependencies
working-directory: .
run: uv sync --frozen --extra dev --extra server --no-editable
- name: Discover Python and TypeScript browser contracts
working-directory: .
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/refactor tests/runtime --ignore tests/runtime/test_run_client_contract.py
-m 'not slow and frontend' --durations=20
--junitxml=${{ runner.temp }}/frontend-python.xml
# Do not import the whole numerical suite into the client's RSS budget.
- name: Isolated stored-run client pool contracts
working-directory: .
env:
PYTEST_CI_ISOLATED_GROUP: run_client
run: >-
uv run --frozen --no-sync python -m pytest -q -ra -p no:cacheprovider
tests/runtime/test_run_client_contract.py -m 'not slow and frontend' --durations=20
--junitxml=${{ runner.temp }}/frontend-run-client.xml
- run: SOLARLAB_PYTHON="$UV_PROJECT_ENVIRONMENT/bin/python" npm run test:run
- run: npm run build
coverage:
if: github.event_name == 'workflow_dispatch' && inputs.run_coverage
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: "3.13.15"
- run: uv sync --frozen --extra dev
# Coverage stays outside the default pytest addopts and numerical lanes.
- run: >-
uv run --frozen --no-sync python -m pytest -q
--cov=solarlab --cov-report=term-missing
tests/unit -m 'not slow and not frontend'
slow:
if: github.event_name == 'workflow_dispatch' && inputs.run_slow
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.13"
python-version: "3.13.15"
- run: uv sync --frozen --extra dev --extra arb --extra ida
# Bounded slow unit/integration suite; full scheduled campaigns use scheduled-suite.yml.
- run: >-
uv run --frozen --no-sync python -m pytest -q -m slow
tests/unit tests/integration