From c66627f81aa3c4e541ce7377af2f04d868330864 Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:59:43 +0100 Subject: [PATCH] ci: Fixes the writing of the coverage file (#231) * chore: Removes pytest xdist * docs: Updates makefile * ci: Fixes test coverage generation * ci: Fixes coverage upload * ci: Fixes coverage report upload * ci: Fixes test upload * ci: Fixes test upload --- .github/workflows/tests.yml | 21 +++++++++------------ Makefile | 2 +- pyproject.toml | 5 +++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf45567..62e4c71 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,24 +30,21 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e ".[test]" --upgrade + pip install -e ".[test]" - name: Run unittests - run: pytest --cov=torchcam --cov-report xml tests/ -n auto - - uses: actions/upload-artifact@v2 - with: - name: coverage-main - path: ./coverage.xml - - codecov-upload: - runs-on: ubuntu-latest - needs: pytest - steps: - - uses: actions/download-artifact@v2 + run: pytest --cov=torchcam --cov-report xml tests/ - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests fail_ci_if_error: true + - name: Backup upload + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + ./codecov -t ${CODECOV_TOKEN} -f ./coverage.xml --flags unittests --verbose headers: runs-on: ${{ matrix.os }} diff --git a/Makefile b/Makefile index 5df9a9a..1a30b3d 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ style: # Run tests for the library test: - pytest --cov=torchcam tests/ -n auto + pytest --cov=torchcam tests/ # Build documentation for current version single-docs: diff --git a/pyproject.toml b/pyproject.toml index ee87c58..6959fe6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,6 @@ test = [ "torchvision>=0.15.0,<1.0.0", "pytest>=7.3.2", "pytest-cov>=3.0.0,<5.0.0", - "pytest-xdist>=2.0.0,<4.0.0", "pytest-pretty>=1.0.0,<2.0.0", ] quality = [ @@ -75,7 +74,6 @@ dev = [ "torchvision>=0.15.0,<1.0.0", "pytest>=7.3.2", "pytest-cov>=4.0.0,<5.0.0", - "pytest-xdist>=3.0.0,<4.0.0", "pytest-pretty>=1.0.0,<2.0.0", # style "ruff==0.1.11", @@ -106,6 +104,9 @@ exclude = ["demo*", "docs*", "notebooks*", "scripts*", "tests*"] [tool.pytest.ini_options] testpaths = ["torchcam/"] +[tool.coverage.run] +source = ["torchcam/"] + [tool.ruff] select = [ "E", # pycodestyle errors