Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add a codecov token to the coverage pipeline #1519

Merged
merged 8 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ on:
pull_request:
workflow_call:

env:
COVERAGE_THRESHOLD: 60

jobs:
lint:
strategy:
Expand Down Expand Up @@ -91,12 +88,12 @@ jobs:
pip install nox
nox -s compile
- name: Run tests
run: pytest -m "not a11y" --color=yes --cov pydata_sphinx_theme --cov-branch --cov-report xml:cov.xml --cov-report= --cov-fail-under ${{ env.COVERAGE_THRESHOLD }}
run: pytest -m "not a11y" --color=yes --cov --cov-report=xml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look right to me:

  • the second --cov-report= with no argument is supposed to suppress the coverage output in the terminal output (which we don't need because we're generating XML and then viewing it through CodeCov website)
  • I think we still want --branch (can be branch = true under tool.coverage.run in the TOML file if you prefer)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to limit the number of parameter in the github actions so that we can rely exclusively on the nox session in the future. I'll add them to the TOML file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the difference between the output of the current main and this branch and I don't see the difference in term of terminal output:
image

@drammock, are you sure the second --cov-report is really changing anything in the terminal output? (left is the current PR, right is the current main)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, that's what is supposed to happen according to the docs but I agree that it's definitely not looking different. 🤷🏻

- name: Upload to Codecov
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3
with:
files: cov.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

# note I am setting this on top of the Python cache as I could not find
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,10 @@ ignore = "H006,J018,T003,H025"

[tool.pytest.ini_options]
markers = "a11y: mark a test as an accessibility test"

[tool.coverage.run]
source = ["pydata_sphinx_theme"]
branch = true

[tool.coverage.report]
fail_under = 60
Loading