diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..e4fe6b2 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,45 @@ +name: Coverage + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + test-and-print-coverage: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + uv venv && uv pip install -e '.[dev]' coverage + + - name: Run tests with coverage + run: uv run coverage run -m unittest + + - name: Print coverage summary + run: uv run coverage report -m --fail-under=70 + + - name: Generate coverage XML + run: uv run coverage xml -o coverage.xml + + - name: Upload coverage to Codecov + if: ${{ !cancelled() && hashFiles('coverage.xml') != '' }} + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: connectors + fail_ci_if_error: false + verbose: true diff --git a/pyproject.toml b/pyproject.toml index 94ab2cf..45e30a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,8 @@ dev = [ "types-pytz (>=2025.2.0.20250326,<2025.3.0.0)", "pre-commit (>=4.2.0,<4.3.0)", "types-python-dateutil (>=2.9.0,<2.10.0)", - "wheel (>=0.45.1,<0.46.0)" + "wheel (>=0.45.1,<0.46.0)", + "coverage>=7.13.5" ] doc = [ "autoapi (>=2.0.1,<2.1.0)",