Build #3
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: Build | |
on: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
DO_NOT_TRACK: 1 | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
# Heavily inspired by https://github.com/pydantic/pydantic-core/blob/main/.github/workflows/ci.yml | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "linux", "macos", "windows" ] | |
target: [ "x86_64", "aarch64" ] | |
manylinux: [ auto ] | |
include: | |
# manylinux for various platforms, plus x86_64 pypy | |
- os: linux | |
manylinux: auto | |
target: i686 | |
- os: linux | |
manylinux: auto | |
target: aarch64 | |
- os: linux | |
manylinux: auto | |
target: armv7 | |
interpreter: 3.8 3.9 3.10 3.11 3.12 | |
- os: linux | |
manylinux: auto | |
target: ppc64le | |
interpreter: 3.8 3.9 3.10 3.11 3.12 | |
- os: linux | |
manylinux: auto | |
target: s390x | |
interpreter: 3.8 3.9 3.10 3.11 3.12 | |
- os: linux | |
manylinux: auto | |
target: x86_64 | |
interpreter: pypy3.9 pypy3.10 | |
# musllinux | |
- os: linux | |
manylinux: musllinux_1_1 | |
target: x86_64 | |
- os: linux | |
manylinux: musllinux_1_1 | |
target: aarch64 | |
# macos; | |
# all versions x86_64 | |
# arm pypy and older pythons which can't be run on the arm hardware for PGO | |
- os: macos | |
target: x86_64 | |
- os: macos | |
target: aarch64 | |
interpreter: 3.8 3.9 pypy3.9 pypy3.10 | |
# windows; | |
# x86_64 pypy builds are not PGO optimized | |
# i686 not supported by pypy | |
# aarch64 only 3.11 and up, also not PGO optimized | |
- os: windows | |
target: x86_64 | |
interpreter: pypy3.9 pypy3.10 | |
- os: windows | |
target: i686 | |
python-architecture: x86 | |
interpreter: 3.8 3.9 3.10 3.11 3.12 | |
exclude: | |
# See above; disabled for now. | |
- os: windows | |
target: aarch64 | |
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest | |
environment: test | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
architecture: ${{ matrix.python-architecture || 'x64' }} | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip install twine | |
- name: Build | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: ${{ matrix.manylinux }} | |
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 pypy3.9 pypy3.10' }} | |
rust-toolchain: stable | |
docker-options: -e CI | |
- name: List wheels | |
run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/ | |
- name: Check with Twine | |
run: twine check --strict dist/* | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }} | |
path: dist | |
- name: Publish to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |