Skip to content

Commit 8d9d6a9

Browse files
authored
Merge pull request #10 from lihuacai168/feature/comprehensive-improvements
feature/comprehensive-improvements
2 parents 9319ef4 + 004d736 commit 8d9d6a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6510
-413
lines changed

.env.example

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Application settings
2+
APP_NAME=JMeter Toolkit
3+
APP_VERSION=2.0.0
4+
DEBUG=false
5+
ENVIRONMENT=production
6+
LOG_LEVEL=INFO
7+
LOG_FILE=
8+
SECRET_KEY=your-secret-key-change-in-production
9+
10+
# Server settings
11+
HOST=0.0.0.0
12+
PORT=8000
13+
RELOAD=false
14+
15+
# Database settings
16+
DATABASE_URL=postgresql://jmeter:jmeter@localhost:5432/jmeter_toolkit
17+
DATABASE_ECHO=false
18+
19+
# Redis settings
20+
REDIS_URL=redis://localhost:6379/0
21+
22+
# Celery settings
23+
CELERY_BROKER_URL=redis://localhost:6379/0
24+
CELERY_RESULT_BACKEND=redis://localhost:6379/0
25+
26+
# File settings
27+
UPLOAD_MAX_SIZE=104857600 # 100MB
28+
ALLOWED_FILE_EXTENSIONS=[".jmx"]
29+
30+
# JMeter settings
31+
JMETER_VERSION=5.5
32+
JMETER_HOME=/opt/apache-jmeter-5.5
33+
JMETER_MAX_HEAP=2g
34+
JMETER_TIMEOUT=3600
35+
36+
# Security settings
37+
ALLOWED_HOSTS=["*"]
38+
CORS_ORIGINS=["*"]
39+
40+
# Monitoring settings
41+
ENABLE_METRICS=true
42+
METRICS_PORT=9090
43+
44+
# Logging settings
45+
LOG_ROTATION=1 day
46+
LOG_RETENTION=30 days

.flake8

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[flake8]
2+
max-line-length = 127
3+
max-complexity = 10
4+
exclude =
5+
.git,
6+
__pycache__,
7+
venv,
8+
.venv,
9+
htmlcov,
10+
.pytest_cache,
11+
build,
12+
dist,
13+
*.egg-info
14+
ignore =
15+
E203,
16+
E501,
17+
W503,
18+
F401
19+
per-file-ignores =
20+
__init__.py:F401
21+
*/migrations/*:E501,F401
22+
tests/*:E501,F401
23+
select = E,W,F,C
24+
statistics = True
25+
count = True

.github/workflows/README.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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+
![CI/CD](https://github.com/YOUR_USERNAME/jmeter_toolit/workflows/CI/CD%20Pipeline/badge.svg)
51+
![Code Quality](https://github.com/YOUR_USERNAME/jmeter_toolit/workflows/Code%20Quality/badge.svg)
52+
![Security](https://github.com/YOUR_USERNAME/jmeter_toolit/workflows/Security%20Scan/badge.svg)
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

Comments
 (0)