Skip to content
Snippets Groups Projects
Commit 2f07d186 authored by Andreas's avatar Andreas
Browse files

refactor/Updated .gitlab-ci.yml

parent 5bfc2ad8
No related branches found
No related tags found
1 merge request!85Feat/workflow implement docker push and deploy
Pipeline #283434 passed
image: maven:3.8.5-openjdk-17 image: maven:3.8.5-openjdk-17
variables: variables:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
SPRING_PROFILES_ACTIVE: gitlab-ci SPRING_PROFILES_ACTIVE: gitlab-ci
services: cache:
- name: mysql:latest key: "${CI_COMMIT_REF_SLUG}" # Branch-specific cache keys to have separate caches across branches.
alias: mysql paths:
variables: - .m2/repository
MYSQL_ROOT_PASSWORD: "root" # TODO Set this in GitLab's CI/CD environment variables for security reasons
MYSQL_DATABASE: "sparesti"
stages: stages:
- compile_and_test - build_test
- generate_site_reports - generate_site_reports
- modify_generated_site_reports - modify_generated_site_reports
- publish_pages - pages
cache:
key: "maven-repository" # Static Cache Key to keep cache across branches
paths:
- .m2/repository
compile_and_test: build_test_project:
stage: compile_and_test stage: build_test
services:
- name: mysql:latest
alias: mysql
variables:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "sparesti"
script: script:
- mvn clean test # Cleans the previous build and runs tests - mvn clean test
artifacts:
when: always when: always
artifacts:
expire_in: 1 day
paths: paths:
- target/site/jacoco - target/site/jacoco
reports: reports:
junit: junit:
- target/surefire-reports/TEST-*.xml - target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml - target/failsafe-reports/TEST-*.xml
when: always cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2/repository
generate_site_reports: generate_site_reports:
stage: generate_site_reports stage: generate_site_reports
...@@ -65,7 +65,7 @@ modify_generated_site_reports: # Modify the generated website containing project ...@@ -65,7 +65,7 @@ modify_generated_site_reports: # Modify the generated website containing project
# We move the code coverage reports generated by jacoco and mvn site to be served by Gitlab Pages (Settings -> Pages) # We move the code coverage reports generated by jacoco and mvn site to be served by Gitlab Pages (Settings -> Pages)
pages: pages:
image: alpine:latest image: alpine:latest
stage: publish_pages stage: pages
dependencies: dependencies:
- modify_generated_site_reports - modify_generated_site_reports
script: script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment