https://github.com/micnguyen266/ci-cd-python-demo
Building a Simple CI/CD Pipeline with GitHub Actions (Python)
https://github.com/micnguyen266/ci-cd-python-demo
actions cicd github python
Last synced: about 2 months ago
JSON representation
Building a Simple CI/CD Pipeline with GitHub Actions (Python)
- Host: GitHub
- URL: https://github.com/micnguyen266/ci-cd-python-demo
- Owner: micnguyen266
- Created: 2025-03-28T02:24:27.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T02:40:58.000Z (about 1 year ago)
- Last Synced: 2025-03-28T03:25:27.303Z (about 1 year ago)
- Topics: actions, cicd, github, python
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ci-cd-python-demo
## Verify the Pipeline Execution
1. Go to your GitHub repository.
2. Click on the "Actions" tab.
3. You should see your CI/CD pipeline running.
4. It will:
5. Checkout your code.
6. Set up Python and install dependencies.
7. Run your unit tests.
8. Simulate deployment.
## If you want to deploy to a server (e.g., DigitalOcean, AWS EC2), add a deployment step using SSH or Docker.
### Example (SSH Deployment):
```
- name: Deploy to server
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_KEY }}
script: |
cd /path/to/app
git pull origin main
pip install -r requirements.txt
systemctl restart app.service
```
## Key Takeaways
1. Pipeline Trigger: On push and pull_request events to the main branch.
2. CI/CD Workflow:
3. Checkout code.
4. Set up Python.
5. Install dependencies.
6. Run unit tests.
7. Simulate deployment.
8. GitHub Secrets: Use secrets for sensitive information when deploying to external servers.