-
-
Notifications
You must be signed in to change notification settings - Fork 29
172 lines (146 loc) · 5.58 KB
/
Copy pathci.yml
File metadata and controls
172 lines (146 loc) · 5.58 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
name: CI
on:
push:
branches: [master, main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Fast tier: lint + tests that do NOT solve a model. Cheap, so it runs on
# every operating system and every supported Python version. This is where
# cross-platform and cross-Python problems (imports, packaging, syntax that
# needs a newer Python) are caught.
fast:
name: fast (lint + unit) - ${{ matrix.os }} / py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Conda (Miniforge) + Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
auto-update-conda: true
activate-environment: ci
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: strict
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: requirements.lock
- name: Install dependencies
shell: bash -l {0}
run: |
conda install -y -c conda-forge flake8 pytest
uv pip install --system -r requirements.lock
pip install -e .
- name: Lint with flake8 (syntax errors only)
shell: bash -l {0}
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Run unit tests (no solve)
shell: bash -l {0}
run: |
pytest -vv -m "not solve" tests/
# Solve tier: the full model suite (every case, multi-stage, Benders). The
# model maths is the same on every platform, so re-solving on all 9 combos
# adds little. We solve once per operating system on a single Python version.
# Cross-Python coverage is already provided by the fast tier above.
solve:
name: solve (full model suite) - ${{ matrix.os }} / py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Conda (Miniforge) + Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
auto-update-conda: true
activate-environment: ci
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: strict
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: requirements.lock
- name: Install dependencies
shell: bash -l {0}
run: |
conda install -y -c conda-forge flake8 pytest pytest-timeout
uv pip install --system -r requirements.lock
uv pip install --system "highspy==1.15.1"
pip install -e .
- name: Run solve tests (per-test timeout guards a stuck solver)
shell: bash -l {0}
run: |
pytest -vv -m solve --timeout=1800 tests/
# Pandas 2 floor: the lock pins pandas 3, but pyproject still supports pandas 2
# (>=2.2.2,<4), so nothing would exercise the older end of the range. This job
# installs the lock, pins pandas back to the 2.x floor, and runs the unit and
# solve tests. One combo is enough: the variable is the pandas version, not the
# platform.
pandas2:
name: pandas 2 floor (unit + solve) - ubuntu-latest / py3.12
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Conda (Miniforge) + Python 3.12
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
auto-update-conda: true
activate-environment: ci
python-version: "3.12"
channels: conda-forge,defaults
channel-priority: strict
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: requirements.lock
- name: Install dependencies, then pin pandas to the 2.x floor
shell: bash -l {0}
run: |
conda install -y -c conda-forge flake8 pytest pytest-timeout
uv pip install --system -r requirements.lock
uv pip install --system "highspy==1.15.1"
pip install -e .
uv pip install --system "pandas>=2.2.2,<3"
- name: Run unit and solve tests
shell: bash -l {0}
run: |
pytest -vv -m "not solve" tests/
pytest -vv -m solve --timeout=1800 tests/
# Docs tier: build the Read the Docs site with warnings treated as errors, so
# a broken cross-reference, a missing toctree entry, or a bad directive fails
# the PR. No solver or model dependency, so it runs once on Linux.
docs:
name: docs (sphinx build)
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: Install doc dependencies
run: pip install -r doc/md/requirements.txt
- name: Build docs (warnings are errors)
run: sphinx-build -b html -W --keep-going doc/md doc/_build/html