This GitHub Action is set up to automate the testing and code quality checks for our Python package. The workflow is triggered on every push and pull_request event, ensuring that all code changes are validated before being merged.
Workflow Overview
The CI workflow consists of the following steps:
Checkout Repository:
The repository code is checked out using the actions/checkout@v2 action.
Set up Python:
The workflow sets up a Python environment using actions/setup-python@v2. The Python version is specified as 3.x, which allows for compatibility with different versions of Python 3.
Install Dependencies:
The necessary dependencies are installed, including coverage, codecov, and pytest. Additionally, any development dependencies listed in packages/requirements-dev.txt are installed.
Run Tests:
Tests are executed using pytest with coverage tracking enabled through coverage. This step ensures that the code functions as expected.
Generate Coverage Report:
A coverage report in XML format is generated, which is required for integration with Codecov.
Run Tox Tests:
The workflow runs tests across multiple Python environments and/or configurations using tox, ensuring compatibility and adherence to the project's testing standards.
Run Pre-Commit Hooks:
Pre-commit hooks are executed via tox -e pre-commit to enforce code quality and style checks.
Upload Coverage to Codecov:
Finally, the coverage report is uploaded to Codecov. The CODECOV_TOKEN secret is used to authenticate the upload securely.
Environment Variables
CODECOV_TOKEN: A secret that contains the Codecov token required for uploading the coverage report. This secret should be added to the GitHub repository's secrets.
Description
This GitHub Action is set up to automate the testing and code quality checks for our Python package. The workflow is triggered on every
push
andpull_request
event, ensuring that all code changes are validated before being merged.Workflow Overview
The CI workflow consists of the following steps:
Checkout Repository:
The repository code is checked out using the
actions/checkout@v2
action.Set up Python:
The workflow sets up a Python environment using
actions/setup-python@v2
. The Python version is specified as3.x
, which allows for compatibility with different versions of Python 3.Install Dependencies:
The necessary dependencies are installed, including
coverage
,codecov
, andpytest
. Additionally, any development dependencies listed inpackages/requirements-dev.txt
are installed.Run Tests:
Tests are executed using
pytest
with coverage tracking enabled throughcoverage
. This step ensures that the code functions as expected.Generate Coverage Report:
A coverage report in XML format is generated, which is required for integration with Codecov.
Run Tox Tests:
The workflow runs tests across multiple Python environments and/or configurations using
tox
, ensuring compatibility and adherence to the project's testing standards.Run Pre-Commit Hooks:
Pre-commit hooks are executed via
tox -e pre-commit
to enforce code quality and style checks.Upload Coverage to Codecov:
Finally, the coverage report is uploaded to Codecov. The
CODECOV_TOKEN
secret is used to authenticate the upload securely.Environment Variables
CODECOV_TOKEN
: A secret that contains the Codecov token required for uploading the coverage report. This secret should be added to the GitHub repository's secrets.