This project includes comprehensive CI/CD workflows to automate testing, building, and deployment.
Runs on every push and pull request to main and develop branches.
What it does:
- ✅ Runs Python tests against Redis service
- ✅ Code linting with flake8
- ✅ Code formatting check with black
- ✅ Import sorting with isort
- ✅ Security scanning with bandit
- ✅ Dependency scanning with safety
- ✅ Coverage reports uploaded to Codecov
Triggers: Push to main/develop, Pull requests
Builds and pushes Docker images to Docker Hub and GitHub Container Registry.
What it does:
- 🐳 Builds Docker images for gateway, worker, and dashboard
- 📤 Pushes to Docker Hub and GitHub Container Registry
- 🔍 Scans images for vulnerabilities with Trivy
- 📦 Semantic versioning from git tags
Triggers: Push to main, tags matching v*
Requires Secrets:
DOCKER_USERNAME- Docker Hub usernameDOCKER_PASSWORD- Docker Hub access token
Analyzes code quality, complexity, and dependencies.
What it does:
- 📊 Code complexity analysis with Radon
- 🔍 Type checking with mypy
- 🎯 Detailed linting with pylint
- 📝 Docstring coverage check
- 🛡️ Dependency vulnerability checks
- 💎 SonarCloud analysis
Triggers: Push to main/develop, Pull requests
Requires Secrets:
SONAR_TOKEN- SonarCloud API token
Builds and deploys documentation to GitHub Pages.
What it does:
- 📚 Builds documentation with MkDocs
- 🎨 Uses Material theme
- 🌐 Deploys to GitHub Pages
- 📄 Converts markdown files to docs
Triggers: Push to main
Creates releases and publishes to PyPI.
What it does:
- 🏷️ Creates GitHub Release with changelog
- 📦 Publishes Python package to PyPI
- 📝 Auto-generates release notes
Triggers: Git tags matching v*
Requires Secrets:
PYPI_API_TOKEN- PyPI authentication token
Go to your GitHub repository → Settings → Secrets and variables → Actions
Add these secrets:
# For Docker image publishing (optional but recommended)
DOCKER_USERNAME=your_dockerhub_username
DOCKER_PASSWORD=your_dockerhub_access_token
# For PyPI publishing (optional)
PYPI_API_TOKEN=your_pypi_token
# For SonarCloud analysis (optional)
SONAR_TOKEN=your_sonarcloud_tokenDocker Hub Access Token:
- Go to https://hub.docker.com/settings/security
- Click "New Access Token"
- Copy and save as
DOCKER_PASSWORD
PyPI Token:
- Go to https://pypi.org/account/
- Create API token in Account Settings
- Use token as
PYPI_API_TOKEN
SonarCloud Token:
- Go to https://sonarcloud.io/account/security
- Generate token
- Use as
SONAR_TOKEN
Edit .github/workflows/*.yml files to match your needs:
# Example: Change branches in ci.yml
on:
push:
branches: [ main, staging ] # Add your branches
pull_request:
branches: [ main, staging ]- Go to Settings → Pages
- Select "Deploy from a branch"
- Select
gh-pagesbranch and/ (root)folder - Click Save
For local development, install pre-commit hooks:
pip install pre-commit
pre-commit install
# Test it
pre-commit run --all-filesThis will automatically run checks before committing code locally.
# Any push to main will trigger CI
git push origin main
# Or create a pull request# Create a git tag
git tag -a v1.0.0 -m "Release version 1.0.0"
# Push tag to trigger release workflow
git push origin v1.0.0
# This will:
# 1. Create GitHub Release
# 2. Build Docker images
# 3. Publish to PyPI- Go to your GitHub repo
- Click "Actions" tab
- See all workflow runs
- Click on a run to see detailed logs
After CI completes:
- Go to codecov.io
- Sign in with GitHub
- Select your repository
- View coverage reports and trends
Add these badges to your README.md:



[](https://codecov.io/gh/surukanti/distributed-task-queue-python)
[](https://sonarcloud.io/dashboard?id=distributed-task-queue-python)# Via GitHub CLI
gh workflow list
# View specific workflow runs
gh run list --workflow=ci.yml- Click on the failed workflow run
- Click on the failed job
- View detailed logs
- Look for error messages
| Issue | Solution |
|---|---|
| Docker push fails | Check DOCKER_USERNAME and DOCKER_PASSWORD secrets |
| PyPI publish fails | Verify PYPI_API_TOKEN is correct |
| Tests fail in CI but pass locally | Check Python version mismatch (uses 3.11) |
| SonarCloud not reporting | Add SONAR_TOKEN secret |
# Run tests locally
pip install pytest pytest-cov
pytest tests/ --cov=src/black src/ tests/
isort src/ tests/
flake8 src/ tests/docker build -f Dockerfile.gateway -t task-queue-gateway:latest .
docker build -f Dockerfile.worker -t task-queue-worker:latest .
docker build -f Dockerfile.dashboard -t task-queue-dashboard:latest .- ✅ Add repository secrets (DOCKER_USERNAME, DOCKER_PASSWORD, etc.)
- ✅ Create initial commit with workflows
- ✅ Monitor first CI run
- ✅ Set up SonarCloud and Codecov (optional but recommended)
- ✅ Create first release tag (
v1.0.0) - ✅ Monitor Docker image builds
- ✅ Enable GitHub Pages for documentation
Questions? Check the workflow files in .github/workflows/ for detailed comments.