-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
49 lines (41 loc) · 1.36 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
DOCKER_IMAGE_NAME: $CI_PROJECT_NAME
CACHE_KEY: $CI_COMMIT_REF_SLUG
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
key: $CACHE_KEY
paths:
- .gradle/
- build/
stages:
- build # compile, package
- test # unit-tests, integration-tests
- analyze # run SonarQube analysis
- push # build docker image and push image to Artifactory
gradle-build:
stage: build
image: openjdk:8-jdk
artifacts:
expire_in: 1 day
paths:
- build/libs/*
script: "./gradlew --build-cache clean assemble --stacktrace"
gradle-test:
stage: test
image: openjdk:8-jdk
script: "./gradlew --build-cache test --stacktrace --info"
sonarqube:
stage: analyze
image: openjdk:8-jdk
script:
- if [ "$CI_COMMIT_REF_NAME" == "master" ]; then SONAR_BRANCH_NAME=""; else SONAR_BRANCH_NAME="-Dsonar.branch.name=$CI_COMMIT_REF_NAME"; fi
- "./gradlew sonarqube $SONAR_BRANCH_NAME -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN --stacktrace"
publishToMaven:
stage: push
image: openjdk:8-jdk
only:
- master
script:
- "./gradlew publishXsd2javaPluginPublicationToMavenRepository -PsnapshotUrl=$MAVEN_REPO_URL/$MAVEN_SNAPSHOT_REPO -PreleaseUrl=$MAVEN_REPO_URL/$MAVEN_RELEASE_REPO -PnexusUsername=$MAVEN_REPO_USER -PnexusPassword=$MAVEN_REPO_PASS --stacktrace"