From 57628c124a8a172def7fe97ad07ba08716d8e0a7 Mon Sep 17 00:00:00 2001 From: Valentina Vecchio Date: Fri, 18 Apr 2025 15:57:06 +0100 Subject: [PATCH] feat: add coverage.yml --- .github/workflows/coverage.yml | 32 ++++++++++++++++++++++++++++++++ README.md | 2 ++ pyproject.toml | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..721f4a9 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,32 @@ +name: Test Coverage + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ".[dev]" + + - name: Run tests with coverage + run: | + pytest --cov --cov-branch --cov-report=xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} # Optional if public repo diff --git a/README.md b/README.md index a082a03..3d3e461 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![codecov](https://codecov.io/gh/bualust/RandomFPL/branch/main/graph/badge.svg)](https://codecov.io/gh/bualust/RandomFPL) + # RandomFPL A quick script to generate a pseudo-random Fantasy Premier League team. diff --git a/pyproject.toml b/pyproject.toml index 47c1377..fe5b907 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,4 +20,4 @@ asyncio_mode = "strict" asyncio_default_fixture_loop_scope = "function" [project.optional-dependencies] -dev = ["pytest"] +dev = ["pytest","pytest-cov"]