Skip to content

cibuildwheel

cibuildwheel #25

Workflow file for this run

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:
include:
- os: ubuntu-latest
arch: "x86_64 aarch64"
- os: windows-latest
arch: native
- os: macos-12
arch: native
- os: macos-14
arch: native
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
# Select wheels
CIBW_BUILD: "cp311-manylinux_x86_64 cp311-manylinux_aarch64 cp311-win_amd64 cp311-macosx_x86_64 cp311-macosx_arm64"
CIBW_ARCHS: "${{ matrix.arch }}"
# use manylinux2014
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux2014_x86_64"
CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux2014_aarch64"
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/