Refactor CI workflow to use conditional activation for virtual enviro… #638
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 was originally generated by maturin v0.14.17 | |
name: CI3 | |
on: | |
push: | |
schedule: | |
- cron: '0 0 1 * *' | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: read | |
jobs: | |
test_rust: | |
name: Test Rust | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.81 | |
override: true | |
- name: Install Clippy (pinned version for this pinned version of Rust) | |
run: rustup component add clippy | |
- name: Run Clippy (strict for this pinned version of Rust) | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
- name: Set up Rust (Latest Stable for Tests) | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install Clippy (Latest) | |
run: rustup component add clippy | |
- name: Run Clippy (lenient for latest version) | |
run: cargo clippy --all-targets --all-features -- -A warnings || echo "Clippy warnings from the latest version" | |
- name: Test Rust no-default-features | |
run: cargo test --verbose --no-default-features | |
- name: Test Rust default features | |
run: cargo test --verbose | |
macos: | |
runs-on: macos-13 | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: | | |
3.10 | |
3.11 | |
3.12 | |
3.13 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: | | |
3.10 | |
3.11 | |
3.12 | |
3.13 | |
- name: Install cross-compilation dependencies | |
if: matrix.target == 'aarch64' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Build wheels for aarch64 | |
if: matrix.target == 'aarch64' | |
env: | |
CC: aarch64-linux-gnu-gcc | |
CFLAGS: -march=armv8-a -D__ARM_ARCH=8 | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist -i python3.10 -i python3.11 -i python3.12 -i python3.13 | |
manylinux: auto | |
- name: Build wheels for x86_64 | |
if: matrix.target == 'x86_64' | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist -i -i python3.10 -i python3.11 -i python3.12 -i python3.13 | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
target: [x64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: | | |
3.10 | |
3.11 | |
3.12 | |
3.13 | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
test: | |
name: Test Python | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Install Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Setup, Lint, and Test Python | |
shell: bash | |
run: | | |
cd bed_reader | |
uvx ruff@0.6.9 check . | |
uvx ruff@latest check . || echo "Ignoring warnings from the latest version of ruff" | |
uv sync --extra min_dev | |
if [ "$RUNNER_OS" = "Windows" ]; then | |
.\\..\\.venv\\Scripts\\activate | |
else | |
source ../.venv/bin/activate | |
fi | |
pytest tests/test_opt_dep.py | |
uv sync --extra dev --extra sparse --extra samples | |
if [ "$RUNNER_OS" = "Windows" ]; then | |
.\\..\\.venv\\Scripts\\activate | |
else | |
source ../.venv/bin/activate | |
fi | |
pytest . |