Socket
Socket
Sign inDemoInstall

github-actions-cicd-example

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github-actions-cicd-example

Test CI and automated code coverage reports using GitHub Actions.


Maintainers
1

Readme

License: MIT Tests codecov Code Style: Black Checked with mypy Latest Documentation

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:

  1. Tests: Automatically unit test code using unittest from Python's standard library.
  2. 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.
  3. Lint and format code: Lint using pylint. Check code formatting using black. Check type hints using mypy.
  4. Check docs build: Check Sphinx docs build successfully.
  5. Deploy docs to GitHub pages: Automatically deploy docs to a GitHub Pages repo upon merges to main branch.
  6. 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.

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc