|
| 1 | +# GitHub Actions Workflows |
| 2 | + |
| 3 | +This directory contains all the GitHub Actions workflows for the JMeter Toolkit project. |
| 4 | + |
| 5 | +## 🔄 Workflows Overview |
| 6 | + |
| 7 | +### 1. **CI/CD Pipeline** (`ci.yml`) |
| 8 | +**Triggers**: Push to main branches, Pull requests |
| 9 | +- ✅ **Multi-Python Testing** (3.9, 3.10, 3.11, 3.12) |
| 10 | +- 🧪 **Full Test Suite** with coverage reporting |
| 11 | +- 🐳 **Docker Build Testing** |
| 12 | +- 🔗 **Integration Tests** with PostgreSQL |
| 13 | +- 📦 **Deployment Readiness Check** |
| 14 | + |
| 15 | +### 2. **Code Quality** (`code-quality.yml`) |
| 16 | +**Triggers**: Push to main branches, Pull requests |
| 17 | +- 🔍 **Linting** (flake8, pylint) |
| 18 | +- 🎨 **Code Formatting** (black, isort) |
| 19 | +- 🏷️ **Type Checking** (mypy) |
| 20 | +- 📊 **Complexity Analysis** (radon) |
| 21 | +- 🔒 **Dependency Security** (safety, pip-audit) |
| 22 | + |
| 23 | +### 3. **Performance Tests** (`performance.yml`) |
| 24 | +**Triggers**: Weekly schedule, Manual trigger, Main branch changes |
| 25 | +- ⚡ **Performance Testing** |
| 26 | +- 🚛 **Load Testing** (Locust) |
| 27 | +- 💾 **Memory Usage Monitoring** |
| 28 | +- 📈 **Concurrent Request Testing** |
| 29 | + |
| 30 | +### 4. **Release Management** (`release.yml`) |
| 31 | +**Triggers**: Version tags (v*), Manual trigger |
| 32 | +- 🏷️ **Automated Release Creation** |
| 33 | +- 📦 **Release Package Generation** |
| 34 | +- 🐳 **Docker Image Building** |
| 35 | +- 📋 **Release Notes Generation** |
| 36 | +- 📤 **Asset Upload** (tar.gz, zip, docker) |
| 37 | + |
| 38 | +### 5. **Dependency Updates** (`dependency-update.yml`) |
| 39 | +**Triggers**: Weekly schedule, Manual trigger |
| 40 | +- 🔄 **Automated Dependency Updates** |
| 41 | +- 🔒 **Security Vulnerability Scanning** |
| 42 | +- 📝 **Update Report Generation** |
| 43 | +- 🔀 **Automated Pull Request Creation** |
| 44 | + |
| 45 | +## 📊 Status Badges |
| 46 | + |
| 47 | +Add these badges to your main README.md: |
| 48 | + |
| 49 | +```markdown |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +``` |
| 54 | + |
| 55 | +## 🔧 Configuration Files |
| 56 | + |
| 57 | +The workflows use these configuration files: |
| 58 | +- `.flake8` - Flake8 linting configuration |
| 59 | +- `pyproject.toml` - Black, isort, mypy, pytest configuration |
| 60 | +- `requirements.txt` - Python dependencies |
| 61 | + |
| 62 | +## 🚀 Triggering Workflows |
| 63 | + |
| 64 | +### Automatic Triggers |
| 65 | +- **Push to main/master/develop**: Runs CI/CD and Code Quality |
| 66 | +- **Pull Requests**: Runs CI/CD and Code Quality |
| 67 | +- **Weekly Schedule**: Runs Performance Tests and Dependency Updates |
| 68 | +- **Version Tags**: Runs Release workflow |
| 69 | + |
| 70 | +### Manual Triggers |
| 71 | +All workflows can be triggered manually through the GitHub Actions interface: |
| 72 | +1. Go to the **Actions** tab in your repository |
| 73 | +2. Select the workflow you want to run |
| 74 | +3. Click **Run workflow** |
| 75 | +4. Choose the branch and any required inputs |
| 76 | + |
| 77 | +## 📋 Requirements |
| 78 | + |
| 79 | +### Secrets Required |
| 80 | +- `GITHUB_TOKEN` (automatically provided) |
| 81 | + |
| 82 | +### Optional Secrets |
| 83 | +- `CODECOV_TOKEN` (for code coverage reporting) |
| 84 | +- `DOCKER_HUB_USERNAME` and `DOCKER_HUB_TOKEN` (for Docker registry) |
| 85 | + |
| 86 | +## 🛠️ Customization |
| 87 | + |
| 88 | +### Adding New Tests |
| 89 | +1. Add test files to the `tests/` directory |
| 90 | +2. Tests will automatically run in the CI pipeline |
| 91 | + |
| 92 | +### Modifying Python Versions |
| 93 | +Edit the `matrix.python-version` in `ci.yml`: |
| 94 | +```yaml |
| 95 | +strategy: |
| 96 | + matrix: |
| 97 | + python-version: [3.9, 3.10, 3.11, 3.12] |
| 98 | +``` |
| 99 | +
|
| 100 | +### Changing Schedule |
| 101 | +Modify the `cron` expression in workflow files: |
| 102 | +```yaml |
| 103 | +schedule: |
| 104 | + - cron: '0 9 * * 1' # Every Monday at 9 AM UTC |
| 105 | +``` |
| 106 | + |
| 107 | +### Adding Environment Variables |
| 108 | +Add to the workflow file: |
| 109 | +```yaml |
| 110 | +env: |
| 111 | + MY_VARIABLE: value |
| 112 | +``` |
| 113 | + |
| 114 | +## 🔍 Monitoring |
| 115 | + |
| 116 | +### Viewing Results |
| 117 | +- **Actions Tab**: See all workflow runs and their status |
| 118 | +- **Artifacts**: Download test reports, coverage reports, and logs |
| 119 | +- **Checks**: See status on Pull Requests |
| 120 | + |
| 121 | +### Notifications |
| 122 | +- **Email**: GitHub sends notifications for failed workflows |
| 123 | +- **Status Checks**: Required checks prevent merging with failures |
| 124 | +- **Slack/Discord**: Can be integrated with webhooks |
| 125 | + |
| 126 | +## 🐛 Troubleshooting |
| 127 | + |
| 128 | +### Common Issues |
| 129 | + |
| 130 | +1. **Tests Failing**: Check the test logs in the Actions tab |
| 131 | +2. **Dependencies**: Update requirements.txt if imports fail |
| 132 | +3. **Python Version**: Ensure compatibility with all tested versions |
| 133 | +4. **Docker Build**: Check Dockerfile syntax and dependencies |
| 134 | + |
| 135 | +### Debug Mode |
| 136 | +Add this to any workflow step for debugging: |
| 137 | +```yaml |
| 138 | +- name: Debug |
| 139 | + run: | |
| 140 | + echo "Debug information" |
| 141 | + env |
| 142 | + ls -la |
| 143 | +``` |
| 144 | + |
| 145 | +## 📚 Resources |
| 146 | + |
| 147 | +- [GitHub Actions Documentation](https://docs.github.com/en/actions) |
| 148 | +- [Workflow Syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions) |
| 149 | +- [Marketplace Actions](https://github.com/marketplace?type=actions) |
0 commit comments