.gitlab-ci.yml 3.11 KB
Newer Older
Michael Ritter's avatar
Michael Ritter committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
# This file is a template, and might need editing before it works on your project.
# Build JAVA applications using Apache Maven (http://maven.apache.org)
# For docker image tags see https://hub.docker.com/_/maven/
#
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
# 
# This template will build and test your projects as well as create the documentation.
# 
# * Caches downloaded dependencies and plugins between invocation.
# * Does only verify merge requests but deploy built artifacts of the
#   master branch.
# * Shows how to use multiple jobs in test stage for verifying functionality
#   with multiple JDKs.
# * Uses site:stage to collect the documentation for multi-module projects.
# * Publishes the documentation for `master` branch.

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.
Michael Ritter's avatar
Michael Ritter committed
21
  MAVEN_OPTS: "-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"
Michael Ritter's avatar
Michael Ritter committed
22
23
24
25
26
27
28
29
  # 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"

# Cache downloaded dependencies and plugins between builds.
cache:
  paths:
Michael Ritter's avatar
Michael Ritter committed
30
    - .m2/repository/
Michael Ritter's avatar
Michael Ritter committed
31

Michael Ritter's avatar
Michael Ritter committed
32
image: maven:3-jdk-8
Michael Ritter's avatar
Michael Ritter committed
33
34
35

# Validate merge requests using JDK8
validate:jdk8:
Michael Ritter's avatar
Michael Ritter committed
36
37
38
  stage: build
  script:
    - mvn $MAVEN_CLI_OPTS test-compile
Michael Ritter's avatar
Michael Ritter committed
39
40
41

# Verify merge requests using JDK8
verify:jdk8:
Michael Ritter's avatar
Michael Ritter committed
42
43
44
  stage: test
  script:
    - mvn $MAVEN_CLI_OPTS verify
Michael Ritter's avatar
Michael Ritter committed
45

Michael Ritter's avatar
Michael Ritter committed
46
47
# Call mvn deploy to upload artifacts for devlop and releases
# Requires settings.xml to be mounted in /root/.m2/settings.xml
Michael Ritter's avatar
Michael Ritter committed
48
deploy:jdk8:
Michael Ritter's avatar
Michael Ritter committed
49
  stage: deploy
Michael Ritter's avatar
Michael Ritter committed
50
  script:
Michael Ritter's avatar
Michael Ritter committed
51
    - mvn $MAVEN_CLI_OPTS deploy
Michael Ritter's avatar
Michael Ritter committed
52
  only:
Michael Ritter's avatar
Michael Ritter committed
53
54
55
    - develop
    - tags
    - /^release-.*$/
Michael Ritter's avatar
Michael Ritter committed
56
57
58
59
60

upload:
  stage: deploy
  only:
    - develop
Michael Ritter's avatar
Michael Ritter committed
61
62
    - tags
    - /^release-.*$/
Michael Ritter's avatar
Michael Ritter committed
63
64
  script:
    - 'mvn package'
Michael Ritter's avatar
Michael Ritter committed
65
66
67
    - 'for f in `find ace-am/src/main/sql -type f`; do curl -X POST -H "Content-Type: application/octet-stream" -H "Authorization: token $BUILD_TOKEN" --data-binary @$f $SERVER/resource/ace/$CI_BUILD_REF_NAME/$(echo $CI_BUILD_REF | cut -c -7)/$(basename $f); done'
    - 'for f in `find ace-am/target -type f -name "*.war"`; do curl -X POST -H "Content-Type: application/octet-stream" -H "Authorization: token $BUILD_TOKEN" --data-binary @$f $SERVER/resource/ace/$CI_BUILD_REF_NAME/$(echo $CI_BUILD_REF | cut -c -7)/$(basename $f); done'
    - 'for f in `find ace-ims-ear/target -type f -name "*.ear"`; do curl -X POST -H "Content-Type: application/octet-stream" -H "Authorization: token $BUILD_TOKEN" --data-binary @$f $SERVER/resource/ace/$CI_BUILD_REF_NAME/$(echo $CI_BUILD_REF | cut -c -7)/$(basename $f); done'
Michael Ritter's avatar
Michael Ritter committed
68