-
Notifications
You must be signed in to change notification settings - Fork 10
/
.travis.yml
98 lines (86 loc) · 3.57 KB
/
.travis.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#
# Copyright 2017 Agilx, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
dist: bionic
language: java
sudo: false
env:
matrix:
- METRICS_VERSION=3.1.0
- METRICS_VERSION=3.2.6
- METRICS_VERSION=4.0.2
- METRICS_VERSION=4.1.0
jdk:
- openjdk8
services:
- memcached
- redis
addons:
sonarcloud:
organization: "$SONAR_ORG"
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'
- '$HOME/.codacy/reporter'
before_install:
- sudo apt-get install -qq -y jq
- wget -nv -O ~/.codacy/reporter/codacy-reporter-latest.jar https://oss.sonatype.org/service/local/repositories/releases/content/com/codacy/codacy-coverage-reporter/4.0.1/codacy-coverage-reporter-4.0.1-assembly.jar
- |
if [[ "$encrypted_60ba2f79b530_key" != "" ]]; then
openssl aes-256-cbc -K $encrypted_60ba2f79b530_key -iv $encrypted_60ba2f79b530_iv -in conf/signingkey.asc.enc -out conf/signingkey.asc -d;
gpg2 --batch --keyring=$TRAVIS_BUILD_DIR/pubring.gpg --no-default-keyring --import conf/signingkey.asc;
gpg2 --batch --allow-secret-key-import --keyring=$TRAVIS_BUILD_DIR/secring.gpg --no-default-keyring --import conf/signingkey.asc;
fi
install:
- sudo apt-get -qq update
- sudo apt-get install -qq -y xmlstarlet
before_script:
- if [[ "$METRICS_VERSION" = "3.2.6" ]]; then export IS_PRIMARY_MATRIX_JOB=true; fi
- xmlstarlet ed --inplace -u "/_:project/_:properties/_:metrics.version" -v "$METRICS_VERSION" pom.xml;
- SEMVER_REGEX="^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
- |
if [[ "$TRAVIS_TAG" =~ $SEMVER_REGEX ]]; then
export PACKAGE_VERSION=${TRAVIS_TAG#v};
xmlstarlet ed --inplace -u "/_:project//_:properties/_:revision" -v "$PACKAGE_VERSION" pom.xml;
fi
- echo $TRAVIS_TAG
- echo $PACKAGE_VERSION
- echo $IS_PRIMARY_MATRIX_JOB
- export COMMON_MVN_FLAGS="-s conf/maven-settings.xml
-Dgpg.executable=gpg2 -Dgpg.keyname=8A6106B5 -Dgpg.passphrase=$GPG_PASSPHRASE
-Dgpg.publicKeyring=$TRAVIS_BUILD_DIR/pubring.gpg -Dgpg.secretKeyring=$TRAVIS_BUILD_DIR/secring.gpg
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN"
script:
- |
if [[ "$SONAR_ENABLED" = "true" ]] && [[ "$TRAVIS_PULL_REQUEST" = "false" ]] && [[ "$IS_PRIMARY_MATRIX_JOB" = "true" ]]; then
mvn verify sonar:sonar -Denv.server.ip=127.0.0.1 -B $COMMON_MVN_FLAGS
else
mvn verify -Denv.server.ip=127.0.0.1 -B $COMMON_MVN_FLAGS
fi
after_success:
- |
if [[ "$IS_PRIMARY_MATRIX_JOB" = "true" ]]; then
bash <(curl -s https://codecov.io/bash);
java -cp ~/.codacy/reporter/codacy-reporter-latest.jar com.codacy.CodacyCoverageReporter -l Java -r target/site/jacoco/jacoco.xml;
fi
deploy:
- provider: script
script: mvn deploy -DskipTests -B -Dskip.signing=false $COMMON_MVN_FLAGS
-Dsonar.projectKey=${SONAR_PROJECT} -Dsonar.login=${SONAR_TOKEN}
skip_cleanup: true
on:
tags: true
condition: $PACKAGE_VERSION != "" && $IS_PRIMARY_MATRIX_JOB == "true" && $BINTRAY_API_KEY != ""