2023-08-15 13:17:14 +02:00

68 lines
2.2 KiB
YAML

name: Web application CI
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: ${{ matrix.os }}, python ${{ matrix.python-version }}