From 2ac113ab578fa6d2aca2cf40172ba3b8cf01c5e4 Mon Sep 17 00:00:00 2001
From: Fischer Jonas <jf131@hdm-stuttgart.de>
Date: Thu, 22 Feb 2024 14:38:12 +0100
Subject: [PATCH] 22.02.2024 - Update .gitlab-ci.yml file #36

---
 .gitlab-ci.yml | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c971ef4..7f423f2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,20 +10,23 @@ build-backend:       # This job runs in the build stage, which runs first.
   stage: build
   image: maven:3.9.4-eclipse-temurin-21
   script:
-    - "echo 'Starting Build Stage'"
-    - "cd ./sth-backend"
-    - "mvn compile"
+    - echo 'Starting Build Stage'
+    - cd ./sth-backend
+    - mvn compile
 
 
 test-backend:   # This job runs in the test stage.
   stage: test    # It only starts when the job in the build stage completes successfully.
   image: maven:3.9.4-eclipse-temurin-21
+  before_script:
+    - apt-get update -qy
+    - apt-get install -y docker
+    - echo 'Starting Docker Container'
+    - docker compose up -d
   script:
-    - "echo 'Starting Docker Container'"
-    - "docker compose up -d"
-    - "echo 'Running unit tests...'"
-    - "cd ./sth-backend"
-    - "mvn test"
+    - echo 'Running unit tests...'
+    - cd ./sth-backend
+    - mvn test
   artifacts:
     reports:
       junit:
@@ -34,9 +37,9 @@ package-backend:
   stage: package
   image: maven:3.9.4-eclipse-temurin-21
   script:
-    - "echo 'Starting Package Stage'"
-    - "cd ./sth-backend"
-    - "mvn package"
+    - echo 'Starting Package Stage'
+    - cd ./sth-backend
+    - mvn package
   only:
     refs:
       - main
-- 
GitLab