This project uses GitHub Actions to automate testing, code quality checks, and security scanning on every push and pull request. The pipeline ensures that all code changes meet quality standards before being merged.
The CI/CD pipeline consists of five main jobs that run in parallel or sequentially:
┌─────────────────────────────────────────────────────────┐
│ Push/Pull Request │
└─────────────────────────────────────────────────────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
┌────────┐ ┌──────┐ ┌──────────┐
│ Test │ │ Lint │ │ Security │
└────────┘ └──────┘ └──────────┘
│
▼
┌──────────────────┐
│ Integration Test │
└──────────────────┘
│
▼
┌──────────────────┐
│ Build Status │
└──────────────────┘
Purpose: Run unit tests across multiple Python versions
Matrix Strategy:
- Python versions: 3.8, 3.9, 3.10, 3.11, 3.12
- Runs tests in parallel for each version
Steps:
- Checkout code
- Set up Python environment with caching
- Install dependencies (including pytest-cov and pytest-html)
- Create required directories (data/backups, out, .logs)
- Run tests with coverage reporting
- Upload coverage to Codecov (Python 3.12 only)
- Upload test results as artifacts
- Verify coverage threshold (80% minimum for Python 3.12)
Artifacts:
test-results-{python-version}: HTML test reports and coverage data- Coverage reports in XML and HTML formats
Coverage Threshold: 80% minimum (enforced on Python 3.12)
Purpose: Ensure code quality and consistency
Tools:
- flake8: Python syntax and style checking
- Critical errors (E9, F63, F7, F82) fail the build
- Other issues are reported but don't fail the build
- black: Code formatting verification
- isort: Import statement sorting verification
Note: Linting issues are reported but don't fail the build (continue-on-error: true)
Purpose: Run comprehensive integration and quality tests
Dependencies: Requires the Test job to complete successfully
Test Suites:
- Integration tests (
test_integration.py) - Comprehensive quality suite (
test_comprehensive_quality_suite.py) - API tests (
test_api.py)
Purpose: Scan for security vulnerabilities
Tools:
- safety: Check dependencies for known security vulnerabilities
- bandit: Static security analysis of Python code
Artifacts:
security-reports: JSON reports from security scans
Note: Security issues are reported but don't fail the build (continue-on-error: true)
Purpose: Aggregate results and determine overall build status
Dependencies: Requires all previous jobs to complete
Logic:
- ✅ Passes if Test and Integration Test jobs succeed
- ❌ Fails if Test or Integration Test jobs fail
- Lint and Security jobs are informational only
The pipeline runs on:
mainbranchdevelopbranchfeat/**branches (all feature branches)
- Targeting
mainbranch - Targeting
developbranch
Main workflow definition file containing all job configurations.
Pytest configuration including:
- Test discovery patterns
- Output options
- Coverage settings
Python dependencies including:
- Core application dependencies
- Testing tools (pytest, pytest-flask)
- Coverage tools (pytest-cov, pytest-html)
Before pushing, you can run the same checks locally:
# All tests with coverage
python -m pytest tests/ -v --cov=src --cov-report=html
# Specific test suite
python -m pytest tests/test_api.py -v
# With coverage threshold check
python -m pytest tests/ --cov=src --cov-fail-under=80# Install linting tools
pip install flake8 black isort
# Check syntax errors
flake8 src/ tests/ --select=E9,F63,F7,F82
# Check all style issues
flake8 src/ tests/ --max-complexity=10 --max-line-length=127
# Check formatting
black --check src/ tests/
# Check import sorting
isort --check-only src/ tests/# Install security tools
pip install safety bandit
# Check dependencies
safety check
# Scan code
bandit -r src/- Go to the repository on GitHub
- Click the "Actions" tab
- Select a workflow run to view details
- Click on individual jobs to see logs
Test results and coverage reports are uploaded as artifacts:
- Navigate to a completed workflow run
- Scroll to the "Artifacts" section at the bottom
- Download artifacts to view locally
The README includes a status badge showing the current build status:
[](https://github.com/BPMSoftwareSolutions/agentic-resume-tailor/actions/workflows/ci.yml)The pipeline includes Codecov integration for coverage tracking:
- Sign up at codecov.io
- Add the repository
- Get the upload token
- Add
CODECOV_TOKENto repository secrets:- Go to Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
CODECOV_TOKEN - Value: Your Codecov token
If you don't set up Codecov, the pipeline will still work. The coverage upload step will be skipped (fail_ci_if_error: false).
Possible causes:
- Environment differences: CI uses a clean environment
- Missing dependencies: Check requirements.txt is complete
- File paths: Use Path objects and relative paths
- Python version: Test locally with multiple Python versions
Solution:
# Test with specific Python version
python3.8 -m pytest tests/ -v
python3.12 -m pytest tests/ -vCause: Test coverage below 80%
Solution:
- Add tests for uncovered code
- Remove dead code
- Adjust threshold in
.github/workflows/ci.ymlif appropriate
Cause: Code style issues
Solution:
# Auto-fix formatting
black src/ tests/
# Auto-fix imports
isort src/ tests/
# Check remaining issues
flake8 src/ tests/Cause: Vulnerable dependencies or insecure code patterns
Solution:
- Update vulnerable dependencies:
pip install --upgrade <package> - Review bandit findings and fix security issues
- Add
# noseccomments for false positives (with justification)
- ✅ Run tests locally:
python -m pytest tests/ -v - ✅ Check coverage:
python -m pytest tests/ --cov=src - ✅ Run linting:
black src/ tests/ && isort src/ tests/ - ✅ Review changes:
git diff
- Follow TDD (Test-Driven Development)
- Maintain high coverage (>80%)
- Test edge cases and error conditions
- Use descriptive test names
- Keep tests independent and isolated
- Ensure all CI checks pass before requesting review
- Address any linting or security warnings
- Update documentation if needed
- Keep PRs focused and reasonably sized
Edit .github/workflows/ci.yml:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']- Create test file in
tests/directory - Follow naming convention:
test_*.py - Tests will be automatically discovered and run
Edit .github/workflows/ci.yml:
- name: Check test coverage threshold
run: |
python -m pytest tests/ --cov=src --cov-fail-under=85 # Change from 80 to 85For issues with the CI/CD pipeline:
- Check the GitHub Actions documentation
- Review workflow logs for specific error messages
- Open an issue in the repository with details