image: openjdk:11-jdk-slim stages: - build - test - package - publish - release before_script: - echo "---------- Start CI ----------" - export GRADLE_USER_HOME=`pwd`/.gradle - chmod +x gradlew - echo "------ commit info ---------------" - echo $CI_COMMIT_TAG - echo $CI_COMMIT_REF_NAME - echo "----------------------------------" cache: paths: - .gradle/wrapper - .gradle/caches build: stage: build script: - echo "---------- build stage ----------" - apt-get update -y - apt-get install -y iputils-ping ssh - ping -c 2 repo.prod.meissa.de - ssh-keyscan repo.prod.meissa.de - ./gradlew assemble artifacts: paths: - build/libs/*.jar expire_in: 1 week test: stage: test image: docker:latest services: - docker:dind dependencies: - build before_script: - echo "---------- BEFORE -------------" - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - echo "---------- TEST -------------" - apk update && apk add bash openjdk11 - export JAVA_HOME=/usr/lib/jvm/java-11-openjdk - docker build --pull -t "$CI_REGISTRY_IMAGE" . - docker run --privileged -dit --name provs_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE - docker inspect -f '{{.State.Running}}' provs_test - ./gradlew -x assemble test -Dtestdockerwithoutsudo=true -DexcludeTags=extensivecontainertest,nonci artifacts: when: on_failure paths: - build/reports/tests/test reports: junit: build/test-results/test/TEST-*.xml publish-maven-package: stage: publish rules: - if: $CI_PIPELINE_SOURCE != "push" when: never - if: $CI_COMMIT_TAG !~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/ script: - ./gradlew -x assemble -x test jar - ./gradlew -x assemble -x test publish artifacts: paths: - build/libs/*.jar release: stage: release rules: - if: $CI_PIPELINE_SOURCE != "push" when: never - if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/ script: - apt-get update - apt-get -yqq install curl - ./gradlew createReleaseAndUploadAssets after_script: - echo "---------- End CI ----------"