name: Test
on:
push:
branches: ['dev']
pull_request:
branches: ['main']
env:
PYTHON_VERSION: '3.10'
jobs:
build-wheels:
name: build-${{ matrix.name }}
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64-gnu
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
manylinux: 2_24
container: ''
- name: linux-aarch64-gnu
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
manylinux: 2_24
container: quay.io/pypa/manylinux_2_24_aarch64
- name: macos-x86_64
runner: macos-15-intel
target: x86_64-apple-darwin
- name: macos-aarch64
runner: macos-latest
target: aarch64-apple-darwin
- name: windows-x86_64
runner: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Test Rust
run: cargo test --target ${{ matrix.target }} --lib --tests --bins
- name: Build wheel (linux)
if: ${{ startsWith(matrix.name, 'linux-') }}
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
container: ${{ matrix.container }}
args: --release
- name: Build wheel
if: ${{ !startsWith(matrix.name, 'linux-') }}
run: |
python -m pip install --upgrade pip maturin
maturin build --release --target ${{ matrix.target }}
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.name }}
path: target/wheels/*.whl
test-python:
name: test-${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
needs: build-wheels
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x86_64-gnu
runner: ubuntu-latest
libc: gnu
target: x86_64-unknown-linux-gnu
- platform: linux-aarch64-gnu
runner: ubuntu-24.04-arm
libc: gnu
target: aarch64-unknown-linux-gnu
- platform: macos-x86_64
runner: macos-15-intel
libc: native
target: x86_64-apple-darwin
- platform: macos-aarch64
runner: macos-latest
libc: native
target: aarch64-apple-darwin
- platform: windows-x86_64
runner: windows-latest
libc: native
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.platform }}
path: dist
- name: Install and test
run: |
python -m pip install --upgrade pip pytest
python -m pip install dist/*.whl
python -m pytest