Build wheels and sdist and upload to PyPI #31
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
name: Build wheels and sdist and upload to PyPI | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
jobs: | |
build_linux_wheels: | |
name: Build wheels on standard linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.5 | |
env: | |
CIBW_BUILD: "*manylinux*" | |
CIBW_SKIP: "cp36* cp37* pp* *i686" | |
CIBW_BEFORE_ALL_LINUX: yum install -y libffi-devel || true | |
- name: Upload manylinux wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: whl-manylinux | |
build_musl_wheels: | |
name: Build wheels on musl linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.5 | |
env: | |
CIBW_BUILD: "*musllinux*" | |
CIBW_SKIP: "cp36* cp37* pp* *i686" | |
# I think musl always uses apk, but it doesn't seem to need ffi installed, so this works. | |
CIBW_BEFORE_ALL_LINUX: yum install -y libffi-devel || true | |
- name: Upload musllinux wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: whl-musllinux | |
build_macosx_wheels: | |
name: Build wheels on macosx | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.5 | |
env: | |
CIBW_BUILD: "*macosx*" | |
CIBW_SKIP: "cp36* cp37* pp* *i686" | |
CIBW_BEFORE_ALL_MACOS: brew install libffi || true | |
- name: Upload macosx wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: whl-macosx | |
build_sdist: | |
name: Build sdist and upload to PyPI | |
needs: [build_linux_wheels, build_musl_wheels, build_macosx_wheels] | |
# Just need to build sdist on a single machine | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/TreeCorr | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U numpy setuptools | |
pip install -U -r requirements.txt | |
- 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 | |
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 | |
with: | |
verbose: true |