CI/CD Best Practices¶
Optimize your CI/CD pipelines with rninja.
Cache Strategy¶
Use Remote Cache¶
For maximum benefit across CI runs:
Push Policy by Branch¶
if [ "$BRANCH" = "main" ]; then
export RNINJA_CACHE_PUSH_POLICY=always
else
export RNINJA_CACHE_PUSH_POLICY=never
fi
Cache Key Design¶
Include relevant factors:
Performance Tips¶
Maximize Parallelism¶
Keep Going on Errors¶
Find all errors in one run:
Use Single-Shot in Ephemeral Runners¶
Security¶
Protect Tokens¶
Use CI secret management:
Limit Push Access¶
Only main branch populates cache:
Monitoring¶
Log Cache Stats¶
Generate Build Traces¶
Common Patterns¶
Build Matrix¶
Test multiple configurations:
Artifact Caching¶
Combine CI cache with rninja cache:
Conditional Builds¶
Skip builds when no source changes:
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- 'src/**'
- if: steps.changes.outputs.src == 'true'
run: rninja
Checklist¶
- Install rninja in CI image
- Configure cache (local or remote)
- Set appropriate parallelism
- Add cache statistics logging
- Secure tokens with secrets
- Test cache hit rates
- Monitor build times