PyPI Wheels (Manual) #42
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: PyPI Wheels (Manual) | |
on: | |
workflow_dispatch: | |
inputs: | |
upload: | |
description: 'Upload to PyPI?' | |
required: false | |
default: false | |
env: | |
CIBW_TEST_COMMAND: python {project}/src/python/test.py | |
CIBW_TEST_REQUIRES: numpy | |
CIBW_TEST_SKIP: cp310-macosx_x86_64 cp311-macosx_x86_64 | |
jobs: | |
build_sdist: | |
name: Build SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
- name: Install deps | |
run: python -m pip install twine build | |
- name: Build SDist | |
run: python -m build -s | |
- name: Check metadata | |
run: twine check dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
build_wheels: | |
name: Wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install libomp and openblas for macos | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install libomp | |
brew install openblas | |
- name: Build wheel | |
uses: pypa/[email protected] | |
env: | |
# Python 2.7 on Windows requires a workaround for C++11 support, | |
# built separately below | |
CIBW_SKIP: pp* cp27* *-win32 *_i686 *_aarch64 *_ppc64le *_s390x | |
- name: Show files | |
run: ls -lh wheelhouse | |
shell: bash | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
path: wheelhouse/*.whl | |
upload_all: | |
name: Upload if release | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event.inputs.upload != false | |
steps: | |
- uses: actions/setup-python@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip-existing: true |