Create a Coverage report comment on Github PR
Project description
python-coverage-comment
Create a Coverage report comment on Github PR
run:
GITHUB_REPOSITORY=<repository_name> \
COVERAGE_PATH=<path_to_coverage_report> \
GITHUB_TOKEN=<github_token> \
GITHUB_PR_NUMBER=<pull_request_number> \
codecov
Setting up Local Environment using Pipenv
To get started, follow these steps:
-
Clone the repository:
git clone <repository_url>
-
Navigate to the cloned repository:
cd <repository_directory>
-
Build the project:
make all
-
Export the required environment variables:
export GITHUB_REPOSITORY=<repository_name> export COVERAGE_PATH=<path_to_coverage_report> export GITHUB_TOKEN=<github_token> export GITHUB_PR_NUMBER=<pull_request_number>
-
Run the action:
make run
Required Environment Variables
GITHUB_REPOSITORY
: The name of the GitHub repository where the action is running.COVERAGE_PATH
: The path to the coverage report file. (JSON format)GITHUB_TOKEN
: The GitHub token used for authentication.GITHUB_PR_NUMBER
: The number of the pull request where the action is running. (Optional)GITHUB_REF
: The branch to run the action on. If not provided, it will be used to get the PR number. (Optional)
Note: Either GITHUB_PR_NUMBER
or GITHUB_REF
is required.
Optional Environment Variables
GITHUB_BASE_REF
: The base branch for the pull request. Default ismain
.SUBPROJECT_ID
: The ID of the subproject. (Optional)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.DEBUG
: Whether to enable debug mode. Default is False.
That's it! You have successfully cloned the repository and built the project.
Custom Installation
-
Install Python: Make sure you have Python installed on your system. You can download and install Python from the official Python website.
-
Install Pipenv: Pipenv is a package manager that combines pip and virtualenv. You can install Pipenv using pip, the Python package installer. Open your terminal or command prompt and run the following command:
pip install pipenv
-
Install project dependencies: To install the project dependencies specified in the Pipfile, run the following command:
pipenv install --dev
-
Activate the virtual environment: To activate the virtual environment created by Pipenv, run the following command:
pipenv shell
-
Run your project: You can now run your project using the activated virtual environment. For example, if your project has a run.py file, you can run it using the following command:
python run.py
-
Install pre-commit hooks: To set up pre-commit hooks for your project, run the following command:
pipenv run pre-commit install
This will install and configure pre-commit hooks that will run before each commit to enforce code quality and style standards.
That's it! You have successfully set up your local environment using Pipenv.
This project is inspired by the concepts of py-cov-action/python-coverage-comment-action.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python-coverage-comment-1.0.tar.gz
.
File metadata
- Download URL: python-coverage-comment-1.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 039667f7f729be024a02b6c66b075779063d70fa93c29f1b4af799d8edceb6a5 |
|
MD5 | 3953888ed10b123d23f8e940e483bbd6 |
|
BLAKE2b-256 | 17febbb515fc2f6e696e50b68d4d6c9a87a56e4237ed5ef09d96698ce521f5d6 |
File details
Details for the file python_coverage_comment-1.0-py3-none-any.whl
.
File metadata
- Download URL: python_coverage_comment-1.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7807e6486be56a967e2942f41c6277c916cf93fc70bf520d2d889d135d05e3c3 |
|
MD5 | 6ae93abe51bdb6582b89396cf2d3bf39 |
|
BLAKE2b-256 | 42345fd2941753e938107c424185a1b5d645e495be26380e0e05f91407a96370 |