Skip to content

Feedback

Feedback #32

name: Python application CI/CD
on: [push, pull_request]
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo
ports:
- 27017:27017
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12' # Choose the Python version you need
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
python -m pytest tests
deploy:
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # This ensures that deployment only happens on the main branch.
steps:
- uses: actions/checkout@v2
- name: Set up Docker Environment
run: |
docker-compose build
docker-compose up -d