Skip to content

Commit 9e3c361

Browse files
committed
CI: get maturin version from pyproject.toml
1 parent 151f057 commit 9e3c361

File tree

1 file changed

+40
-9
lines changed

1 file changed

+40
-9
lines changed

.github/workflows/test.yml

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@ name: Test
33
on: [push, pull_request]
44

55
jobs:
6+
py_build_deps:
7+
outputs:
8+
output: ${{ steps.extract_from_toml.outputs.output }}
9+
10+
runs-on: ubuntu-latest
11+
12+
defaults:
13+
run:
14+
working-directory: light-curve
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
submodules: true
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.11"
24+
- name: Extract build deps from pyproject.toml
25+
id: extract_from_toml
26+
run: |
27+
echo "output="$(python -c 'import tomllib; print(" ".join(tomllib.load(open("pyproject.toml", "rb"))["build-system"]["requires"]))') >> "$GITHUB_OUTPUT"
28+
29+
630
test:
731
runs-on: ubuntu-latest
832

@@ -45,6 +69,8 @@ jobs:
4569
build:
4670
runs-on: ${{ matrix.os }}
4771

72+
needs: [py_build_deps]
73+
4874
strategy:
4975
fail-fast: false
5076
matrix:
@@ -143,8 +169,8 @@ jobs:
143169
python-version: '3.11'
144170
- name: Set up Rust toolchain
145171
uses: dtolnay/rust-toolchain@stable
146-
- name: Install maturin
147-
run: python3 -mpip install 'maturin>=0.14,<0.15'
172+
- name: Install build deps
173+
run: python3 -mpip install "${{ needs.py_build_deps.outputs.output }}"
148174
- name: Build wheels for abi3=${{ matrix.abi3 }} fftw=${{ matrix.fftw }} ceres=${{ matrix.ceres }} gsl=${{ matrix.gsl }}
149175
run: |
150176
maturin build --find-interpreter --manylinux=off --locked --no-default-features --features=fftw-${{ matrix.fftw }}${{ matrix.ceres == 'source' && ',ceres-source' || '' }}${{ matrix.ceres == 'system' && ',ceres-system' || '' }}${{ matrix.gsl && ',gsl' || '' }}${{ matrix.abi3 && ',abi3' || '' }}
@@ -161,6 +187,8 @@ jobs:
161187
coverage:
162188
runs-on: ubuntu-latest
163189

190+
needs: [py_build_deps]
191+
164192
defaults:
165193
run:
166194
working-directory: light-curve
@@ -178,8 +206,8 @@ jobs:
178206
uses: actions/setup-python@v4
179207
with:
180208
python-version: "3.11"
181-
- name: Install maturin
182-
run: pip install $(python -c 'import tomllib; print(" ".join(tomllib.load(open("pyproject.toml", "rb"))["build-system"]["requires"]))')
209+
- name: Install build deps
210+
run: pip install "${{ needs.py_build_deps.outputs.output }}"
183211
- name: Generate code coverage
184212
run: |
185213
source <(cargo llvm-cov show-env --export-prefix)
@@ -197,6 +225,8 @@ jobs:
197225
msrv-build:
198226
runs-on: ubuntu-latest
199227

228+
needs: [py_build_deps]
229+
200230
defaults:
201231
run:
202232
working-directory: light-curve
@@ -229,24 +259,25 @@ jobs:
229259
- uses: dtolnay/rust-toolchain@master
230260
with:
231261
toolchain: ${{ steps.get_msrv.outputs.msrv }}
232-
- name: Install maturin
233-
run: pip install 'maturin>=0.14,<0.15'
262+
- name: Install build_deps
263+
run: pip install "${{ needs.py_build_deps.outputs.output }}"
234264
- name: Build
235265
run: |
236266
rustup default ${{ steps.get_msrv.outputs.msrv }}
237267
maturin build --find-interpreter
238268
239269
arm:
240-
241270
runs-on: [self-hosted, linux, ARM64]
242271

272+
needs: [py_build_deps]
273+
243274
defaults:
244275
run:
245276
working-directory: light-curve
246277

247278
steps:
248279
- uses: actions/checkout@v3
249-
- name: install maturin
250-
run: pip install 'maturin[patchelf]>=0.14,<0.15'
280+
- name: Install build_deps
281+
run: pip install "${{ needs.py_build_deps.outputs.output }}"
251282
- name: Build
252283
run: maturin build

0 commit comments

Comments
 (0)