Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI-CD Pipeline

on:
push:
branches: [ "main", "feature/*" ]
pull_request:
branches: [ "main" ]

jobs:
test-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# --- STEP 1: UNIT TESTING ---
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: pip install pytest

- name: Run Pytest
run: pytest

# --- STEP 2: DOCKER HUB DEPLOY (Only on Main Branch) ---
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and Push
if: github.ref == 'refs/heads/main'
run: |
docker build -t skalgleb2devops/testing:latest .
docker push skalgleb2devops/testing:latest
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ def welcome_message():

def calculate_uptime(days):
return days * 24 # Converts days to hours
print('Version 2.0')
Loading