Bump black from 23.9.1 to 23.12.1 in /backend #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend | |
on: | |
pull_request: | |
paths: | |
- "backend/**" | |
- ".github/workflows/backend.yml" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install linters | |
run: pip install black ruff mypy pydantic | |
if: always() | |
- name: Run black | |
run: black src tests --check | |
if: always() | |
- name: Run ruff | |
run: ruff check src tests | |
if: always() | |
- name: Run mypy | |
run: mypy src tests | |
if: always() | |
test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
services: | |
postgres: | |
image: "postgres:13.4" | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: db_test | |
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 5 | |
ports: | |
- 5432:5432 | |
env: | |
ENV: test | |
SQLALCHEMY_DATABASE_URI: postgresql://postgres:postgres@localhost:5432/db_test | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
export PATH='$HOME/.local/bin:$PATH' | |
- name: Cache Poetry virtualenv | |
uses: actions/cache@v3 | |
id: poetry-cache | |
with: | |
path: /home/runner/.cache/pypoetry/virtualenvs | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install Dependencies using Poetry | |
if: steps.poetry-cache.outputs.cache-hit != 'true' | |
run: poetry install | |
- name: Run pytest and generate coverage XML report | |
run: poetry run pytest -s -v --junitxml=artifacts/results.xml --cov=src/ --cov-report term --cov-report xml:artifacts/coverage.xml | |
- name: Archive test results and code coverage | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: code-coverage-report | |
path: backend/artifacts/* |