cicd-setup
Sets up a CI/CD pipeline for Python projects using GitHub Actions. Includes templates for PR checks, deployment via SSH, pre-commit hooks, and email notifications. Use this skill when a user wants to create a new CI/CD pipeline for a Python project.
When & Why to Use This Skill
This Claude skill automates the end-to-end setup of a robust CI/CD pipeline specifically tailored for Python projects using GitHub Actions. It streamlines the development lifecycle by integrating automated testing, linting via pre-commit hooks, secure SSH-based deployments, and real-time notifications, ensuring high code quality and reliable delivery with minimal manual configuration.
Use Cases
- Automating Quality Control: Automatically run unit tests and linting checks on every Pull Request to ensure only high-quality code is merged into the main branch.
- Seamless Deployment: Setting up a continuous deployment workflow that automatically pushes code to production servers via SSH upon successful merges.
- Standardizing Local Development: Implementing pre-commit hooks across a team to enforce consistent coding standards and catch errors before they are committed to the repository.
- Security and Compliance: Configuring GitHub Secrets for sensitive credentials and establishing branch protection rules to prevent unauthorized or broken code from reaching production.
- Environment-Specific Optimization: Customizing dependency caching for Python managers like Poetry, Pipenv, or Requirements.txt to speed up build times in GitHub Actions.
| name | cicd-setup |
|---|---|
| description | "Sets up a CI/CD pipeline for Python projects using GitHub Actions. Includes templates for PR checks, deployment via SSH, pre-commit hooks, and email notifications. Use this skill when a user wants to create a new CI/CD pipeline for a Python project." |
CI/CD Pipeline Setup Skill
This skill provides templates and guides to set up a CI/CD pipeline for a Python project using GitHub Actions.
Core Workflow
Set up Pre-commit Hooks:
- Copy the
.pre-commit-config.yamlfromassets/pre-commit/to the root of the user's repository. - Guide the user to install pre-commit (
pip install pre-commit) and set it up (pre-commit install).
- Copy the
Set up GitHub Actions Workflows:
- Create a
.github/workflows/directory in the user's repository if it doesn't exist. - Copy
assets/github_actions/python_pr_workflow.ymlto.github/workflows/. This workflow runs tests and linting on every pull request tomain. - Copy
assets/github_actions/python_deploy_workflow.ymlto.github/workflows/. This workflow deploys the application when a PR is merged tomain.
- Create a
Configure Secrets:
- Guide the user to add the necessary secrets for deployment and notifications as described in
references/secret_management.md.
- Guide the user to add the necessary secrets for deployment and notifications as described in
Set Up Branch Protection:
- Guide the user through setting up branch protection rules for the
mainbranch as detailed inreferences/branch_protection.md.
- Guide the user through setting up branch protection rules for the
Bundled Resources
Assets
assets/github_actions/python_pr_workflow.yml: Workflow to run checks on pull requests.assets/github_actions/python_deploy_workflow.yml: Workflow to deploy on merge tomain.assets/notifications/email_notification_template.txt: Template for email notifications on successful deployment.assets/pre-commit/.pre-commit-config.yaml: Configuration for pre-commit hooks for Python projects.
References
references/secret_management.md: How to configure secrets for SSH and email.references/caching_strategies.md: Explanation of caching for Python dependencies.references/branch_protection.md: How to set up branch protection rules in GitHub.
Before starting, ask the user if they use requirements.txt, poetry, or pipenv for dependency management and adjust the caching steps in the workflows if necessary.