Skip to content

ci: Generate coverage report on running tests using GH actions #213

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

Open
wants to merge 3 commits into
base: 0.10
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
omit =
/tests
/*/__init__.py
/setup.py
relative_files = true
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ jobs:
run: cd ../supertokens-root && ./loadModules
- name: Setting up supertokens-root test environment
run: cd ../supertokens-root && bash ./utils/setupTestEnvLocal
- name: Run tests
run: make test
- name: Run tests with coverage report
run: make coverage
- uses: khaeru/codecov-gh@v1
with:
token: ${{ github.token }}
data-file: .coverage
Comment on lines +56 to +59
Copy link

Choose a reason for hiding this comment

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

The GitHub action khaeru/codecov-gh@v1 appears to be a non-official fork. For better reliability and support, consider using the official Codecov action codecov/codecov-action@v3.

Additionally, the official action typically requires a dedicated Codecov token rather than the GitHub token for authentication with codecov.io. This should be configured as a repository secret (e.g., CODECOV_TOKEN).

Example implementation:

- uses: codecov/codecov-action@v3
  with:
    token: ${{ secrets.CODECOV_TOKEN }}
    file: .coverage
Suggested change
- uses: khaeru/codecov-gh@v1
with:
token: ${{ github.token }}
data-file: .coverage
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: .coverage

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ bin/
lib/
pyvenv.cfg
sqlite.db
.mypy_cache/
.mypy_cache/
htmlcov/
.coverage
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
help:
@echo " \x1b[33;1mcheck-lint: \x1b[0mtest styling of code for the library using flak8"
@echo " \x1b[33;1mtest: \x1b[0mruns pytest"
@echo " \x1b[33;1mcoverage: \x1b[0mruns pytest with coverage report"
@echo " \x1b[33;1mlint: \x1b[0mformat code using black"
@echo "\x1b[33;1mset-up-hooks: \x1b[0mset up various git hooks"
@echo " \x1b[33;1mdev-install: \x1b[0minstall all packages required for development"
Expand All @@ -19,6 +20,11 @@ set-up-hooks:
test:
pytest ./tests/

coverage:
coverage run -m pytest ./tests/
coverage report -m
coverage html

dev-install:
pip install -r dev-requirements.txt

Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ uvicorn==0.18.2
Werkzeug==2.0.3
wrapt==1.13.3
zipp==3.7.0
coverage==6.3.2