mirror of
https://gitlab.com/berufsschul-ae/solatium.git
synced 2024-12-22 21:17:40 +01:00
125 lines
4 KiB
YAML
125 lines
4 KiB
YAML
image: maven:3.6.0-jdk-8
|
|
|
|
variables:
|
|
# This will supress any download for dependencies and plugins or upload messages which would clutter the console log.
|
|
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
|
|
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"
|
|
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
|
|
# when running from the command line.
|
|
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
|
|
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
|
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
|
|
|
|
# Cache downloaded dependencies and plugins between builds.
|
|
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
|
|
# Define a cache with the key: ${CI_COMMIT_REF_SLUG} so that jobs of each branch always use the same cache
|
|
cache:
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
paths:
|
|
- .m2/repository
|
|
|
|
stages:
|
|
- compile
|
|
- test
|
|
- analyse
|
|
- build
|
|
|
|
mvn-compile:
|
|
stage: compile
|
|
script:
|
|
- "mvn $MAVEN_CLI_OPTS clean compile"
|
|
|
|
mvn-unit-test:
|
|
stage: test
|
|
coverage: '/Total.*?([0-9]{1,3})%/'
|
|
script:
|
|
- "mvn $MAVEN_CLI_OPTS clean test"
|
|
- "cat target/site/jacoco-ut/index.html"
|
|
|
|
mvn-integration-test:
|
|
stage: test
|
|
coverage: '/Total.*?([0-9]{1,3})%/'
|
|
script:
|
|
- "mvn $MAVEN_CLI_OPTS clean verify -Dskip.surefire.tests"
|
|
- "cat target/site/jacoco-it/index.html"
|
|
|
|
bash-E2E-api-test:
|
|
stage: test
|
|
script:
|
|
- "apt-get -qq update"
|
|
- "apt-get -qq install netcat-openbsd -y"
|
|
- "bash apiE2ETest.sh"
|
|
|
|
mvn-sonar-analyse:
|
|
stage: analyse
|
|
coverage: '/Total.*?([0-9]{1,3})%/'
|
|
script:
|
|
- "mvn $MAVEN_CLI_OPTS clean verify"
|
|
- "mvn $MAVEN_CLI_OPTS sonar:sonar -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN"
|
|
- "cat target/site/jacoco/index.html"
|
|
|
|
mvn-package:
|
|
stage: build
|
|
script:
|
|
- "mvn $MAVEN_CLI_OPTS clean install -Dmaven.test.skip=true"
|
|
artifacts:
|
|
paths:
|
|
- target/*.jar
|
|
expire_in: 1 day
|
|
|
|
mvn-master-package:
|
|
stage: build
|
|
script:
|
|
- "mvn $MAVEN_CLI_OPTS clean install -Dmaven.test.skip=true"
|
|
artifacts:
|
|
paths:
|
|
- target/*.jar
|
|
only:
|
|
- master
|
|
|
|
.docker-before-template: &before-docker-script
|
|
before_script:
|
|
- "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)"
|
|
- "ARTIFACT_ID=$(./mvnw help:evaluate -Dexpression=project.artifactId -q -DforceStdout)"
|
|
- "./mvnw $MAVEN_CLI_OPTS clean install -Dmaven.test.skip=true"
|
|
- "docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY"
|
|
|
|
docker-master-build-image:
|
|
image: registry.gitlab.com/berufsschul-ae/solatium/docker-openjdk8:latest
|
|
stage: build
|
|
services:
|
|
- docker:dind
|
|
only:
|
|
- master
|
|
<<: *before-docker-script
|
|
script:
|
|
- "docker build -t $CI_REGISTRY_IMAGE:latest --build-arg FILE_PATH=target/${ARTIFACT_ID}-${VERSION}.jar ."
|
|
- "docker push $CI_REGISTRY_IMAGE:latest"
|
|
|
|
docker-dev-build-image:
|
|
image: registry.gitlab.com/berufsschul-ae/solatium/docker-openjdk8:latest
|
|
stage: build
|
|
services:
|
|
- docker:dind
|
|
only:
|
|
- dev
|
|
<<: *before-docker-script
|
|
script:
|
|
- "docker build -t $CI_REGISTRY_IMAGE:dev --build-arg FILE_PATH=target/${ARTIFACT_ID}-${VERSION}.jar ."
|
|
- "docker push $CI_REGISTRY_IMAGE:dev"
|
|
|
|
docker-tags-build-image:
|
|
image: registry.gitlab.com/berufsschul-ae/solatium/docker-openjdk8:latest
|
|
stage: build
|
|
services:
|
|
- docker:dind
|
|
only:
|
|
- tags
|
|
<<: *before-docker-script
|
|
script:
|
|
- "docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG --build-arg FILE_PATH=target/${ARTIFACT_ID}-${VERSION}.jar ."
|
|
- "docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|