refactor cicd pipeline
All checks were successful
Build and Deploy Demo App / test (push) Successful in 11s
Build and Deploy Demo App / build (push) Successful in 7s
Build and Deploy Demo App / scan (push) Successful in 26s
Build and Deploy Demo App / deploy (push) Successful in 37s

This commit is contained in:
2025-11-26 13:11:55 +03:30
parent c473ffbd16
commit 1f2e223b42

View File

@@ -6,7 +6,7 @@ on:
- main
jobs:
# ------------------ TEST ------------------
# ---------- TEST ----------
test:
runs-on: ubuntu-latest
steps:
@@ -16,19 +16,19 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: "3.12"
- name: Install deps
run: pip install -r requirements.txt
- name: Run tests
env:
DB_USER: '' # force SQLite fallback
DB_PASS: ''
DB_NAME: ''
DB_USER: "" # force SQLite fallback
DB_PASS: ""
DB_NAME: ""
run: pytest
# ------------------ BUILD ------------------
# ---------- BUILD ----------
build:
needs: test
runs-on: ubuntu-latest
@@ -39,7 +39,7 @@ jobs:
- name: Build Docker image
run: docker build -t demo-app:latest .
# ------------------ SCAN ------------------
# ---------- SCAN ----------
scan:
needs: build
runs-on: ubuntu-latest
@@ -51,15 +51,14 @@ jobs:
- name: Build Docker image for scan
run: docker build -t demo-app:latest .
# Use Trivy via Docker, no GitHub-specific action
- name: Scan image with Trivy
run: |
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
aquasecurity/trivy:latest \
image --exit-code 1 --severity CRITICAL,HIGH demo-app:latest
aquasec/trivy:latest \
image --exit-code 1 --severity CRITICAL,HIGH --no-progress demo-app:latest
# ------------------ DEPLOY ------------------
# ---------- DEPLOY ----------
deploy:
needs: [build, scan]
runs-on: ubuntu-latest