-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (179 loc) · 7.05 KB
/
Copy pathci.yml
File metadata and controls
191 lines (179 loc) · 7.05 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v7
with:
python-version: "3.12"
# Pinned deliberately. Unpinned, a ruff release retroactively fails every
# open PR for reasons unrelated to the change under review — 0.16 began
# formatting Python blocks inside Markdown, which turned two untouched
# design docs red. Bump this on purpose, in its own commit.
- run: pip install ruff==0.16.1
- run: ruff check .
- run: ruff format --check .
build-and-test:
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
python: "3.10"
compiler: gcc
- os: ubuntu-22.04
python: "3.11"
compiler: gcc
- os: ubuntu-22.04
python: "3.12"
compiler: gcc
- os: ubuntu-22.04
python: "3.12"
compiler: clang
# macOS
- os: macos-14
python: "3.10"
- os: macos-15
python: "3.12"
# Windows
- os: windows-2022
python: "3.10"
- os: windows-2022
python: "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
- name: Set up Clang (Linux)
if: matrix.compiler == 'clang'
run: |
sudo apt-get update
sudo apt-get install -y clang-15
echo "CC=clang-15" >> $GITHUB_ENV
echo "CXX=clang++-15" >> $GITHUB_ENV
- name: Install package
# matplotlib comes from the notebooks extra; tests/test_notebooks.py
# executes every notebook so the docs cannot rot, and skips without it.
run: pip install ".[dev,notebooks]" -v
- name: Run tests
run: pytest -v
# The ecosystem dependencies below are deliberately UNPINNED, and that is a
# decision rather than an oversight -- see #90, and the dependency float audit
# that pinned ruff, nanobind, GitPython, cibuildwheel, build and
# scikit-build-core. The argument for pinning those is that they build or
# publish an artifact, so an upstream release retroactively changes what ships.
# This job is the opposite: its whole value is telling us early when a torch,
# jax, pandas or scikit-learn release breaks interop, which a pinned job by
# construction cannot do.
#
# The usual objection -- "an upstream release will block every PR" -- does not
# apply here, and that was checked rather than assumed:
#
# * the `protect-main` ruleset carries only `deletion` and
# `non_fast_forward`. There are NO required status checks, so a red job
# cannot block a merge.
# * nothing depends on this job. The release chain in wheels.yml gates on
# `validate-wheels` (a different workflow), never on this one, so a failure
# here cannot stop a release either.
#
# So a failure is loud (a red check on the PR, a failed run) and cheap (blocks
# nothing) -- which is exactly what an early-warning lane should be.
#
# REVISIT IF THAT CHANGES: adding required status checks to the ruleset would
# turn this into a queue-blocker, and the tradeoff flips. At that point either
# pin these and bump deliberately, or move the floating sweep to a scheduled
# run that opens an issue instead of gating a PR.
ecosystem-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install with all optional dependencies
run: |
pip install ".[dev,notebooks]" -v
pip install pandas scikit-learn
# torch and jax are large; install CPU-only variants
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install "jax[cpu]"
- name: Run all tests
run: pytest -v
# The .gz Matrix Market path is compiled in only with MTL5_WITH_ZLIB, which is
# off by default for portability. Without this lane that code would ship with
# no coverage — tests/test_io.py::TestGzip skips itself when the flag is off.
zlib-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install zlib headers
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev
- name: Install package with zlib enabled
run: pip install ".[dev,notebooks]" -v -C cmake.define.MTL5_WITH_ZLIB=ON
- name: Confirm zlib was actually compiled in
# From a neutral directory: at the repo root, `python -c` puts cwd on
# sys.path and imports the source `mtl5/` package, which has no compiled
# _core. pytest is unaffected because it inserts tests/, not the root.
working-directory: ${{ runner.temp }}
run: |
python -c "import mtl5, sys; ok = mtl5.build_info()['zlib']; print('zlib:', ok); sys.exit(0 if ok else 1)"
- name: Run the I/O tests
run: pytest tests/test_io.py -v
# The C++ applications under applications/ are gated behind
# MTL5_BUILD_APPLICATIONS (OFF by default, so `pip install` never pays for
# them). Without this lane they would have no coverage at all and would rot
# silently the next time the MTL5 or Universal pin moves — they are compiled
# against those headers directly, not through the Python extension.
#
# Both compilers, because that is what issue #18 asks for and because clang
# and gcc disagree about things this code depends on (clang does not zero
# stack, so an uninitialized blockbinary temporary shows up there first).
# Built and *run*: a numerical experiment that compiles but produces nan is
# not passing.
applications:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- compiler: g++
name: gcc
- compiler: clang++
name: clang
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Configure (${{ matrix.name }})
run: >
cmake -S . -B build_apps
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DMTL5_ENABLE_PYTHON=OFF
-DMTL5_BUILD_APPLICATIONS=ON
- name: Build ukf_mixed_precision (${{ matrix.name }})
run: cmake --build build_apps --target ukf_mixed_precision -j4
- name: Run it, and fail on nan
run: |
# pipefail, or the pipeline reports tee's status and a crash or a
# nonzero exit that happens not to print "nan" passes the lane.
set -o pipefail
./build_apps/applications/ukf_mixed_precision | tee ukf.out
if grep -qi "nan" ukf.out; then
echo "::error::ukf_mixed_precision produced nan"
exit 1
fi