-
Notifications
You must be signed in to change notification settings - Fork 22
216 lines (187 loc) · 6.72 KB
/
ci.yml
File metadata and controls
216 lines (187 loc) · 6.72 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
name: ci
on:
pull_request:
push:
branches:
- "**"
tags-ignore:
- "v*"
- "test-v*"
jobs:
tox_tests:
name: Tox tests (ubuntu, py${{ matrix.py }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- py: "310"
python-version: "3.10"
toxenv: "py310"
- py: "311"
python-version: "3.11"
toxenv: "py311"
- py: "312"
python-version: "3.12"
toxenv: "py312"
- py: "313"
python-version: "3.13"
toxenv: "py313"
steps:
- uses: actions/checkout@v4
env:
OCEANMESH_REQUIRE_INPOLY_ACCEL: "1"
OCEANMESH_INPOLY_ACCEL_DEBUG: "1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run tests
run: |
tox -e ${{ matrix.toxenv }} -- -q
build_wheels:
name: Build wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel==2.*
# Build dependencies (CGAL headers + GMP/MPFR libs) into a local prefix via micromamba.
# The wheel build will link against these, and repair tools will bundle the runtime libs.
- name: Install micromamba (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
if [ "${RUNNER_OS}" = "macOS" ]; then
if [ "$(uname -m)" = "arm64" ]; then
MAMBA_PLATFORM="osx-arm64"
else
MAMBA_PLATFORM="osx-64"
fi
else
MAMBA_PLATFORM="linux-64"
fi
curl -Ls "https://micro.mamba.pm/api/micromamba/${MAMBA_PLATFORM}/latest" -o micromamba.tar.bz2
tar -xjf micromamba.tar.bz2 bin/micromamba
sudo mv bin/micromamba /usr/local/bin/micromamba
- name: Install micromamba (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://micro.mamba.pm/api/micromamba/win-64/latest" -OutFile micromamba.tar.bz2
tar -xjf micromamba.tar.bz2
echo "${PWD}\\Library\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build wheels
env:
# Use a local prefix so setup.py can find include/lib without relying on system installs.
# cibuildwheel will run these on the build machine (and inside manylinux containers on Linux).
CIBW_ENVIRONMENT: "OCEANMESH_PREFIX=/opt/om"
CIBW_ENVIRONMENT_MACOS: "OCEANMESH_PREFIX=$HOME/om"
CIBW_BEFORE_ALL_LINUX: |
set -eux
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest -o micromamba.tar.bz2
tar -xjf micromamba.tar.bz2 bin/micromamba
mv bin/micromamba /usr/local/bin/micromamba
micromamba create -y -p /opt/om -c conda-forge \
cgal boost-cpp gmp mpfr eigen
CIBW_BEFORE_ALL_MACOS: |
set -eux
micromamba create -y -p "$HOME/om" -c conda-forge \
cgal boost-cpp gmp mpfr eigen
CIBW_BEFORE_ALL_WINDOWS: |
micromamba create -y -p C:\\om -c conda-forge cgal boost-cpp gmp mpfr eigen
CIBW_ENVIRONMENT_WINDOWS: "OCEANMESH_PREFIX=C:\\om"
# Repair wheels to bundle shared libs.
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "python -m pip install delocate && delocate-wheel -w {dest_dir} -v {wheel}"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python -m pip install delvewheel && delvewheel repair -w {dest_dir} {wheel}"
run: |
python -m cibuildwheel --output-dir dist
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build sdist
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build --sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
smoke_test:
name: Smoke test install (${{ matrix.os }})
needs: [build_wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Download wheel artifacts
uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist
- name: Install wheel into fresh venv and import
shell: bash
run: |
set -euxo pipefail
python -m venv .venv
if [ -f .venv/bin/activate ]; then
source .venv/bin/activate
else
source .venv/Scripts/activate
fi
python -m pip install --upgrade pip packaging
python - <<'PY'
import glob
import os
import sys
import subprocess
from packaging import tags
from packaging.utils import parse_wheel_filename
wheels = sorted(glob.glob(os.path.join("dist", "*.whl")))
if not wheels:
raise SystemExit("No wheels found in dist/")
supported = set(tags.sys_tags())
def is_compatible(wheel_path: str) -> bool:
_, _, _, wheel_tags = parse_wheel_filename(os.path.basename(wheel_path))
return any(t in supported for t in wheel_tags)
selected = next((w for w in wheels if is_compatible(w)), None)
if not selected:
raise SystemExit(f"No compatible wheel found. Found wheels: {wheels}")
print(f"Selected wheel: {selected}")
subprocess.check_call([sys.executable, "-m", "pip", "install", selected])
PY
python -c "import oceanmesh; print(oceanmesh.__version__)"
python -c "import oceanmesh; oceanmesh.Region((0, 1, 0, 1), 'EPSG:4326'); print('ok')"