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
24 changes: 24 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
coverage:
status:
# 1. Project Coverage: Enforces rules on the entire codebase
project:
default:
target: auto # 'auto' means the PR cannot decrease the overall coverage
threshold: 1% # Allows a 1% drop margin for acceptable fluctuations

# 2. Patch Coverage: Enforces rules ONLY on the lines of code modified in the PR
patch:
default:
target: 80% # The specific requirement you asked for: 80% on new code

# 3. Ignore paths: Exclude test files and configs from coverage calculations
ignore:
- "tests/**/*"
- ".github/**/*"
- "**/__init__.py"

# Optional: Configure the Codecov PR comment bot
comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false # Always post a comment, even if coverage didn't change
43 changes: 43 additions & 0 deletions .github/workflows/pr-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: pr-gate

on:
pull_request:
branches:
- main

concurrency:
group: pr-gate-${{ github.head_ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.10.4"

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync
Comment on lines +32 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

uv sync will not install dev dependencies including pytest.

The dev dependency group (containing pytest, pytest-asyncio, pytest-cov) is not included by default with uv sync. Without the --group dev flag, pytest won't be available and the workflow will fail at the "Run tests" step.

🐛 Proposed fix
     - name: Install dependencies
-      run: uv sync
+      run: uv sync --group dev
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-gate.yml around lines 32 - 33, The "Install
dependencies" workflow step currently runs "uv sync" which omits the dev
dependency group (so pytest and friends aren't installed); update that step to
run "uv sync --group dev" (or otherwise ensure the dev extras are installed) so
the dev/test packages (pytest, pytest-asyncio, pytest-cov) are present for the
"Run tests" job.


- name: Run tests with coverage
run: uv run pytest --cov --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
67 changes: 0 additions & 67 deletions apps/telegram-bot/tests/conftest.py

This file was deleted.

101 changes: 0 additions & 101 deletions apps/telegram-bot/tests/test_webhook.py

This file was deleted.

115 changes: 0 additions & 115 deletions packages/shared/tests/test_user_setting.py

This file was deleted.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dev = [
"pytest>=8.3.5,<9.0.0",
"pytest-asyncio>=0.26.0,<0.27.0",
"celery-types>=0.24.0",
"pytest-cov>=7.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

What is the latest version of pytest-cov package on PyPI?

💡 Result:

The latest version of the pytest-cov package on PyPI is 7.0.0.

Citations:


Change pytest-cov version constraint from 7.1.0 to 7.0.0 or lower.

The version 7.1.0 does not exist on PyPI; the latest available version is 7.0.0. Update the constraint to pytest-cov>=7.0.0,<8.0.0 or specify an appropriate existing version.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` at line 58, Update the pytest-cov dependency constraint in
pyproject.toml: replace the non-existent "pytest-cov>=7.1.0" entry with a valid
version range such as "pytest-cov>=7.0.0,<8.0.0" (or a specific existing version
like "pytest-cov==7.0.0") so the dependency resolves correctly; edit the line
referencing pytest-cov in pyproject.toml accordingly.

]

[build-system]
Expand All @@ -74,3 +75,4 @@ fastfetchbot-file-export = { workspace = true }

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "module"
testpaths = ["tests"]
File renamed without changes.
Loading
Loading