Build wheels and sdist and upload to PyPI #39
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 | |
- uses: actions/setup-python@v3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
env: | |
CIBW_BUILD: "*manylinux*" | |
CIBW_ARCHS: auto64 | |
CIBW_SKIP: cp36* pp* | |
# I think yum might always work here. But leave all options available. | |
CIBW_BEFORE_ALL_LINUX: yum install -y fftw-devel || apt-get install libfftw3-dev || apk add --upgrade fftw-dev | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_musl_wheels: | |
name: Build wheels on musl linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
env: | |
CIBW_BUILD: "*musllinux*" | |
CIBW_ARCHS: auto64 | |
CIBW_SKIP: cp36* pp* | |
# I think musl always uses apk, but keep all options available. | |
CIBW_BEFORE_ALL: apk add --upgrade fftw-dev || apt-get install libfftw3-dev || yum install -y fftw-devel | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_macosx_wheels: | |
name: Build wheels on macosx | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
env: | |
CIBW_BUILD: "*macosx*" | |
CIBW_ARCHS: auto64 | |
CIBW_SKIP: cp36* pp* | |
CIBW_BEFORE_ALL_MACOS: brew install fftw || true | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
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 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
- name: Install fftw | |
run: | | |
sudo -H apt update -y | |
sudo -H apt install -y libfftw3-dev | |
- 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@v3 | |
with: | |
path: ./wheels | |
- name: Build sdist | |
run: | | |
python setup.py sdist | |
ls -l dist | |
tar tvfz dist/GalSim-*.tar.gz | |
- name: Copy wheels | |
run: | | |
echo ls -l wheels | |
ls -l wheels | |
echo ls -l wheels/artifact | |
ls -l wheels/artifact | |
cp wheels/artifact/*.whl dist | |
echo ls -l dist | |
ls -l dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: rmjarvis | |
password: ${{ secrets.PYPI_PASSWORD }} | |
verbose: true |