Skip to content

ci: fix workflow - remove py3.13, add rustfmt/clippy, make optional j… #2

ci: fix workflow - remove py3.13, add rustfmt/clippy, make optional j…

ci: fix workflow - remove py3.13, add rustfmt/clippy, make optional j… #2

Workflow file for this run

name: CI
on:
push:
branches: [main, master, release/*]
pull_request:
branches: [main, master]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test (${{ matrix.os }}, py${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: universal2-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
components: rustfmt, clippy
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install maturin
run: pip install maturin
- name: Build (debug)
run: maturin develop
env:
RUSTFLAGS: -C target-cpu=native
- name: Run tests
run: python -m pytest python/tests/ -q --tb=short -x
timeout-minutes: 30
test-gpu:
name: GPU Features Test (optional)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install maturin
run: pip install maturin
- name: Build with CUDA feature
run: maturin develop --features cuda
env:
RUSTFLAGS: -C target-cpu=native
- name: Test CUDA available
run: python -c "import qector_decoder_v3 as qd; print('CUDA:', qd.cuda_is_available())"
- name: Build with OpenCL feature
run: maturin develop --features opencl
env:
RUSTFLAGS: -C target-cpu=native
- name: Test OpenCL available
run: python -c "import qector_decoder_v3 as qd; print('OpenCL:', qd.opencl_is_available())"
test-full:
name: Full Features Test (optional)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install maturin
run: pip install maturin
- name: Build with full features
run: maturin develop --features full
env:
RUSTFLAGS: -C target-cpu=native
- name: Test gRPC/MCP server
run: |
python -c "import qector_decoder_v3 as qd; assert qd.run_mcp_server is not None; assert qd.run_grpc_server is not None; print('gRPC/MCP available')"
typecheck:
name: Type Check (optional)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install deps
run: pip install mypy ruff
- name: Run mypy
run: mypy python/qector_decoder_v3 --ignore-missing-imports
- name: Run ruff
run: ruff check python/qector_decoder_v3 python/tests
lint:
name: Lint (Rust) (optional)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings