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

refactor/Updated .gitlab-ci.yml

parent 5bfc2ad8
Branches
No related tags found
1 merge request!85Feat/workflow implement docker push and deploy
Pipeline #283434 passed
image: maven:3.8.5-openjdk-17
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
services:
- name: mysql:latest
alias: mysql
variables:
MYSQL_ROOT_PASSWORD: "root" # TODO Set this in GitLab's CI/CD environment variables for security reasons
MYSQL_DATABASE: "sparesti"
cache:
key: "${CI_COMMIT_REF_SLUG}" # Branch-specific cache keys to have separate caches across branches.
paths:
- .m2/repository
stages:
- compile_and_test
- build_test
- generate_site_reports
- modify_generated_site_reports
- publish_pages
cache:
key: "maven-repository" # Static Cache Key to keep cache across branches
paths:
- .m2/repository
- pages
compile_and_test:
stage: compile_and_test
build_test_project:
stage: build_test
services:
- name: mysql:latest
alias: mysql
variables:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "sparesti"
script:
- mvn clean test # Cleans the previous build and runs tests
artifacts:
- mvn clean test
when: always
artifacts:
expire_in: 1 day
paths:
- target/site/jacoco
reports:
junit:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml
when: always
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2/repository
generate_site_reports:
stage: generate_site_reports
......@@ -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)
pages:
image: alpine:latest
stage: publish_pages
stage: pages
dependencies:
- modify_generated_site_reports
script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment