STag-Python 1.0.1 #2
Workflow file for this run
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 and upload to PyPI | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
generate-wheels-matrix: | |
name: Generate wheels matrix | |
runs-on: ubuntu-latest | |
outputs: | |
include: ${{ steps.set-matrix.outputs.include }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cibuildwheel | |
run: pipx install cibuildwheel==2.16.2 | |
- id: set-matrix | |
run: | | |
MATRIX=$( | |
{ | |
cibuildwheel --print-build-identifiers --platform linux \ | |
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ | |
&& \ | |
cibuildwheel --print-build-identifiers --platform macos \ | |
| jq -nRc '{"only": inputs, "os": "macos-latest"}' \ | |
&& cibuildwheel --print-build-identifiers --platform windows \ | |
| jq -nRc '{"only": inputs, "os": "windows-latest"}' | |
} | jq -sc | |
) | |
echo "include=$MATRIX" >> $GITHUB_OUTPUT | |
env: | |
CIBW_ARCHS_LINUX: x86_64 i686 aarch64 ppc64le | |
CIBW_ARCHS_MACOS: x86_64 # arm64 not working due to linker errors | |
CIBW_ARCHS_WINDOWS: x86 AMD64 | |
CIBW_SKIP: > | |
pp37-win_amd64 # not working due to compiler errors during numpy installation | |
pp310-win_amd64 # not working due to missing ndarrayobject.h. Warning from numpy: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for testing. | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
needs: generate-wheels-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
only: ${{ matrix.only }} | |
env: | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build SDist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/stag-python | |
permissions: | |
id-token: write | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |