name: Python CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Install python dependencies
run: make install-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build Python extension
run: |
uv run maturin develop --release
- name: Run Python unit tests only
run: |
make test-unit-python
continue-on-error: true
build-wheels:
name: Build Python wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v3
- name: Install python dependencies
run: make install-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Build wheels
run: |
uv run maturin build --release --out dist
- name: Test wheel installation
run: |
wheel_file=$(ls dist/*.whl | head -1)
uv run pip install "$wheel_file"
uv run python -c "import tarzi; print('Wheel installed successfully')"