- Added Codecov configuration to enforce 75% coverage. - Created .dockerignore to exclude unnecessary files from Docker context. - Implemented GitHub Actions CI workflow for linting, testing, and coverage reporting. - Added a workflow to propagate changes between main and development branches. - Configured pre-commit hooks for code quality checks. - Developed a multi-stage Dockerfile for a Python web backend. - Added MIT License to the project. - Created README.md with project overview and setup instructions. - Implemented a script to create GitHub issues from project planning. - Defined development and runtime requirements in requirements.txt and requirements.dev.txt.
71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
name: CI - Lint, Test & Coverage
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, development, 'feature/**' ]
|
|
pull_request:
|
|
branches: [ main, development ]
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint (ruff & flake8)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Cache pip
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dev dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.dev.txt
|
|
- name: Run ruff
|
|
run: |
|
|
ruff check .
|
|
- name: Run flake8
|
|
run: |
|
|
flake8 . || true
|
|
|
|
test-and-coverage:
|
|
name: Tests & Coverage
|
|
runs-on: ubuntu-latest
|
|
needs: [lint]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Cache pip
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt || true
|
|
pip install -r requirements.dev.txt
|
|
- name: Run tests with coverage
|
|
run: |
|
|
# run pytest under coverage and fail if tests fail
|
|
coverage run -m pytest -q
|
|
coverage report -m --fail-under=75
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
fail_ci_if_error: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# Optional: set CODECOV_TOKEN in repo secrets if needed for private repos
|