|
| 1 | +# GitHub Actions CI/CD Workflows |
| 2 | + |
| 3 | +This directory contains the complete CI/CD pipeline for the Gemini Flow project. The workflows are designed to be intelligent, self-organizing, and provide comprehensive automation for development, testing, security, and deployment processes. |
| 4 | + |
| 5 | +## 🔄 Workflow Overview |
| 6 | + |
| 7 | +### Core Workflows |
| 8 | + |
| 9 | +1. **[CI Pipeline (`ci.yml`)](.//ci.yml)** |
| 10 | + - **Triggers**: Push to main/develop, Pull Requests |
| 11 | + - **Purpose**: Comprehensive testing and validation |
| 12 | + - **Features**: |
| 13 | + - Quick validation job for fast feedback |
| 14 | + - Multi-OS testing (Ubuntu, Windows, macOS) |
| 15 | + - Multi-Node.js version testing (18, 20, 22) |
| 16 | + - Type checking, linting, and testing |
| 17 | + - CLI binary testing |
| 18 | + - Code coverage reporting (Codecov) |
| 19 | + - Build artifact generation |
| 20 | + |
| 21 | +2. **[Build Verification (`build.yml`)](.//build.yml)** |
| 22 | + - **Triggers**: Push/PR to main/develop (source changes only) |
| 23 | + - **Purpose**: Focused build verification and package validation |
| 24 | + - **Features**: |
| 25 | + - Multi-Node.js version build testing |
| 26 | + - Build output verification |
| 27 | + - CLI executable testing |
| 28 | + - Package creation and verification |
| 29 | + - Build artifact uploads |
| 30 | + |
| 31 | +3. **[Release Pipeline (`release.yml`)](.//release.yml)** |
| 32 | + - **Triggers**: Push to main, Manual workflow dispatch |
| 33 | + - **Purpose**: Automated and manual release management |
| 34 | + - **Features**: |
| 35 | + - Automatic version change detection |
| 36 | + - Manual release type selection (patch/minor/major) |
| 37 | + - Intelligent release skipping with commit messages |
| 38 | + - Automatic changelog generation |
| 39 | + - Git tag creation and GitHub release publishing |
| 40 | + - Integration with npm publish workflow |
| 41 | + |
| 42 | +4. **[NPM Publish (`publish.yml`)](.//publish.yml)** |
| 43 | + - **Triggers**: GitHub releases, Manual workflow dispatch |
| 44 | + - **Purpose**: Secure npm package publishing |
| 45 | + - **Features**: |
| 46 | + - Pre-publish validation and checks |
| 47 | + - Version conflict detection |
| 48 | + - Dry-run capability |
| 49 | + - Publication verification |
| 50 | + - Post-publish notifications |
| 51 | + - Production environment protection |
| 52 | + |
| 53 | +### Security & Quality Workflows |
| 54 | + |
| 55 | +5. **[Security Scanning (`security.yml`)](.//security.yml)** |
| 56 | + - **Triggers**: Push/PR, Weekly schedule, Manual |
| 57 | + - **Purpose**: Comprehensive security analysis |
| 58 | + - **Features**: |
| 59 | + - Dependency vulnerability scanning |
| 60 | + - CodeQL static analysis |
| 61 | + - Secrets detection with TruffleHog |
| 62 | + - License compliance checking |
| 63 | + - Security summary reporting |
| 64 | + |
| 65 | +6. **[Performance Benchmarks (`performance.yml`)](.//performance.yml)** |
| 66 | + - **Triggers**: PR with source changes, Push to main, Weekly schedule |
| 67 | + - **Purpose**: Performance monitoring and regression detection |
| 68 | + - **Features**: |
| 69 | + - Startup time benchmarking |
| 70 | + - Memory usage analysis |
| 71 | + - CLI command performance testing |
| 72 | + - Build time measurement |
| 73 | + - PR performance comments |
| 74 | + - Artifact-based result storage |
| 75 | + |
| 76 | +### Automation & Maintenance |
| 77 | + |
| 78 | +7. **[Dependabot Configuration (`../dependabot.yml`)](.//dependabot.yml)** |
| 79 | + - **Purpose**: Automated dependency updates |
| 80 | + - **Features**: |
| 81 | + - Weekly npm dependency updates |
| 82 | + - GitHub Actions updates |
| 83 | + - Grouped updates by category |
| 84 | + - Automatic PR creation |
| 85 | + - Intelligent version update filtering |
| 86 | + |
| 87 | +## 🚀 Workflow Features |
| 88 | + |
| 89 | +### Intelligence & Optimization |
| 90 | + |
| 91 | +- **Concurrency Control**: Prevents redundant runs and manages resource usage |
| 92 | +- **Path-based Triggers**: Only runs when relevant files change |
| 93 | +- **Quick Feedback**: Fast validation jobs provide immediate feedback |
| 94 | +- **Matrix Strategies**: Comprehensive testing across multiple environments |
| 95 | +- **Artifact Management**: Efficient storage and sharing of build outputs |
| 96 | + |
| 97 | +### Security Best Practices |
| 98 | + |
| 99 | +- **Environment Protection**: Production deployments require manual approval |
| 100 | +- **Secret Management**: Secure handling of NPM tokens and GitHub tokens |
| 101 | +- **Vulnerability Scanning**: Multi-layered security analysis |
| 102 | +- **License Compliance**: Automated license checking |
| 103 | +- **Dependency Reviews**: Automated dependency vulnerability assessment |
| 104 | + |
| 105 | +### Developer Experience |
| 106 | + |
| 107 | +- **PR Comments**: Automated performance and test result comments |
| 108 | +- **Status Checks**: Clear pass/fail indicators for all quality gates |
| 109 | +- **Summary Reports**: Rich workflow summaries with key metrics |
| 110 | +- **Manual Controls**: Workflow dispatch options for manual operations |
| 111 | +- **Skip Mechanisms**: Commit message-based workflow skipping |
| 112 | + |
| 113 | +## 📋 Workflow Dependencies |
| 114 | + |
| 115 | +```mermaid |
| 116 | +graph TD |
| 117 | + A[CI Pipeline] --> B[Build Verification] |
| 118 | + C[Release Pipeline] --> D[NPM Publish] |
| 119 | + E[Security Scanning] --> F[All PRs] |
| 120 | + G[Performance Tests] --> H[PR Comments] |
| 121 | + I[Dependabot] --> J[Auto PRs] |
| 122 | +``` |
| 123 | + |
| 124 | +## 🔧 Configuration |
| 125 | + |
| 126 | +### Required Secrets |
| 127 | + |
| 128 | +The following secrets must be configured in the GitHub repository: |
| 129 | + |
| 130 | +- `NPM_TOKEN`: npm authentication token for package publishing |
| 131 | +- `CODECOV_TOKEN`: Codecov token for coverage reporting (optional) |
| 132 | + |
| 133 | +### Environment Setup |
| 134 | + |
| 135 | +1. **Production Environment**: Create a production environment in GitHub with protection rules |
| 136 | +2. **Branch Protection**: Configure branch protection rules for main/develop branches |
| 137 | +3. **Status Checks**: Require CI workflow status checks before merging |
| 138 | + |
| 139 | +### Custom Configuration |
| 140 | + |
| 141 | +Each workflow includes environment variables that can be customized: |
| 142 | + |
| 143 | +```yaml |
| 144 | +env: |
| 145 | + NODE_VERSION: '20' # Default Node.js version |
| 146 | + CACHE_VERSION: 'v2' # Cache versioning |
| 147 | +``` |
| 148 | +
|
| 149 | +## 📊 Monitoring & Metrics |
| 150 | +
|
| 151 | +### Workflow Analytics |
| 152 | +
|
| 153 | +- **Build Times**: Track build performance over time |
| 154 | +- **Test Coverage**: Monitor code coverage trends |
| 155 | +- **Security Issues**: Track vulnerability remediation |
| 156 | +- **Dependency Updates**: Monitor update frequency and success |
| 157 | +
|
| 158 | +### Performance Tracking |
| 159 | +
|
| 160 | +- **Startup Time**: CLI application startup performance |
| 161 | +- **Memory Usage**: Runtime memory consumption |
| 162 | +- **Build Size**: Package size monitoring |
| 163 | +- **Test Execution**: Test suite performance |
| 164 | +
|
| 165 | +## 🔄 Maintenance |
| 166 | +
|
| 167 | +### Regular Tasks |
| 168 | +
|
| 169 | +1. **Monthly**: Review workflow performance and optimization opportunities |
| 170 | +2. **Quarterly**: Update Node.js versions in matrices |
| 171 | +3. **As Needed**: Adjust security scanning frequency based on risk assessment |
| 172 | +4. **On Security Alerts**: Review and update dependency scanning configurations |
| 173 | +
|
| 174 | +### Troubleshooting |
| 175 | +
|
| 176 | +Common issues and solutions: |
| 177 | +
|
| 178 | +1. **Failed Tests**: Check test logs and ensure environment consistency |
| 179 | +2. **Build Failures**: Verify dependencies and Node.js version compatibility |
| 180 | +3. **Security Alerts**: Review dependency updates and apply patches |
| 181 | +4. **Performance Regressions**: Analyze benchmark results and optimize code |
| 182 | +
|
| 183 | +## 🎯 Best Practices |
| 184 | +
|
| 185 | +### Commit Messages |
| 186 | +
|
| 187 | +Use conventional commit messages to trigger appropriate workflows: |
| 188 | +
|
| 189 | +- `feat:` - New features (may trigger minor version bump) |
| 190 | +- `fix:` - Bug fixes (triggers patch version bump) |
| 191 | +- `[skip-release]` - Skip automatic release creation |
| 192 | +- `[no-ci]` - Skip CI workflows (use sparingly) |
| 193 | + |
| 194 | +### Branch Strategy |
| 195 | + |
| 196 | +- **main**: Production-ready code, triggers releases |
| 197 | +- **develop**: Development integration, triggers full CI |
| 198 | +- **feature/***: Feature branches, triggers PR workflows |
| 199 | + |
| 200 | +### Release Management |
| 201 | + |
| 202 | +- **Automatic**: Version changes in package.json trigger releases |
| 203 | +- **Manual**: Use workflow dispatch for controlled releases |
| 204 | +- **Hotfixes**: Emergency releases can skip tests with manual override |
| 205 | + |
| 206 | +## 📚 Additional Resources |
| 207 | + |
| 208 | +- [GitHub Actions Documentation](https://docs.github.com/en/actions) |
| 209 | +- [npm Publishing Guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) |
| 210 | +- [Dependabot Configuration](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates) |
| 211 | +- [CodeQL Analysis](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors) |
| 212 | + |
| 213 | +--- |
| 214 | + |
| 215 | +*This CI/CD pipeline is designed to scale with your project and adapt to changing requirements. Regular review and optimization ensure continued efficiency and security.* |
0 commit comments