Skip to content

Commit a2ec14d

Browse files
authored
Merge pull request #38 from light-curve/cibuildwheel
Build wheels via cibuildwheel
2 parents 637ff89 + 600a5ff commit a2ec14d

File tree

7 files changed

+183
-130
lines changed

7 files changed

+183
-130
lines changed

.ci/Dockerfile.maturin

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 100 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -6,106 +6,123 @@ on:
66
- v*
77

88
jobs:
9-
publish-linux:
10-
runs-on: ubuntu-latest
9+
cibuildwheel:
10+
name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.interpreter }}
11+
runs-on: ${{ matrix.os }}
12+
13+
defaults:
14+
run:
15+
working-directory: ./light-curve
1116

1217
strategy:
18+
fail-fast: false
1319
matrix:
20+
os: [ubuntu-20.04]
21+
interpreter: [cp36-manylinux, cp37-manylinux, cp38-manylinux, cp39-manylinux, cp310-manylinux]
22+
arch: [aarch64, ppc64le]
1423
include:
15-
- fftw_feature: mkl
16-
arch: x86_64
17-
platform: linux/amd64
18-
- fftw_feature: fftw-static
19-
arch: aarch64
20-
platform: linux/arm64
21-
- fftw_feature: fftw-static
22-
arch: ppc64le
23-
platform: linux/ppc64le
24+
- os: macos-10.15 # All x86_64 macOS targets
25+
arch: auto
26+
interpreter: "*"
27+
- os: ubuntu-20.04 # All i686 and x86_64 Linux targets
28+
arch: auto
29+
interpreter: "*"
2430

2531
steps:
26-
- uses: actions/checkout@v3
27-
- name: Set up QEMU for Docker Buildx
28-
uses: docker/setup-qemu-action@v1
29-
- name: Build docker image
30-
run: docker buildx build --platform=${{ matrix.platform }} --build-arg='ARCH=${{ matrix.arch }}' --no-cache --tag maturin -f .ci/Dockerfile.maturin .ci
31-
- name: Build wheels
32-
run: docker run --platform=${{ matrix.platform }} --rm -v $(realpath light-curve):/io maturin build --release -i python3.6 -i python3.7 -i python3.8 -i python3.9 -i python3.10 --cargo-extra-args="--locked --no-default-features --features ${{ matrix.fftw_feature }},gsl"
33-
- name: Run Python tests for x86_64 only
34-
if: ${{ matrix.arch == 'x86_64' }}
35-
run: docker run --platform=${{ matrix.platform }} --rm -v $(realpath light-curve):/io --entrypoint=/bin/bash maturin -c 'python3.6 -m pip install target/wheels/*cp36*.whl && python3.7 -m pip install target/wheels/*cp37*.whl && python3.8 -m pip install target/wheels/*cp38*.whl && python3.9 -m pip install target/wheels/*cp39*.whl && python3.10 -m pip install target/wheels/*cp310*.whl && tox -p --skip-pkg-install --sitepackages'
36-
- name: Set up Python
37-
uses: actions/setup-python@v3
38-
- name: Install twine
39-
run: python3 -mpip install twine
40-
- name: Publish light-curve wheels
41-
run: |
42-
twine check --strict *.whl
43-
twine upload *.whl -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE }} --verbose
44-
working-directory: light-curve/target/wheels
45-
46-
publish-macos:
47-
runs-on: macos-10.15
32+
- uses: actions/checkout@v2
33+
34+
- name: Set up QEMU
35+
if: ${{ matrix.arch != 'auto' }}
36+
uses: docker/setup-qemu-action@v1
37+
with:
38+
platforms: all
39+
40+
- name: Set CIBW_BUILD
41+
if: ${{ matrix.arch != 'auto' }}
42+
run: echo "CIBW_BUILD=${{ matrix.interpreter }}_${{ matrix.arch }}" >> $GITHUB_ENV
43+
44+
- name: Set CIBW_ARCHS
45+
run : echo "CIBW_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
46+
47+
- name: Build wheels
48+
uses: pypa/cibuildwheel@v2.4.0
49+
with:
50+
package-dir: ./light-curve
51+
env:
52+
CIBW_SKIP: "*-musllinux_i686 pp39-*" # rustup doesn't install i686-musl, pyO3<0.16 doesn't support pypy3.9
53+
54+
- name: Upload wheels as artifacts
55+
uses: actions/upload-artifact@v2
56+
with:
57+
path: ./wheelhouse/*.whl
58+
if-no-files-found: error
59+
60+
sdist:
61+
name: Build source distribution
62+
runs-on: ubuntu-20.04
4863

4964
defaults:
5065
run:
51-
working-directory: light-curve
66+
working-directory: ./light-curve
5267

5368
steps:
54-
- uses: actions/checkout@v3
55-
- name: Set up Python 3.6
56-
uses: actions/setup-python@v3
57-
with:
58-
python-version: '3.6'
59-
- name: Set up Python 3.7
60-
uses: actions/setup-python@v3
61-
with:
62-
python-version: '3.7'
63-
- name: Set up Python 3.8
64-
uses: actions/setup-python@v3
65-
with:
66-
python-version: '3.8'
67-
- name: Set up Python 3.9
68-
uses: actions/setup-python@v3
69-
with:
70-
python-version: '3.9'
71-
- name: Set up Python 3.10
72-
uses: actions/setup-python@v3
73-
with:
74-
python-version: '3.10'
75-
- name: Set up Rust
76-
uses: actions-rs/toolchain@v1
77-
with:
78-
toolchain: stable
79-
- name: Install GSL and keep static libs only
80-
run: |
81-
brew install gsl
82-
brew list -v gsl | grep '.dylib' | xargs rm -vf
83-
- name: Install tox and maturin
84-
run: pip install tox maturin
85-
- name: Run Python tests
86-
run: tox -p -q
87-
- name: Publish macOS light-curve packages
88-
run: maturin publish -i python3.6 -i python3.7 -i python3.8 -i python3.9 -i python3.10 -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE }}
69+
- uses: actions/checkout@v2
70+
71+
- name: Setup Python
72+
uses: actions/setup-python@v3
73+
74+
- name: Install maturin
75+
run: pip install maturin
76+
77+
- name: Build sdist
78+
run: maturin sdist
79+
80+
- name: Upload sdist as an artifact
81+
uses: actions/upload-artifact@v2
82+
with:
83+
path: ./light-curve/target/wheels/*.tar.gz
84+
if-no-files-found: error
85+
86+
publish:
87+
needs: [cibuildwheel, sdist]
88+
89+
name: Publish light-curve
90+
runs-on: ubuntu-20.04
91+
92+
steps:
93+
- uses: actions/download-artifact@v3
94+
95+
- name: Setup Python
96+
uses: actions/setup-python@v3
97+
98+
- name: Install twine
99+
run: pip install twine
100+
101+
- name: Publish light-curve
102+
working-directory: artifact
103+
run: twine upload *whl *tar.gz -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE }} --verbose
89104

90105
publish-light-curve-python:
91-
runs-on: ubuntu-latest
106+
needs: publish
92107

93-
needs: [publish-linux, publish-macos]
108+
name: Publish light-curve-python
109+
runs-on: ubuntu-20.04
94110

95111
defaults:
96112
run:
97113
working-directory: light-curve-python
98114

99115
steps:
100-
- uses: actions/checkout@v3
101-
- name: Set up Python
102-
uses: actions/setup-python@v3
103-
- name: Install deps
104-
run: |
105-
python3 -mpip install -U pip setuptools
106-
python3 -mpip install toml twine
107-
- name: Publish light-curve-python package
108-
run: |
109-
python3 setup.py sdist
110-
twine check --strict dist/*
111-
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE_PYTHON }} --verbose
116+
- uses: actions/checkout@v2
117+
118+
- name: Set up Python
119+
uses: actions/setup-python@v3
120+
121+
- name: Install deps
122+
run: python3 -mpip install toml twine
123+
124+
- name: Publish light-curve-python
125+
run: |
126+
python3 setup.py sdist
127+
twine check --strict dist/*
128+
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE_PYTHON }} --verbose

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16-
16+
- Infrastructure: [cibuildweel](https://cibuildwheel.readthedocs.io/en/stable/) for package publishing
1717

1818
### Deprecated
1919

light-curve/Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

light-curve/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "light-curve-python"
3-
version = "0.5.5"
3+
version = "0.5.6-alpha.0"
44
authors = ["Konstantin Malanchev <hombit@gmail.com>", "Anastasia Lavrukhina <lavrukhina.ad@gmail.com>"]
55
description = "Feature extractor from noisy time series"
66
readme = "README.md"

light-curve/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ Minimum supported Python version is 3.6.
1919

2020
### Support matrix
2121

22-
| Arch \ OS | Linux | macOS | Windows |
23-
| ----------- | ----- | ----- | ---------- |
24-
| **x86-64** | wheel (MKL) | wheel | not tested https://github.com/light-curve/light-curve-python/issues/12 |
25-
| **aarch64** | wheel | src https://github.com/light-curve/light-curve-python/issues/5 | not tested |
26-
| **ppc64le** | wheel |||
27-
28-
- "wheel": binary wheel is available on pypi.org, local building is not required for the platform, the only pre-requirement is a recent `pip` version. For Linux x86-64 pypi.org provides binary wheels built with Intel MKL, which is not a default build option.
29-
- "src": the package is confirmed to be built and pass unit tests. It is required to have GNU scientific library (GSL)](https://www.gnu.org/software/gsl/) v2.1+ and the [Rust](https://rust-lang.org) toolchain v1.56+ to install it via `pip install`.
22+
| Arch \ OS | Linux glibc | Linux musl | macOS | Windows |
23+
| ----------- | ----------- | ---------- | ----- | ---------- |
24+
| **x86-64** | wheel (MKL) | wheel (MKL) | wheel | not tested https://github.com/light-curve/light-curve-python/issues/12 |
25+
| **i686** | wheel | not tested || not tested |
26+
| **aarch64** | wheel | src | src https://github.com/light-curve/light-curve-python/issues/5 | not tested |
27+
| **ppc64le** | wheel | not tested |||
28+
29+
- "wheel": binary wheel is available on pypi.org, local building is not required for the platform, the only pre-requirement is a recent `pip` version. For Linux x86-64 we provide binary wheels built with Intel MKL, which is not a default build option.
30+
- "src": the package is confirmed to be built and pass unit tests locally, but automatically testing and package build is not supported yet. It is required to have GNU scientific library (GSL)](https://www.gnu.org/software/gsl/) v2.1+ and the [Rust](https://rust-lang.org) toolchain v1.56+ to install it via `pip install`.
3031
- "not tested": building from the source code is not tested, please report us building status via issue/PR/email.
3132

3233
## Feature evaluators

light-curve/pyproject.toml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["maturin>=0.12.5,<0.13"]
2+
requires = ["maturin>=0.12.7,<0.13"]
33
build-backend = "maturin"
44

55
[project]
@@ -44,3 +44,67 @@ deps =
4444
feets
4545
commands = pytest README.md tests/ light_curve/
4646
"""
47+
48+
49+
# Test
50+
# We skip benchmark tests, because it requires feets and its transitive
51+
# dependencies, which are tricky and slow to compile on marginal platforms.
52+
# We use platforms where scipy binary wheels are available
53+
[[tool.cibuildwheel.overrides]]
54+
select = "cp*-manylinux_x86_64 cp*-manylinux_aarch64 cp*-macosx*"
55+
test-command = "pytest {package}/README.md {package}/light_curve/ {package}/tests/ --ignore {package}/tests/test_w_bench.py"
56+
test-requires = [
57+
"pytest",
58+
"pytest-benchmark",
59+
"pytest-markdown",
60+
"numpy",
61+
"scipy",
62+
]
63+
64+
[tool.cibuildwheel.environment]
65+
PATH = "$PATH:$HOME/.cargo/bin"
66+
GSL_VERSION = "2.7" # used in manylinux only
67+
68+
[tool.cibuildwheel.macos]
69+
before-all = [
70+
# Install Rust
71+
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y",
72+
# Install GSL
73+
"brew install gsl",
74+
]
75+
76+
# glibc Linux aka manylinux, CentOS
77+
[[tool.cibuildwheel.overrides]]
78+
select = "*-manylinux*"
79+
before-all = [
80+
# Install Rust
81+
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y",
82+
# Rust build deps require openssl
83+
"yum install -y openssl-devel",
84+
# manylinux2014 image has GSL v.1 -> compile GSL static libraries ourselves
85+
"curl -O https://mirror.ibcp.fr/pub/gnu/gsl/gsl-${GSL_VERSION}.tar.gz",
86+
"tar -xzvf gsl-${GSL_VERSION}.tar.gz",
87+
"cd gsl-${GSL_VERSION}",
88+
"./configure --with-pic --enable-shared=no",
89+
"make -j$(nproc)",
90+
"make install",
91+
"cd -",
92+
"rm -rf gsl-${GSL_VERSION} gsl-${GSL_VERSION}.tar.gz",
93+
]
94+
95+
# MUSL Linux, Alpine
96+
[[tool.cibuildwheel.overrides]]
97+
select = "*-musllinux*"
98+
before-all = [
99+
# Install Rust
100+
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y",
101+
# Rust build deps require openssl
102+
"apk add openssl-dev",
103+
# Install GSL
104+
"apk add gsl-dev",
105+
]
106+
107+
# Build with Intel MKL on Linux x86_64
108+
[[tool.cibuildwheel.overrides]]
109+
select = "*linux_x86_64"
110+
environment = { "PATH" = "$PATH:$HOME/.cargo/bin", "GSL_VERSION" = "2.7", "MATURIN_PEP517_ARGS" = "--cargo-extra-args='--locked --no-default-features --features mkl,gsl'" }

0 commit comments

Comments
 (0)