From b92caebe7c1e8afb2d06bf497302a73eee1ba1ab Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <code@dgerhardt.net> Date: Wed, 11 Jul 2018 13:42:27 +0200 Subject: [PATCH] Improve CI job configurations * Adjust stages to increase parallelization * Run SonarQube at the end and adjust dependencies so it has all data available --- .gitlab-ci.yml | 57 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed1a0cd62..c7b9c9e3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,49 +1,57 @@ variables: - WAR_FILE: target/arsnova-backend-*.war + OUTPUT_DIR: target + WAR_FILE: $OUTPUT_DIR/arsnova-backend-*.war stages: - - analysis - - test - build + - post-build - deploy cache: paths: - .m2/ -sonar: - stage: analysis - only: - - master +checkstyle: + stage: build tags: - maven - allow_failure: true script: - - mvn sonar:sonar + - mvn checkstyle:checkstyle -checkstyle: - stage: analysis +compile: + stage: build tags: - maven + artifacts: + paths: + - $OUTPUT_DIR script: - - mvn checkstyle:checkstyle + - mvn test-compile -test: - stage: test +unit_test: + stage: post-build tags: - maven + dependencies: + - compile + artifacts: + paths: + - $OUTPUT_DIR script: - - mvn test + - mvn surefire:test package: - stage: build + stage: post-build tags: - maven + dependencies: + - compile artifacts: + name: package paths: - $WAR_FILE script: - - mvn package -DskipTests + - mvn war:war .deploy: &deploy stage: deploy @@ -53,6 +61,8 @@ package: variables: DEPLOY_CONTEXT: api GIT_STRATEGY: none + dependencies: + - package script: # Do some variable magic to access host-specific variables - PREFIX=$(echo $CI_ENVIRONMENT_NAME | tr '.:/-' '_') @@ -92,3 +102,16 @@ tomcat_development: #- $DEV_DEPLOY_HOST =~ /^([a-z0-9-]+\.)*[a-z0-9-]+(:[0-9]+)?$/ before_script: - DEPLOY_HOST=$DEV_DEPLOY_HOST + +sonarqube: + stage: deploy + only: + - master + tags: + - maven + dependencies: + - compile + - unit_test + allow_failure: true + script: + - mvn sonar:sonar -- GitLab