GitHub Workflows
Diagnose, fix, and optimize GitHub Actions workflows for Rust projects.
Quick Reference
- Caching Strategies - Manual cache, rust-cache, sccache
- Troubleshooting - Common issues, debugging, fixes
- Advanced Features - Coverage, security, benchmarking
- Release Management - Automated releases, versioning
When to Use
- Setting up CI/CD for Rust projects
- Troubleshooting workflow failures
- Optimizing build times with caching
- Ensuring best practices for testing, linting, releases
Before Making Changes
ALWAYS verify current state first:
# Get repo info
gh repo view --json nameWithOwner,owner,name
# List existing workflows
gh workflow list
# Check recent runs
gh run list --limit 10
# View workflow files
ls -la .github/workflows/
Complete Rust CI Workflow
See the full workflow template with:
- Check job (format, clippy, check)
- Test job (unit, integration, doc tests)
- Coverage job (tarpaulin, codecov)
- Audit job (security, licenses)
See linked files for caching strategies, troubleshooting, and release management.
Core Workflow Components
| Job |
Purpose |
Tools |
| check |
Code quality |
rustfmt, clippy, cargo check |
| test |
Verification |
cargo test |
| coverage |
Test metrics |
cargo tarpaulin |
| audit |
Security |
cargo audit, deny |
Common Patterns
- Caching: Dependencies, target directory, sccache
- Matrix builds: Multiple Rust versions, targets
- Conditional jobs: Skip on docs-only changes
- Quality gates: Block merge on failures
PR Check Attachment Guardrail
- After pushing fixes, validate checks are attached to the PR head SHA:
gh pr view --json statusCheckRollup,mergeStateStatus
gh run list --commit <head_sha>
- If rollup is empty for required checks, treat as blocked and investigate trigger/path conditions.
1---2name: github-workflows3description: Diagnose, fix, and optimize GitHub Actions workflows for Rust projects. Use when setting up CI/CD, troubleshooting workflow failures, optimizing build times, or ensuring best practices.4---56# GitHub Workflows78Diagnose, fix, and optimize GitHub Actions workflows for Rust projects.910## Quick Reference1112- **[Caching Strategies](caching-strategies.md)** - Manual cache, rust-cache, sccache13- **[Troubleshooting](troubleshooting.md)** - Common issues, debugging, fixes14- **[Advanced Features](advanced-features.md)** - Coverage, security, benchmarking15- **[Release Management](release-management.md)** - Automated releases, versioning1617## When to Use1819- Setting up CI/CD for Rust projects20- Troubleshooting workflow failures21- Optimizing build times with caching22- Ensuring best practices for testing, linting, releases2324## Before Making Changes2526**ALWAYS verify current state first:**2728```bash29# Get repo info30gh repo view --json nameWithOwner,owner,name3132# List existing workflows33gh workflow list3435# Check recent runs36gh run list --limit 103738# View workflow files39ls -la .github/workflows/40```4142## Complete Rust CI Workflow4344See the full workflow template with:45- Check job (format, clippy, check)46- Test job (unit, integration, doc tests)47- Coverage job (tarpaulin, codecov)48- Audit job (security, licenses)4950See linked files for caching strategies, troubleshooting, and release management.5152## Core Workflow Components5354| Job | Purpose | Tools |55|-----|---------|-------|56| check | Code quality | rustfmt, clippy, cargo check |57| test | Verification | cargo test |58| coverage | Test metrics | cargo tarpaulin |59| audit | Security | cargo audit, deny |6061## Common Patterns6263- **Caching**: Dependencies, target directory, sccache64- **Matrix builds**: Multiple Rust versions, targets65- **Conditional jobs**: Skip on docs-only changes66- **Quality gates**: Block merge on failures6768## PR Check Attachment Guardrail6970- After pushing fixes, validate checks are attached to the PR head SHA:71 - `gh pr view --json statusCheckRollup,mergeStateStatus`72 - `gh run list --commit <head_sha>`73- If rollup is empty for required checks, treat as blocked and investigate trigger/path conditions.