Junior — Middle
Describe your experience in setting up and implementing CI/CD processes in projects.
sobes.tech AI
Answer from AI
In my experience setting up CI/CD for Python projects, I usually follow these steps:
- Choosing a CI/CD tool — such as GitHub Actions, GitLab CI, Jenkins, or CircleCI.
- Automating build and testing:
- Configure tests (pytest, unittest) to run on each commit or pull request.
- Check code style with flake8, black, or pylint.
- Managing dependencies — create a virtual environment (venv, poetry) and install dependencies from requirements.txt or pyproject.toml.
- Build and deploy:
- For libraries — automatic build and publish to PyPI.
- For web applications — deploy to a server or cloud (Heroku, AWS, Docker).
- Monitoring and notifications — set up notifications in Slack or email about build statuses.
Example of a simple workflow for GitHub Actions:
name: Python CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
pytest
- name: Lint code
run: |
flake8 .