Python wheels #874
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: Python wheels | |
on: | |
schedule: | |
- cron: '0 3 * * *' | |
release: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: force publish to pypi | |
type: boolean | |
pypi_version_override: | |
description: override version id detection | |
type: string | |
env: | |
CARGO_INCREMENTAL: false | |
PYPI_VERSION_OVERRIDE: ${{ inputs.pypi_version_override }} | |
CIBW_ENVIRONMENT_PASS_LINUX: "PYPI_VERSION_OVERRIDE" | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macos-14] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup | Rust | |
uses: hecrj/setup-rust-action@v1 | |
with: | |
rust-version: stable | |
- uses: actions/setup-python@v3 | |
- name: Install rust toolchains | |
if: startsWith(matrix.os, 'macOS') | |
run: rustup target install x86_64-apple-darwin aarch64-apple-darwin | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel | |
- name: Build wheels | |
uses: nick-fields/retry@v2 | |
with: | |
max_attempts: 2 | |
timeout_seconds: 54000 # 15 hours :/ | |
command: python -m cibuildwheel --output-dir wheelhouse api/py | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build SDist | |
run: cd api/py ; pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: api/py/dist/*.tar.gz | |
upload_all: | |
needs: [build_wheels, make_sdist] | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'release' && github.event.action == 'published') || inputs.publish | |
steps: | |
- uses: actions/download-artifact@v4.1.7 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.5.1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI }} | |
verbose: true |