mirror of
https://github.com/Kludex/awesome-fastapi-projects.git
synced 2024-11-30 15:31:07 +00:00
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
|
name: Python App Quality and Testing
|
||
|
|
||
|
on: [push]
|
||
|
|
||
|
|
||
|
jobs:
|
||
|
quality:
|
||
|
runs-on: ubuntu-latest
|
||
|
strategy:
|
||
|
matrix:
|
||
|
python-version: [3.11]
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
- name: Set up Python
|
||
|
uses: actions/setup-python@v4
|
||
|
with: # https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
|
||
|
python-version: ${{ matrix.python-version }}
|
||
|
cache: "pip"
|
||
|
cache-dependency-path: "requirements/dev.txt"
|
||
|
- name: Install dev dependencies
|
||
|
run: |
|
||
|
python -m pip install --upgrade pip
|
||
|
python -m pip install -r requirements/dev.txt
|
||
|
- name: Lint with ruff
|
||
|
run: |
|
||
|
python -m ruff check --verbose --format=github .
|
||
|
- name: Lint with mypy
|
||
|
run: |
|
||
|
python -m mypy --show-error-codes --pretty --show-column-numbers --show-error-context .
|
||
|
- name: Lint with black
|
||
|
run: |
|
||
|
python -m black --check --verbose .
|
||
|
- name: Lint with pyproject-fmt
|
||
|
run: |
|
||
|
python -m pyproject_fmt --check --indent=4 .
|
||
|
test:
|
||
|
needs: [quality]
|
||
|
runs-on: ubuntu-latest
|
||
|
strategy:
|
||
|
matrix:
|
||
|
python-version: [3.11]
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
- name: Set up Python
|
||
|
uses: actions/setup-python@v4
|
||
|
with: # https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
|
||
|
python-version: ${{ matrix.python-version }}
|
||
|
cache: "pip"
|
||
|
cache-dependency-path: "requirements/test.txt"
|
||
|
- name: Install test dependencies
|
||
|
run: |
|
||
|
python -m pip install --upgrade pip
|
||
|
python -m pip install -r requirements/test.txt
|
||
|
- name: Test with pytest
|
||
|
run: |
|
||
|
python -m pytest -v -s --failed-first --cov=app --cov-report=xml --cov-branch
|
||
|
- name: Generate Coverage Report
|
||
|
run: |
|
||
|
python -m coverage report -m
|
||
|
- name: Upload coverage to Codecov
|
||
|
env:
|
||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||
|
if: ${{ env.CODECOV_TOKEN }}
|
||
|
uses: codecov/codecov-action@v1
|
||
|
with:
|
||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||
|
file: coverage.xml
|
||
|
name: python ${{ matrix.python-version }}
|