From 0c9a7560ce1c1e28823fe556007e1ec4b033aa92 Mon Sep 17 00:00:00 2001 From: gonfff Date: Sat, 24 Jan 2026 21:31:36 +0300 Subject: [PATCH 1/3] Added CICD for backend --- .github/workflows/backend.yml | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/backend.yml diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 0000000..238e6f3 --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,84 @@ +name: Backend CI + +on: + pull_request: + paths: + - "backend/**" + push: + branches: [master] + paths: + - "backend/**" + +jobs: + 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: 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 From 7eb70b9bae7a347886e620f70fa74041141bbd7e Mon Sep 17 00:00:00 2001 From: gonfff Date: Sat, 24 Jan 2026 21:34:07 +0300 Subject: [PATCH 2/3] test --- .github/workflows/ci.yml | 4 ++++ backend/src/worker.py | 1 + 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d04548..e445f99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,11 @@ name: Flutter Tests on: push: branches: [master] + paths-ignore: + - "backend/**" pull_request: + paths-ignore: + - "backend/**" jobs: test: diff --git a/backend/src/worker.py b/backend/src/worker.py index b784546..39289ff 100644 --- a/backend/src/worker.py +++ b/backend/src/worker.py @@ -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) From 98f7c8dee18e89883f74f770bc7f42eab7fc5cfa Mon Sep 17 00:00:00 2001 From: gonfff Date: Sat, 24 Jan 2026 21:48:11 +0300 Subject: [PATCH 3/3] test --- .github/workflows/backend.yml | 2 +- .gitignore | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 238e6f3..11e24f7 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -10,7 +10,7 @@ on: - "backend/**" jobs: - lint-test: + test: runs-on: ubuntu-latest defaults: run: diff --git a/.gitignore b/.gitignore index 3820a95..536a6fb 100644 --- a/.gitignore +++ b/.gitignore @@ -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/