53 lines
1.3 KiB
YAML
53 lines
1.3 KiB
YAML
name: Backend Format
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "backend/**"
|
|
- "scripts/**"
|
|
- "pyproject.toml"
|
|
- ".github/workflows/backend-format.yml"
|
|
|
|
jobs:
|
|
format:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -e .[dev]
|
|
|
|
- name: Run black
|
|
run: |
|
|
source .venv/bin/activate
|
|
black backend
|
|
|
|
- name: Run isort
|
|
run: |
|
|
source .venv/bin/activate
|
|
isort backend
|
|
|
|
- name: Run pytest
|
|
run: |
|
|
source .venv/bin/activate
|
|
pytest backend/tests
|
|
|
|
- name: Upload formatting diff
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: backend-formatting-diff
|
|
path: |
|
|
backend
|