Skip to content

Commit

Permalink
ci: Fixes the writing of the coverage file (#231)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
frgfm authored Jan 24, 2024
1 parent 39669e3 commit c66627f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c66627f

Please sign in to comment.