
CI/CD best practices
✅ Keep the pipeline fast
✅ Fail fast
For example, if "integration tests" fail more often than "unit tests", run them first.
✅ Do not run everything every time
Do you need to run the linter in PR? Yes
Do you need to run the linter after the merge? Probably not
✅ Avoid "God" pipelines!
Split the workflow when it makes sense.
✅ Do not use long-lasting credentials/tokens.
If possible, use OpenID Connect (OIDC) instead.
Example?
OIDC with GitHub Actions
✅ Avoid magic!
Be descriptive
Write the logic in scripts, makefiles, etc. that you can test locally.
✅ Build once, share the artifacts with the rest of the workflow
✅ Cache large build artifacts & Docker images
✅ Monitor & measure your pipeline
✅ Do not spam everyone for everything
✅ Run in parallel when possible
✅ Ensure Environment Parity
Consistent environments: dev, staging, production, etc.
✅ Automate Database Migrations
✅ Implement Security Scanning & Static Code Analysis
Snyk, Dependabot, SonarQube, etc. (app, IaC)

