Skip to content

pypi

pypi #84

Workflow file for this run

name: pypi
on:
workflow_dispatch:
push:
tags:
- "*"
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
[
ubuntu-latest,
windows-latest,
macos-11,
macos-latest,
macos-latest-xlarge,
]
steps:
- uses: actions/checkout@v3
- name: Set up rust
if: matrix.os != 'ubuntu-latest'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- 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:
# TODO
# CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
CIBW_BUILD: "cp311-*"
CIBW_ARCHS_LINUX: "x86_64 i686 aarch64 ppc64le s390x"
CIBW_ARCHS_MACOS: "x86_64 arm64"
# We don't build ARM64 wheels yet because there's a Rust issue
CIBW_ARCHS_WINDOWS: "AMD64 x86"
# Rust doesn't seem to be available for musl linux on i686 and ppc64le
CIBW_SKIP: "*-musllinux_i686 *-musllinux_ppc64le *-musllinux_s390x"
# arm64 and universal2 wheels are tagged with x86_64 because there's an issue with Poetry
# More information here: https://cibuildwheel.readthedocs.io/en/stable/faq/#how-to-cross-compile (CTRL + F "poetry")
# https://github.com/pypa/cibuildwheel/issues/1415
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
for file in {dest_dir}/*.whl ; do mv $file ${file//x86_64/arm64} ; done
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_I686_IMAGE: "manylinux2014"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_PPC64LE_IMAGE: "manylinux2014"
CIBW_MANYLINUX_S390X_IMAGE: "manylinux2014"
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_PYPY_I686_IMAGE: "manylinux2014"
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: "manylinux2014"
CIBW_MUSLLINUX_X86_64_IMAGE: "musllinux_1_1"
CIBW_MUSLLINUX_I686_IMAGE: "musllinux_1_1"
CIBW_MUSLLINUX_AARCH64_IMAGE: "musllinux_1_1"
CIBW_MUSLLINUX_PPC64LE_IMAGE: "musllinux_1_1"
CIBW_MUSLLINUX_S390X_IMAGE: "musllinux_1_1"
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
# Fix the following error: error: cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylibfailed with code -9
# You need to set a second environment variable CARGO_NET_GIT_FETCH_WITH_CLI="true" for linux environments
# Solutio found here: https://github.com/rust-lang/cargo/issues/10583
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_NET_GIT_FETCH_WITH_CLI="true"'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_BEFORE_BUILD: >
rustup default nightly &&
rustup show
CIBW_BEFORE_BUILD_LINUX: >
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
rustup show
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build River
uses: ./.github/actions/install-env
with:
python-version: "3.12"
- name: Build dist
run: poetry build
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}