-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (110 loc) · 3.62 KB
/
Copy pathci.yml
File metadata and controls
130 lines (110 loc) · 3.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
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
name: CI
on:
pull_request:
branches: [develop, main]
push:
branches: [develop, main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# Detect which areas changed so each suite runs only when relevant.
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
web: ${{ steps.filter.outputs.web }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'uv.lock'
- '.python-version'
- '.github/workflows/ci.yml'
web:
- 'gui/web/**'
- '.github/workflows/ci.yml'
python:
name: Python (${{ matrix.python }})
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.12 is the supported floor (pyproject requires-python); 3.14 is the dev pin.
python: ["3.12", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install project + deps
run: uv sync --python ${{ matrix.python }}
# ruff lint/format are Python-version-agnostic; run once, on the floor.
# PIN the ruff version: bare `uvx ruff` resolves the latest release, so a
# new ruff (0.16.0 broadened the default rule set — E501, N802, S-codes)
# would spontaneously fail CI on unchanged code. Bump this deliberately,
# fixing findings in the same PR. Keep it in step with the dev-group cap.
- name: Lint (ruff)
if: ${{ matrix.python == '3.12' }}
run: uvx ruff@0.15.22 check .
- name: Format check (ruff format)
if: ${{ matrix.python == '3.12' }}
run: uvx ruff@0.15.22 format --check .
# Coverage floor: a regression guard, not a target. Today's suite sits at
# ~79% line coverage; 75 leaves headroom for legitimately-untestable code
# (live transports, notebook plotting) while catching a big untested
# feature landing. Raise it as coverage grows; never lower it to merge.
- name: Tests (pytest + coverage floor)
run: >
uv run --python ${{ matrix.python }} --with pytest --with pytest-cov
pytest -q --cov=magnetics --cov-report=term --cov-fail-under=75
typecheck:
name: Typecheck (ty)
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv (Python 3.14 from .python-version)
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install project + deps
run: uv sync
- name: Typecheck (ty)
run: uv run ty check src/magnetics
web:
name: Web (gui)
needs: changes
if: ${{ needs.changes.outputs.web == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: gui/web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: gui/web/package-lock.json
- name: Install (clean)
run: npm ci
- name: Lint (eslint)
run: npm run lint
- name: Typecheck (tsc --strict)
run: npm run typecheck
- name: Tests (vitest)
run: npm test
- name: Build (tsc + vite)
run: npm run build