👷 Setup CI job matrix to run cargo test #82
Workflow file for this run
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
# This file is autogenerated by maturin v1.4.0 | |
# To update, run | |
# | |
# maturin generate-ci --pytest github | |
# | |
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
release: | |
types: [ published ] | |
pull_request: | |
types: [ opened, reopened, synchronize ] | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: read | |
jobs: | |
rust: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
- beta | |
- nightly | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Update Rust toolchain | |
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
linux: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
target: [x86_64, aarch64, armv7, s390x, ppc64le] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@60d11847b29f81ca5375519a8eb33cc336ba4bfa # v1.41.0 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
container: ghcr.io/rust-cross/manylinux_2_28-cross:${{ matrix.target }} | |
sccache: 'true' | |
manylinux: '2_28' | |
- name: Upload wheels | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: wheels-linux-${{ matrix.target }} | |
path: dist | |
- name: pytest | |
if: ${{ startsWith(matrix.target, 'x86_64') }} | |
shell: bash | |
run: | | |
set -e | |
pip install cog3pio[tests] --find-links dist --force-reinstall | |
pytest --verbose | |
- name: pytest | |
if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'ppc64' }} | |
uses: uraimo/run-on-arch-action@517085f0367c8256bcfa753e3e13e1550af09954 # v2.7.1 | |
with: | |
arch: ${{ matrix.target }} | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt update | |
apt install -y --no-install-recommends \ | |
gcc g++ gfortran libopenblas-dev liblapack-dev ninja-build \ | |
pkg-config python3-pip python3-dev | |
pip3 install -U pip pytest | |
run: | | |
set -e | |
pip3 install cog3pio --find-links dist --force-reinstall | |
pytest --verbose | |
windows: | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
target: [x64] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | |
with: | |
python-version: '3.10' | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@60d11847b29f81ca5375519a8eb33cc336ba4bfa # v1.41.0 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: wheels-windows-${{ matrix.target }} | |
path: dist | |
- name: pytest | |
shell: bash | |
run: | | |
set -e | |
pip install cog3pio[tests] --find-links dist --force-reinstall | |
pytest --verbose | |
macos: | |
runs-on: macos-14 | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@60d11847b29f81ca5375519a8eb33cc336ba4bfa # v1.41.0 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: wheels-macos-${{ matrix.target }} | |
path: dist | |
- name: pytest | |
if: ${{ startsWith(matrix.target, 'aarch64') }} | |
shell: bash | |
run: | | |
set -e | |
pip install cog3pio[tests] --find-links dist --force-reinstall | |
pytest --verbose | |
sdist: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Build sdist | |
uses: PyO3/maturin-action@60d11847b29f81ca5375519a8eb33cc336ba4bfa # v1.41.0 | |
with: | |
command: sdist | |
args: --out dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: wheels-sdist | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-22.04 | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [linux, windows, macos, sdist] | |
steps: | |
- name: Download built wheels | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@60d11847b29f81ca5375519a8eb33cc336ba4bfa # v1.41.0 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --non-interactive --skip-existing wheels-*/* |