Skip to content

add github actions to run tests/lint/coverage #1

add github actions to run tests/lint/coverage

add github actions to run tests/lint/coverage #1

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
lint:
name: Lint (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
- name: Ruff
run: ruff check src tests
- name: Mypy
run: mypy src
test:
name: Tests + Coverage (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
- name: Run tests (with coverage)
run: |
pytest \
--cov=fastapi_dev_proxy \
--cov-report=term-missing \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov
- name: Coverage summary
if: always()
run: |
{
echo "## Coverage"
echo
python -m coverage report -m
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage XML
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-xml-py${{ matrix.python-version }}
path: coverage.xml
if-no-files-found: error
- name: Upload coverage HTML
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-html-py${{ matrix.python-version }}
path: htmlcov
if-no-files-found: error
- name: Upload to Codecov (optional)
if: always()
uses: codecov/codecov-action@v5
with:
files: coverage.xml
fail_ci_if_error: false
verbose: true