Skip to content

Add CI configuration for MacOS wheels #24

Add CI configuration for MacOS wheels

Add CI configuration for MacOS wheels #24

Workflow file for this run

name: Unit tests
on: [push, pull_request]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: 'pip'
- uses: dtolnay/rust-toolchain@1.76.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Install pre-commit
run: pip install -c requirements.txt pre-commit
- name: Run pre-commit checks
run: pre-commit run --all-files
docs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: 'pip'
- uses: dtolnay/rust-toolchain@1.76.0
- uses: Swatinem/rust-cache@v2
- name: Build Rust docs
# Document private items to validate their doc formatting.
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items --locked
- name: Install Python doc dependencies
run: pip install -r doc-requirements.txt
- name: Install Python package
run: pip install .
- name: Build Python docs
run: SPHINX_OPTS="-W --keep-going" make -C doc html
rust-tests:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: dtolnay/rust-toolchain@1.76.0
- uses: Swatinem/rust-cache@v2
- name: Run Rust tests
run: RUSTFLAGS="-D warnings" cargo test --locked
python-tests:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: dtolnay/rust-toolchain@1.76.0
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install package
run: pip install .
- name: Run Python tests
run: pytest -v -ra
linux-wheels:
needs: [pre-commit, python-tests, rust-tests]
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
python: [cp38] # Using limited ABI, so newer versions are not required
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
if: matrix.arch != 'x86_64'
- id: rust-toolchain
uses: dtolnay/rust-toolchain@1.76.0
- uses: Swatinem/rust-cache@v2
- uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.python }}-manylinux*
RUST_VERSION: ${{ steps.rust-toolchain.outputs.name }}
- uses: actions/upload-artifact@v4
with:
name: wheel_linux-${{ matrix.arch }}-${{ matrix.python }}
path: ./wheelhouse/*.whl
macos-wheels:
needs: [pre-commit, python-tests, rust-tests]
strategy:
fail-fast: false
matrix:
arch: [x86_64, arm64]
python: [cp38] # Using limited ABI, so newer versions are not required
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.76.0
- uses: Swatinem/rust-cache@v2
- uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.python }}-macos*
- uses: actions/upload-artifact@v4
with:
name: wheel_macos-${{ matrix.arch }}-${{ matrix.python }}
path: ./wheelhouse/*.whl