58 lines
1.2 KiB
YAML
58 lines
1.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
pre-commit:
|
|
name: Pre-commit checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install tooling
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pre-commit
|
|
pip install -r backend/requirements.txt || true
|
|
pip install pytest
|
|
|
|
- name: Run pre-commit hooks
|
|
run: pre-commit run --all-files
|
|
|
|
test:
|
|
name: Run tests
|
|
needs: pre-commit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r backend/requirements.txt || true
|
|
pip install pytest
|
|
|
|
- name: Run tests
|
|
run: |
|
|
if [ -d backend/tests ]; then pytest -q; else echo "No tests found"; fi
|