Table of Contents
Overview
This repository includes comprehensive GitHub Actions workflows for:- CI/CD Pipeline (
ci.yaml) - Test, build, and deploy - Pull Request Checks (
pr-checks.yaml) - Automated PR validation - Security Scanning (
security-scan.yaml) - Daily security scans - Release Automation (
release.yaml) - Automated releases - Stale Issues (
stale.yaml) - Issue/PR management
Required Secrets
GitHub Repository Secrets
Navigate to: Settings → Secrets and variables → ActionsApplication Secrets
Infrastructure Secrets (Optional)
Container Registry
GitHub Container Registry (ghcr.io) usesGITHUB_TOKEN automatically - no setup needed.
Environment Secrets
For deployment environments: Settings → EnvironmentsDevelopment Environment
Create environment:development
Secrets:
KUBECONFIG_DEVANTHROPIC_API_KEYJWT_SECRET_KEYOPENFGA_STORE_IDOPENFGA_MODEL_ID
Staging Environment
Create environment:staging
Secrets:
KUBECONFIG_STAGINGANTHROPIC_API_KEYJWT_SECRET_KEYOPENFGA_STORE_IDOPENFGA_MODEL_ID
- Required reviewers: 1
- Deployment branches:
mainonly
Production Environment
Create environment:production
Secrets:
KUBECONFIG_PRODANTHROPIC_API_KEYJWT_SECRET_KEYOPENFGA_STORE_IDOPENFGA_MODEL_ID
- Required reviewers: 2+ (security team)
- Deployment branches: Tags only (
v*.*.*) - Wait timer: 5 minutes
Workflows
1. CI/CD Pipeline (ci.yaml)
Triggers:
- Push to
mainordevelop - Pull requests to
main - Release creation
- Test - Run unit and integration tests
- Lint - Code quality checks
- Build - Docker image build and push
- Deploy Dev - Auto-deploy to development (on
develop) - Deploy Staging - Auto-deploy to staging (on
main) - Deploy Prod - Manual deploy to production (on release)
2. Pull Request Checks (pr-checks.yaml)
Triggers:
- Pull request opened/updated/reopened
- PR Metadata - Validate PR title (Conventional Commits)
- Test Matrix - Test on Python 3.10, 3.11, 3.12
- Lint - Code quality and formatting
- Security - Security scans
- Docker - Build test
- Size Check - Large file detection
- Dependency Review - Scan for vulnerable dependencies
- Auto Label - Apply labels based on changed files
- Comment - Post check results
3. Security Scan (security-scan.yaml)
Triggers:
- Daily at 2 AM UTC
- Push to
main - Pull requests
- Manual dispatch
- Trivy - Container vulnerability scanning
- Dependency Check - Python package vulnerabilities
- CodeQL - Static code analysis
- Secrets Scan - TruffleHog secrets detection
- License Check - License compliance
- Enable CodeQL in repository settings
- Configure Security tab for SARIF uploads
4. Release Automation (release.yaml)
Triggers:
- Git tags matching
v*.*.*
- Create Release - Generate changelog and GitHub release
- Build Images - Multi-arch Docker images (amd64, arm64)
- Publish Helm - Push Helm chart to OCI registry
- Publish PyPI - Publish Python package (stable only)
- Update MCP Registry - Update MCP registry entry
- Notify - Send Slack notifications
5. Quality Tests (quality-tests.yaml)
Triggers:
- Pull requests to
main - Push to
main - Weekly schedule (Sunday at midnight)
- Manual dispatch
- Property Tests - Hypothesis-based edge case discovery (27+ tests)
- Contract Tests - MCP protocol compliance validation (20+ tests)
- Regression Tests - Performance baseline tracking
- Benchmark Tests - Performance monitoring with alerts
- Mutation Tests - Test effectiveness measurement (weekly only)
- Quality Summary - Aggregate results reporting
6. Stale Issue Management (stale.yaml)
Triggers:
- Daily at midnight
- Issues: 60 days inactive → stale, 7 days → close
- PRs: 30 days inactive → stale, 7 days → close
- Exempt labels:
pinned,security,bug,critical
Branch Protection
Main Branch Protection
Navigate to: Settings → Branches → Branch protection rules Create rule formain:
Develop Branch Protection
Create rule fordevelop:
Environment Configuration
Setting Up Kubeconfig
Testing Secrets Locally
Codecov Integration
Setup Codecov
- Sign up at https://codecov.io with GitHub
- Enable repository in Codecov dashboard
- Get upload token (optional - GITHUB_TOKEN works)
- Add badge to README:
Codecov Configuration
Create.codecov.yml:
Troubleshooting
Common Issues
1. Tests Failing - Missing API Key
Error:ANTHROPIC_API_KEY not set
Solution:
2. Kubeconfig Not Working
Error:Unable to connect to cluster
Solution:
3. Docker Build Fails
Error:buildx not found
Solution: Already handled in workflow with docker/setup-buildx-action@v3
4. CodeQL Initialization Fails
Error:CodeQL not initialized
Solution:
- Go to Settings → Code security and analysis
- Enable CodeQL analysis
- Re-run workflow
5. Dependabot PRs Not Auto-Merging
Setup auto-merge:Debugging Workflows
View Logs
Re-run Failed Jobs
Enable Debug Logging
Add secrets:Common Issues
1. Workflow Concurrency Issues
Issue: Workflows not canceling as expected Solution:- Check concurrency group configuration
- Verify event type (
pull_requestvspush) - Review workflow run logs for cancellation messages
2. Cache Miss Issues
Issue: Cache not restoring, builds slow Solution:- Verify cache key matches across runs
- Check if dependencies changed (invalidates cache)
- Review cache size limits (10GB per repo)
3. Artifact Storage Full
Issue: Unable to upload artifacts Solution:- Review artifact retention policies
- Clean up old workflow runs: Settings → Actions → General → Artifact retention
- Manually delete old artifacts if needed
Workflow Concurrency Controls
All workflows now include concurrency controls to prevent duplicate runs and save CI minutes:CI/CD Pipeline
- Cancels duplicate PR builds
- Allows main/develop builds to complete
Pull Request Checks
- Uses PR number for better grouping
- Always cancels previous runs
- ~30% reduction in CI minutes
- Faster feedback on latest commits
- Prevents resource waste
Manual Workflow Triggering
All workflows support manual triggering viaworkflow_dispatch:
- Test workflow changes without creating PRs
- Run security scans on demand
- Trigger releases manually
- Debug workflow issues
Build Optimization with Caching
Workflows use GitHub Actions cache to improve performance:Python Dependencies
Helm Charts
kubectl Binary
- 20-30% faster builds
- Reduced network usage
- Better reliability
Artifact Retention Policies
All workflows include retention policies to manage storage costs:| Artifact Type | Retention | Workflow |
|---|---|---|
| Test Results | 7 days | pr-checks.yaml |
| Security Reports | 30 days | security-scan.yaml, pr-checks.yaml |
| License Reports | 90 days | security-scan.yaml |
| SBOM Files | 90 days | release.yaml |
| Quality Test Results | 30 days | quality-tests.yaml |
| Benchmark Results | 90 days | quality-tests.yaml |
| Mutation Test Results | 30 days | quality-tests.yaml |
Best Practices
1. Secret Rotation
2. Workflow Optimization
- Use
cache: 'pip'for faster Python setup - Use
cache-from: type=ghafor Docker builds - Run independent jobs in parallel
- Use
ifconditions to skip unnecessary jobs - Leverage concurrency controls to prevent duplicate runs
- Set appropriate artifact retention policies
3. Security
- Never log secrets
- Use
secrets.GITHUB_TOKENinstead of PAT when possible - Limit secret access with environments
- Review Dependabot PRs before merging
- Generate and review SBOM files for releases
- Run security scans regularly
Additional Resources
Support
For GitHub Actions issues:- Check workflow logs
- Review this documentation
- Search GitHub Community
- Open an issue with
ci-cdlabel
Last Updated: 2025-01-10