Test CI and automated code coverage reports using GitHub Actions.
Project description
Example repo: using GitHub Actions for CI/CD for a Python project
This is a minimal repo demonstrating the use of GitHub Actions for Continuous Integration (CI) & Continous Deployment (CD) for a Python project.
The GitHub Actions are:
- Tests: Automatically unit test code using
unittest
from Python's standard library. - Code coverage: Generate code coverage reports using coverage.py. The reports are automatically uploaded to codecov. The @codecov-commenter bot adds a comment to PR on code coverage status.
- Lint and format code: Lint using pylint. Check code formatting using black. Check type hints using mypy.
- Check docs build: Check Sphinx docs build successfully.
- Deploy docs to GitHub pages: Automatically deploy docs to a
GitHub Pages repo upon
merges to
main
branch. - Upload release to PyPI: Publish the latest version of the package on PyPI when a new GitHub Release is created.
Each of these actions is stored in a YAML file in the .github/workflows directory.
File system structure
TBA...
Push Token for Deploying Docs
Action #5 requires setting up a Personal Access Token with full repo access via
the Developer Settings page. Store this token as an Actions secret under the
name PUSH_TOKEN
in the main repo (i.e. the repo where the docs source code is
held). See more here.
Useful resources on the topic
- mCoding's YouTube video on using GitHub actions for automated testing (see associated code repo).
- Alex Damiani's YouTube videos on automated testing [1], [2] & [3] and associated code repos: [1] [2], & [3].
- librosa is a real-world example of
pyproject.toml
,setup.cfg
&setup.py
working together. - Pharmpy uses Actions for building docs then deploying them to a separate GitHub Pages repo.
- Vinod Kurup's blog post on automating PyPI releases with GitHub Actions.
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 github-actions-cicd-example-0.0.1.tar.gz
.
File metadata
- Download URL: github-actions-cicd-example-0.0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb9a20406d6b6199051d6ad2d8a48480779d1067a5ca4ad10011d958174847ed |
|
MD5 | f6b31666f183aa1927eb572d38964185 |
|
BLAKE2b-256 | 3bee3065f14dfe950f5a1b7aa3f204141778ff5828bbf507df341152af31e829 |
File details
Details for the file github_actions_cicd_example-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: github_actions_cicd_example-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 226076c44b529dcf689c64c0b91fe00cbda58bd59d19db98135db70dbbe9e422 |
|
MD5 | a363d7627164f495eb18cbbf996da6be |
|
BLAKE2b-256 | 2e303c0895f01f4307b3d5648b7be7123984341f647e116a4e1122d05252d103 |