From cbbf79f821c63002fab7213e575a5b5aa4451732 Mon Sep 17 00:00:00 2001 From: Wolkenfarmer Date: Sat, 16 Mar 2024 14:53:28 +0100 Subject: [PATCH] #77: improve GitHub workflow ci-tests to reuse images and test deploy docker-compose --- .github/workflows/ci-tests.yml | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 2c5e31e5..718e66d2 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -19,6 +19,11 @@ jobs: cd ./frontend/ docker-compose up -d + - name: Push frontend Docker images + run: | + docker tag dps_training_k-frontend ghcr.io/hpi-sam/dps_training_k-frontend:dev + docker push ghcr.io/hpi-sam/dps_training_k-frontend:dev + build-and-test-backend: runs-on: ubuntu-latest steps: @@ -34,6 +39,20 @@ jobs: docker pull redis:latest docker-compose up -d + - name: Push backend Docker images + run: | + docker tag dps_training_k-django ghcr.io/hpi-sam/dps_training_k-django:dev + docker push ghcr.io/hpi-sam/dps_training_k-django:dev + docker tag dps_training_k-celeryworker ghcr.io/hpi-sam/dps_training_k-celeryworker:dev + docker push ghcr.io/hpi-sam/dps_training_k-celeryworker:dev + docker tag dps_training_k-celerybeat ghcr.io/hpi-sam/dps_training_k-celerybeat:dev + docker push ghcr.io/hpi-sam/dps_training_k-celerybeat:dev + docker tag dps_training_k-nginx ghcr.io/hpi-sam/dps_training_k-nginx:dev + docker push ghcr.io/hpi-sam/dps_training_k-nginx:dev + docker tag dps_training_k-postgres ghcr.io/hpi-sam/dps_training_k-postgres:dev + docker push ghcr.io/hpi-sam/dps_training_k-postgres:dev + # Skip redis as it is just the public Docker Hub image anyway and therefore should be directly pulled from there + - name: Run backend tests run: docker exec K-dPS-django python3 manage.py test @@ -47,14 +66,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Build frontend Docker container + - name: Pull Docker images run: | - cd ./frontend/ - docker-compose up -d - - - name: Build backend Docker containers - run: | - cd ./backend/dps_training_k/ + docker pull ghcr.io/hpi-sam/dps_training_k-frontend:dev + docker pull ghcr.io/hpi-sam/dps_training_k-django:dev + docker pull ghcr.io/hpi-sam/dps_training_k-celeryworker:dev + docker pull ghcr.io/hpi-sam/dps_training_k-celerybeat:dev + docker pull ghcr.io/hpi-sam/dps_training_k-nginx:dev + docker pull ghcr.io/hpi-sam/dps_training_k-postgres:dev docker pull redis:latest docker-compose up -d