From 242d60f5466a545f1269e201f312ec528c973ec0 Mon Sep 17 00:00:00 2001 From: Pradeep Tammali Date: Sat, 6 Apr 2024 23:40:37 +0200 Subject: [PATCH] fix: minor fixes --- Makefile | 3 +++ README.md | 9 ++++++++- codecov/settings.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3659a68..e06961e 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ lint: test: pipenv run pytest tests/* --cov +report: + pipenv run pytest tests --cov-branch --cov=codecov --cov-report=json:/tmp/report.json + build: python3 -m build diff --git a/README.md b/README.md index 436f11a..63df4f9 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Create a Coverage report comment on Github PR run: +To generate the pytest coverage report + +```bash +pipenv run pytest tests --cov-branch --cov=codecov --cov-report=json:/tmp/report.json +``` + ```bash GITHUB_REPOSITORY= \ COVERAGE_PATH= \ @@ -62,13 +68,14 @@ Note: Either `GITHUB_PR_NUMBER` or `GITHUB_REF` is required. ## Optional Environment Variables - `GITHUB_BASE_REF`: The base branch for the pull request. Default is `main`. -- `SUBPROJECT_ID`: The ID or URL of the subproject or report. (Optional) +- `SUBPROJECT_ID`: The ID or URL of the subproject or report. - `MINIMUM_GREEN`: The minimum coverage percentage for green status. Default is 100. - `MINIMUM_ORANGE`: The minimum coverage percentage for orange status. Default is 70. - `ANNOTATE_MISSING_LINES`: Whether to annotate missing lines in the coverage report. Default is False. - `ANNOTATION_TYPE`: The type of annotation to use for missing lines. Default is 'warning'. - `MAX_FILES_IN_COMMENT`: The maximum number of files to include in the coverage report comment. Default is 25. - `COMPLETE_PROJECT_REPORT`: Whether to include the complete project coverage report in the comment. Default is False. +- `COVERAGE_REPORT_URL`: URL of the full coverage report to mention in the comment. - `DEBUG`: Whether to enable debug mode. Default is False. That's it! You have successfully cloned the repository and built the project. diff --git a/codecov/settings.py b/codecov/settings.py index 98ac80d..7a29a83 100644 --- a/codecov/settings.py +++ b/codecov/settings.py @@ -44,7 +44,7 @@ class Config: GITHUB_TOKEN: str = dataclasses.field(repr=False) GITHUB_PR_NUMBER: int | None = None # Branch to run the action on (alternate to get PR number if not provided) - # Example Organisation:branch-name (Company:sample-branch) + # Example Organisation:branch-name (Company:sample-branch) or User:branch-name (user:sample-branch) GITHUB_REF: str | None = None GITHUB_BASE_REF: str = 'main' SUBPROJECT_ID: str | None = None