Triggers: Push to main/develop, Pull Requests, Manual dispatch
Jobs:
- Matrix: stable, beta
- Steps:
- Code formatting check (
cargo fmt) - Linting (
cargo clippy) - Build (
cargo build) - Tests (
cargo test) - Release build
- Upload binary artifact
- Code formatting check (
- Steps:
- Flake check (
nix flake check) - Build all packages (default, rust, python, all)
- Test devShell
- Flake check (
- Steps:
cargo audit(security vulnerabilities)cargo outdated(dependency updates)
- Tool: cargo-llvm-cov
- Upload: Codecov
- Format: LCOV
- Trigger: On failure OR manual enable
- Tool: tmate (30min timeout)
- Access: Actor-limited
Trigger: Git tags v*.*.*, Manual dispatch
Jobs:
- Auto-generate release notes
- Create GitHub Release
- Platforms:
- x86_64-unknown-linux-gnu (Ubuntu)
- x86_64-apple-darwin (macOS)
- Output: Compressed tarballs
- Upload: GitHub Release assets
- Nix package build
- Bundle to Docker image
- Upload to GitHub Release
Triggers: Push to main, Tags, Pull Requests, Manual dispatch
Registry: GitHub Container Registry (ghcr.io)
Steps:
- Build with Nix (
nix build .#dockerImage) - Tag with metadata (branch, semver, SHA)
- Push to ghcr.io
Tags:
mainbranch →latestv1.2.3tag →1.2.3,1.2- PR →
pr-123 - Commit SHA →
sha-abc1234
# Rust checks
cd api/
cargo fmt --check
cargo clippy --all-targets --all-features
cargo test --all-features
cargo build --release
# Nix checks
nix flake check
nix build
nix develop --command cargo test# Trigger CI with tmate debug
gh workflow run ci.yml -f enable-tmate=true
# Trigger Docker build
gh workflow run docker.yml# Tag and push
git tag v0.1.0
git push origin v0.1.0
# Release workflow will auto-trigger
# - Create GitHub Release
# - Build binaries for Linux + macOS
# - Build Nix package
# - Upload all artifactsCODECOV_TOKEN- For code coverage upload- GitHub Token automatically provided for:
- GitHub Container Registry
- Release creation
- Artifact uploads
- Registry:
~/.cargo/registry - Index:
~/.cargo/git - Build:
api/target - Key:
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- Magic Nix Cache (automatic)
- Shared across workflows
- Significantly faster builds
- Rust CI: ~5-8 minutes (with cache)
- Nix CI: ~3-5 minutes (with Magic Cache)
- Security: ~2-3 minutes
- Coverage: ~6-10 minutes
- Total: ~10-15 minutes (parallel)
- Cargo caching reduces build time by 70%
- Magic Nix Cache speeds up Nix builds by 80%
- Matrix builds run in parallel
- Artifacts retained for 7 days
# Enable tmate debug
gh workflow run ci.yml -f enable-tmate=true
# SSH into runner and investigate# Check locally first
nix flake check --show-trace
cargo check --all-targets# Clear GitHub Actions cache
gh cache delete <cache-key>
# Or clear all
gh cache list | awk '{print $1}' | xargs -I {} gh cache delete {}Add to README.md:
[](https://github.com/VoidNxSEC/ml-offload-api/actions/workflows/ci.yml)
[](https://codecov.io/gh/VoidNxSEC/ml-offload-api)
[](https://github.com/VoidNxSEC/ml-offload-api/actions/workflows/docker.yml)- Add integration tests
- Add benchmark workflow
- Add dependency review
- Add SLSA provenance
- Add automated dependency updates (Dependabot/Renovate)