feat: build wheels #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is based on the wheel workflow in GalSim, but adapted to our needs | |
name: build wheels and sdist | |
on: | |
workflow_dispatch: | |
pull_request: null | |
release: | |
types: | |
- published | |
concurrency: | |
group: pypi | |
cancel-in-progress: false | |
jobs: | |
linux-manylinux: | |
name: linux-manylinux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: build wheels | |
uses: pypa/cibuildwheel@v2.21.1 | |
env: | |
CIBW_BUILD: "*manylinux*" | |
CIBW_ARCHS: auto64 | |
CIBW_SKIP: cp36* cp37* pp* cp38* | |
# I think yum might always work here. But leave all options available. | |
CIBW_BEFORE_ALL: yum install -y bzip2-devel || apt-get install libbz2-dev || apk add --upgrade bzip2-dev | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: whl-linux | |
path: ./wheelhouse/*.whl | |
linux-musl: | |
name: linux-musl | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: build wheels | |
uses: pypa/cibuildwheel@v2.21.1 | |
env: | |
CIBW_BUILD: "*musllinux*" | |
CIBW_ARCHS: auto64 | |
CIBW_SKIP: cp36* cp37* pp* cp28* | |
# I think musl always uses apk, but keep all options available. | |
CIBW_BEFORE_ALL: yum install -y bzip2-devel || apt-get install libbz2-dev || apk add --upgrade bzip2-dev | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: whl-musl | |
path: ./wheelhouse/*.whl | |
osx-intel: | |
name: osx-intel | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: build wheels | |
uses: pypa/cibuildwheel@v2.21.1 | |
env: | |
CIBW_BUILD: "*macosx*" | |
CIBW_ARCHS: auto64 | |
CIBW_SKIP: cp36* cp37* pp* cp38* | |
# CIBW_BEFORE_ALL: brew install fftw || true | |
CIBW_ENVIRONMENT: >- | |
MACOSX_DEPLOYMENT_TARGET=13.0 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: whl-macos | |
path: ./wheelhouse/*.whl | |
osx-arm: | |
name: osx-arm | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: build wheels | |
uses: pypa/cibuildwheel@v2.21.1 | |
env: | |
CIBW_BUILD: "*macosx*" | |
CIBW_ARCHS: arm64 | |
CIBW_SKIP: cp36* cp37* pp* cp28* | |
# CIBW_BEFORE_ALL: brew install llvm libomp fftw eigen | |
CIBW_ENVIRONMENT: >- | |
MACOSX_DEPLOYMENT_TARGET=14.7 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: whl-arm | |
path: ./wheelhouse/*.whl | |
sdist: | |
name: sdist | |
needs: [linux-manylinux, linux-musl, osx-intel, osx-arm] | |
# Just need to build sdist on a single machine | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U numpy setuptools | |
- name: download wheels | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./wheels | |
pattern: whl-* | |
merge-multiple: true | |
- name: build sdist | |
run: | | |
python setup.py sdist | |
ls -l dist | |
tar tvfz dist/*.tar.gz | |
- name: copy wheels to dist | |
run: | | |
echo ls -l wheels | |
ls -l wheels | |
cp wheels/*.whl dist | |
echo ls -l dist | |
ls -l dist | |
- name: publish to pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name == 'release' | |
with: | |
verbose: true |