Skip to content

optimize ci

optimize ci #23

Workflow file for this run

name: CI
on:
push:
branches: [main, master, "feat/*"]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# 1. Separate linting to fail fast
static-analysis:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Rust Fmt
run: cargo fmt --all -- --check
- name: Rust Clippy
run: cargo clippy -- -D warnings
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
# Wait for lints to pass before burning minutes on compilation
needs: static-analysis
steps:
- uses: actions/checkout@v4
- name: Install Protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
# Optimized caching: handles both Cargo registry AND target directory
- uses: Swatinem/rust-cache@v2
- name: Install Maturin
run: pip install maturin
# Build the Rust extension ONCE in develop mode
# This replaces the need for a separate 'make build' step during CI
- name: Build Extension (Debug)
run: maturin develop
- name: Install Python Dev Deps
run: |
pip install -e .[dev] --no-build-isolation
- name: Run Tests
run: |
make test