Skip to content
Merged
Show file tree
Hide file tree
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
84 changes: 84 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Backend CI

on:
pull_request:
paths:
- "backend/**"
push:
branches: [master]
paths:
- "backend/**"

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"

- name: Install dependencies
run: uv sync --dev

- name: Run ruff
run: uv run ruff check .

- name: Run mypy
run: uv run mypy src tests

- name: Run pytest with coverage
run: uv run pytest --cov=src --cov-report=term-missing --cov-fail-under=70

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: lint-test
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install npm dependencies
run: npm ci

- name: Install Python dependencies
run: uv sync --dev

- name: Deploy Cloudflare Worker
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
run: uv run pywrangler deploy
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name: Flutter Tests
on:
push:
branches: [master]
paths-ignore:
- "backend/**"
pull_request:
paths-ignore:
- "backend/**"

jobs:
test:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# Python
__pycache__/
.venv/
.pytest_cache/
.ruff_cache/
.coverage
htmlcov/
1 change: 1 addition & 0 deletions backend/src/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def fetch(self, request: Request) -> Response:
use_case=_USE_CASE,
config=_CONFIG,
)

if result.body is None:
return Response(status=result.status, headers=result.headers)
return Response(result.body, status=result.status, headers=result.headers)
Loading