From 2b793e677b43ccefdd6e3f00e5684fcfde0eb67f Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <code@dgerhardt.net> Date: Wed, 20 Jan 2016 15:44:32 +0100 Subject: [PATCH] Add CI config for GitLab --- .gitlab-ci.yml | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..aa4d9a29 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,76 @@ +variables: + MIRROR_REPO: git@github.com:thm-projects/arsnova-backend.git + WAR_FILE: target/arsnova-backend-*.war + +stages: + - analysis + - test + - build + - deploy + - synchronization + +cache: + paths: + - .m2/ + +sync_mirror: + stage: synchronization + when: always + except: + - production + - staging + allow_failure: true + script: + - git clone --bare $CI_BUILD_REPO mirror.git + - cd mirror.git + - git update-ref -d refs/tags/production + - git update-ref -d refs/tags/staging + - git push --mirror $MIRROR_REPO + +sonar: + stage: analysis + only: + - master + tags: + - maven + allow_failure: true + script: + - mvn sonar:sonar + +checkstyle: + stage: analysis + tags: + - maven + script: + - mvn checkstyle:checkstyle + +test: + stage: test + tags: + - maven + script: + - mvn test + +package: + stage: build + tags: + - maven + artifacts: + paths: + - $WAR_FILE + script: + - mvn package -DskipTests + +tomcat_production: + stage: deploy + only: + - production + script: + - curl --upload-file $WAR_FILE https://$PROD_TOMCAT_USER:$PROD_TOMCAT_PASSWORD@$PROD_TOMCAT_HOST/manager/deploy?path=%2Fapi + +tomcat_development: + stage: deploy + only: + - staging + script: + - curl --upload-file $WAR_FILE https://$DEV_TOMCAT_USER:$DEV_TOMCAT_PASSWORD@$DEV_TOMCAT_HOST/manager/deploy?path=%2Fapi -- GitLab