A robust CI/CD pipeline ensures code quality, prevents regressions, and automates releases. This document describes the pipelines for Rust crates, Python bindings, and documentation.
- Automated Testing: Run unit, integration, and property‑based tests on every push.
- Code Quality: Enforce formatting, linting, and security checks.
- Cross‑platform Compatibility: Test on Linux, macOS, and Windows (where feasible).
- Automated Releases: Publish to crates.io and PyPI on version tags.
- Documentation Deployment: Build and deploy API docs to GitHub Pages.
- Formatting:
cargo fmt --check - Linting:
cargo clippy -- -D warnings - Rust tests:
cargo test --all-features - Python tests:
pytest python/ - Build verification:
cargo build --releasefor all crates.
- All pre‑merge checks plus:
- Coverage report: Generate code coverage with
tarpaulinorgrcov. - Integration tests: Run multi‑node simulation tests (requires Docker).
- Benchmark regression: Compare performance against baseline (optional).
- Security audit:
cargo auditandcargo deny.
- Build artifacts: Create binaries for supported platforms.
- Publish to crates.io:
cargo publishfor each crate. - Build Python wheels: Use
maturinto build wheels for Linux, macOS, Windows. - Upload to PyPI: Upload wheels and source distribution.
- Update documentation: Rebuild and deploy API docs.
- Create GitHub Release: Attach binaries and release notes.
- CI Provider: GitHub Actions (primary), optionally CircleCI for additional platforms.
- Containerization: Docker for reproducible test environments.
- Artifact Storage: GitHub Releases, PyPI, crates.io.
- Monitoring: Sentry or similar for runtime errors (future).
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo fmt --check
- run: cargo clippy -- -D warnings
- run: cargo test --all-features
- run: cargo build --release
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install maturin pytest
- run: cd python && maturin develop && pytest
cross-platform:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --libname: Release
on:
push:
tags:
- 'v*'
jobs:
publish-crates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish --token ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
publish-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install maturin
- run: cd python && maturin publish --token ${PYPI_TOKEN}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo doc --no-deps
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc- Cache
~/.cargoand~/.cache/pipto speed up builds.
- Test against multiple Rust versions (stable, nightly for beta features).
- Test against Python 3.8, 3.9, 3.10, 3.11.
- Use
cargo auditto check for vulnerable dependencies. - Scan for secrets in code with
trufflehogor GitHub’s built‑in secret scanning.
- Store benchmark results in a dedicated branch and compare using
criterion.rsoutput.
- Use
docker‑composeto spin up multiple containers that simulate a swarm. - Run the demo simulation in headless mode.
- Set up
ci.ymlwith Rust formatting, clippy, and tests. - Add Python binding tests.
- Ensure the pipeline passes on the current codebase (once code exists).
- Extend matrix to macOS and Windows.
- Integrate code coverage reporting (coveralls, codecov).
- Create
release.ymlthat triggers on tags. - Configure secrets (CRATES_IO_TOKEN, PYPI_TOKEN) in GitHub repository.
- Test with a dummy tag.
- Add security audit step.
- Add integration tests with Docker.
- Add benchmark regression detection.
- Should we use a monorepo release tool (like
cargo releaseorchangesets)? - How to handle version bumps across multiple crates?
- Should we automate CHANGELOG generation?