Fix coverage report generation. (#81)

* Fix coverage report generation.

* Only run action on push to main

* Don't run tests on tests themselves.

* Fix on push directive
This commit is contained in:
Felix Weiler
2024-02-23 11:14:23 +08:00
committed by GitHub
parent d9df091d2f
commit 334f8a257d
2 changed files with 29 additions and 32 deletions

View File

@@ -1,8 +1,10 @@
name: Tests
on:
- push
- pull_request
push:
branches:
- main
pull_request:
jobs:
tests:
@@ -36,18 +38,12 @@ jobs:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
- run: poetry install --no-interaction # --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
# Now install _your_ project. This isn't necessary for many types of projects -- particularly
# things like Django apps don't need this. But it's a good idea since it fully-exercises the
# pyproject.toml and makes that if you add things like console-scripts at some point that
# they'll be installed and working.
- run: poetry install --no-interaction
# - run: poetry install --no-interaction
# And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml`
# so this line is super-simple. But it could be as complex as you need.
- run: poetry run pytest --cov
- run: poetry run pytest --cov --cov-report xml
- name: Upload coverage roports to Codecov
uses: codecov/codecov-action@v4

View File

@@ -59,7 +59,8 @@ tests = ["tests", "*/tests"]
[tool.coverage.run]
branch = true
source = ["heisskleber", "tests"]
source = ["heisskleber"]
omit = ["tests/*"]
[tool.coverage.report]
show_missing = true
@@ -79,28 +80,28 @@ target-version = "py39"
line-length = 120
fix = true
select = [
"YTT", # flake8-2020
"S", # flake8-bandit
"B", # flake8-bugbear
"A", # flake8-builtins
"C4", # flake8-comprehensions
"T10", # flake8-debugger
"SIM", # flake8-simplify
"I", # isort
"C90", # mccabe
"E",
"W", # pycodestyle
"F", # pyflakes
"PGH", # pygrep-hooks
"UP", # pyupgrade
"RUF", # ruff
"TRY", # tryceratops
"YTT", # flake8-2020
"S", # flake8-bandit
"B", # flake8-bugbear
"A", # flake8-builtins
"C4", # flake8-comprehensions
"T10", # flake8-debugger
"SIM", # flake8-simplify
"I", # isort
"C90", # mccabe
"E",
"W", # pycodestyle
"F", # pyflakes
"PGH", # pygrep-hooks
"UP", # pyupgrade
"RUF", # ruff
"TRY", # tryceratops
]
ignore = [
"E501", # LineTooLong
"E731", # DoNotAssignLambda
"A001", #
"PGH003", # Use specific rules when ignoring type issues
"E501", # LineTooLong
"E731", # DoNotAssignLambda
"A001", #
"PGH003", # Use specific rules when ignoring type issues
]
[tool.ruff.per-file-ignores]