Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 40 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,71 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
- name: Detect Python project
id: pyproject
run: |
if [ -f backend/pyproject.toml ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "path=backend" >> "$GITHUB_OUTPUT"
elif [ -f pyproject.toml ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "path=." >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Set up Python (with cache)
if: steps.pyproject.outputs.exists == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: ${{ steps.pyproject.outputs.path }}/pyproject.toml

- name: Set up Python (without cache, no pyproject.toml yet)
if: steps.pyproject.outputs.exists != 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
if: steps.pyproject.outputs.exists == 'true'
working-directory: ${{ steps.pyproject.outputs.path }}
run: |
python -m pip install --upgrade pip
if [ -f pyproject.toml ]; then
pip install -e ".[dev]" || true
else
echo "Skipping — no pyproject.toml yet"
exit 0
fi
pip install -e ".[dev]"

- name: Ruff lint
if: hashFiles('pyproject.toml') != ''
if: steps.pyproject.outputs.exists == 'true'
working-directory: ${{ steps.pyproject.outputs.path }}
run: ruff check .

- name: Ruff format check
if: hashFiles('pyproject.toml') != ''
if: steps.pyproject.outputs.exists == 'true'
working-directory: ${{ steps.pyproject.outputs.path }}
run: ruff format --check .

- name: Mypy
if: hashFiles('pyproject.toml') != ''
run: mypy app/ || true # warn-only until app/ has content
if: steps.pyproject.outputs.exists == 'true'
working-directory: ${{ steps.pyproject.outputs.path }}
run: mypy app/
Comment on lines 67 to +70

- name: Tests
if: hashFiles('pyproject.toml') != ''
if: steps.pyproject.outputs.exists == 'true'
working-directory: ${{ steps.pyproject.outputs.path }}
run: pytest --cov=app --cov-report=xml -v

- name: Upload coverage
if: always() && hashFiles('coverage.xml') != ''
if: always() && hashFiles('backend/coverage.xml', 'coverage.xml') != ''
uses: codecov/codecov-action@v4
with:
files: coverage.xml
files: backend/coverage.xml,coverage.xml
fail_ci_if_error: false

- name: No-op (no Python project yet — skipped)
if: steps.pyproject.outputs.exists != 'true'
run: echo "No pyproject.toml found — skipping Python checks for this branch"

go:
name: Go — vet, test
runs-on: ubuntu-24.04
Expand Down
Loading