cibuildwheel #68
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: "*-manylinux_x86_64 *-win_amd64 *-macosx_x86_64 *-macosx_arm64" | |
CIBW_SKIP: "cp36-* cp37-* pp* cp38-macosx_arm64" | |
CIBW_ARCHS: "native" | |
# use manylinux2014 | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_ENVIRONMENT_MACOS: > | |
MACOSX_DEPLOYMENT_TARGET=10.14 | |
CIBW_TEST_COMMAND: "python -c \"import pyoptinterface as poi; print(dir(poi))\"" | |
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/pyoptinterface | |
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/pyoptinterface/ | |
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/ |