Skip to content

Commit

Permalink
CD github action added; test push 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Enrico Goerlitz committed Jun 15, 2024
1 parent bf721aa commit 978a557
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cd-backend-deploy-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CD-Backend Deploy Docker image

on:
workflow_run:
workflows: ["CI-Backend"]
types:
- completed
on: []
# workflow_run:
# workflows: ["CI-Backend"]
# types:
# - completed
# pull_request:
# branches:
# - main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-backend-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI-Backend

on: [push, pull_request]
on: [] #[push, pull_request]

jobs:
build:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/ci-cd-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI/CD-Backend Pipeline

on: [push, pull_request]

jobs:
CI-Backend:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r app/requirements.txt
- name: Run tests
run: |
cd app
python -m unittest ./tests/test_app.py
CD-Backend:
if: github.event_name == 'pull_request' && github.event.action == 'opened' && github.event.pull_request.base.ref == 'main' && needs.CI-Backend.outputs.ci-successful == 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r app/requirements.txt
- name: Log in to Docker Hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build Docker image
run: |
docker build --platform linux/amd64/v2 -t enricogoerlitz/bp2-backend-amd64v2 -f ./docker/Dockerfile .
- name: Push Docker image
run: |
docker push enricogoerlitz/bp2-backend-amd64v2:latest

0 comments on commit 978a557

Please sign in to comment.