GitHub Actions CI/CD
Automate your developer workflow directly inside GitHub.
Workflow Basics
- Triggers:
on: [push, pull_request]. - Jobs & Steps: Breaking automation into logical units (e.g.,
test,lint,build).
Essential Actions
- Setup:
actions/setup-python,actions/checkout. - Caching:
actions/cacheto speed up dependency installation.
Secrets & Environments
- Security: Store API keys and production secrets in GitHub Secrets.
- Environments: Use
environment: productionfor manual approvals and deployment tracking.
Best Practices
- Matrix Builds: Test across multiple Python versions or OSs simultaneously.
- Linters: Run
rufforflake8on every PR to maintain code quality.