cibuildwheel #11
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: cibuildwheel | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish wheels to PyPI: (testpypi/pypi/none)' | |
required: false | |
type: choice | |
options: | |
- testpypi | |
- pypi | |
- none | |
default: none | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-12, macos-14] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
# Select wheels | |
CIBW_BUILD: "cp311-manylinux_x86_64 cp311-win_amd64 cp311-macosx_x86_64 cp311-macosx_arm64" | |
CIBW_ARCHS: "native" | |
# use manylinux2014 | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_BEFORE_ALL_LINUX: > | |
pip install patchelf | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "" | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" | |
CIBW_TEST_COMMAND: "python -m highsbox --version" | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
config-file: "{package}/pyproject.toml" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ runner.os }}-${{ runner.arch }} | |
path: ./wheelhouse/*.whl | |
publish-to-testpypi: | |
name: Publish Python wheels to TestPyPI | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
if: github.event.inputs.publish == 'testpypi' | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/highsbox | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-wheels-* | |
merge-multiple: true | |
path: dist/ | |
- name: List all the dists | |
run: ls -l dist/ | |
- name: Publish distribution to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
publish-to-pypi: | |
name: Publish Python wheels to PyPI | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
if: github.event.inputs.publish == 'pypi' | |
environment: | |
name: pypi | |
url: https://pypi.org/project/highsbox | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-wheels-* | |
merge-multiple: true | |
path: dist/ | |
- name: List all the dists | |
run: ls -l dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://upload.pypi.org/legacy/ |