diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..19436bfc3214f26de4c2642af6a12213afad0d72 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,44 @@ +include: + - template: Jobs/SAST.gitlab-ci.yml + +stages: # List of stages for jobs, and their order of execution + - build + - test + - package + +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" + + +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 + script: + - echo "Running unit tests..." + - "cd ./sth-backend" + - "mvn test" + artifacts: + reports: + junit: + - target/surefire-reports/TEST-*.xml + - target/failsafe-reports/TEST-*.xml + +package-backend: + stage: package + image: maven:3.9.4-eclipse-temurin-21 + script: + - "echo 'Starting Package Stage'" + - "cd ./sth-backend" + - "mvn package" + only: + refs: + - main + artifacts: + paths: + - target/*.jar + expire_in: 2 days \ No newline at end of file