This repository includes a comprehensive GitHub Actions workflow for continuous integration and deployment.
The CI/CD pipeline (.github/workflows/ci.yml) includes four main jobs:
- Linting: Uses
flake8to check for Python syntax errors and code style issues - Formatting: Uses
blackto ensure consistent code formatting - Security: Uses
banditto scan for security vulnerabilities - Artifacts: Uploads security reports for review
- Python Versions: Tests on Python 3.7, 3.8, 3.9, 3.10, and 3.11
- Operating Systems: Tests on Ubuntu, Windows, and macOS
- Dependencies: Installs required system dependencies (ffmpeg, lame)
- Basic Validation: Syntax checks and import tests
- Security: Uses
safetyto check for known vulnerabilities in dependencies - Reports: Generates vulnerability reports as artifacts
- Status Check: Aggregates results from all previous jobs
- Final Report: Provides overall CI/CD status
The workflow runs on:
- Push to
mainormasterbranch - Pull requests to
mainormasterbranch - Manual trigger via GitHub UI (
workflow_dispatch)
The workflow automatically installs:
- Python Dependencies: Listed in
requirements.txt - System Dependencies:
- Ubuntu:
ffmpeg,lame - macOS:
ffmpeg,lame(via Homebrew) - Windows: Dependencies handled by pip packages
- Ubuntu:
- Caching: pip dependencies are cached to speed up builds
- Fail-Fast: Matrix builds fail independently to get faster feedback
- Parallel Execution: Jobs run concurrently when possible
- Pinned Actions: Uses specific versions of GitHub Actions
- Security Scanning: Multiple layers of security analysis
- Artifact Storage: Security and vulnerability reports are preserved
- Matrix Strategy: Reduces redundant testing while maintaining coverage
- Graceful Failures: Individual matrix jobs can fail without stopping others
- Detailed Reporting: Clear status messages for debugging
- Artifact Uploads: Reports are uploaded even when jobs fail
To run the same checks locally:
# Install dependencies
pip install -r requirements.txt
# Run linting
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# Check formatting
black --check --diff .
# Security scan
bandit -r .
# Dependency vulnerability check
pip install safety
safety check- Actions Tab: View workflow runs in the GitHub repository
- Pull Requests: Status checks appear in PR reviews
- Artifacts: Download detailed reports from completed runs
- Status Badges: Add workflow status badges to README if desired
The workflow can be customized by:
- Modifying the Python version matrix in
ci.yml - Adding or removing operating systems
- Adjusting code quality tool configurations
- Adding additional security or testing tools
- Modifying trigger conditions
For more information about GitHub Actions, see the official documentation.