Wheel builder #58
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
--- | |
# Workflow to build wheels. | |
name: Wheel builder | |
on: workflow_dispatch | |
jobs: | |
build_wheels: | |
name: Build wheel for ${{ matrix.python }}-${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# # manylinux builds | |
# - os: ubuntu-20.04 | |
# python: "cp38" | |
# platform: manylinux_x86_64 | |
# - os: ubuntu-20.04 | |
# python: "cp39" | |
# platform: manylinux_x86_64 | |
# - os: ubuntu-20.04 | |
# python: "cp310" | |
# platform: manylinux_x86_64 | |
# - os: ubuntu-20.04 | |
# python: "cp311" | |
# platform: manylinux_x86_64 | |
# - os: ubuntu-20.04 | |
# python: "cp312" | |
# platform: manylinux_x86_64 | |
# | |
# # manylinux pypy builds | |
# - os: ubuntu-20.04 | |
# python: "pp38" | |
# platform: manylinux_x86_64 | |
# - os: ubuntu-20.04 | |
# python: "pp39" | |
# platform: manylinux_x86_64 | |
# - os: ubuntu-20.04 | |
# python: "pp310" | |
# platform: manylinux_x86_64 | |
# | |
# # MacOS x86_64 | |
# - os: macos-12 | |
# python: "cp38" | |
# platform: macosx_x86_64 | |
# - os: macos-12 | |
# python: "cp39" | |
# platform: macosx_x86_64 | |
# - os: macos-12 | |
# python: "cp310" | |
# platform: macosx_x86_64 | |
# - os: macos-12 | |
# python: "cp311" | |
# platform: macosx_x86_64 | |
# - os: macos-12 | |
# python: "cp312" | |
# platform: macosx_x86_64 | |
# | |
# # MacOS PyPy builds | |
# - os: macos-12 | |
# python: "pp38" | |
# platform: macosx_x86_64 | |
# - os: macos-12 | |
# python: "pp39" | |
# platform: macosx_x86_64 | |
# - os: macos-12 | |
# python: "pp310" | |
# platform: macosx_x86_64 | |
# MacOS arm64 | |
- os: macos-14 | |
python: "cp39" | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: "cp310" | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: "cp311" | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: "cp312" | |
platform_id: macosx_arm64 | |
# # Windows builds | |
# - os: windows-2019 | |
# python: "cp38" | |
# platform: win_amd64 | |
# - os: windows-2019 | |
# python: "cp39" | |
# platform: win_amd64 | |
# - os: windows-2019 | |
# python: "cp310" | |
# platform: win_amd64 | |
# - os: windows-2019 | |
# python: "cp311" | |
# platform: win_amd64 | |
# - os: windows-2019 | |
# python: "cp312" | |
# platform: win_amd64 | |
# | |
# # Windows PyPy builds | |
# - os: windows-2019 | |
# python: "pp38" | |
# platform: win_amd64 | |
# - os: windows-2019 | |
# python: "pp39" | |
# platform: win_amd64 | |
# - os: windows-2019 | |
# python: "pp310" | |
# platform: win_amd64 | |
steps: | |
- name: Checkout xcsf | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BEFORE_ALL_MACOS: CC=gcc-11 CXX=g++-11 | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }} | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_BUILD_VERBOSITY: 3 | |
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=12.0 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout xcsf | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload: | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
needs: [build_wheels, build_sdist] | |
environment: | |
name: pypi | |
url: https://pypi.org/p/xcsf | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: Attest | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: "dist/*" | |
- name: Publish on PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ | |
# repository-url: https://test.pypi.org/legacy/ | |
... |