forked from Dynatrace/openkit-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
126 lines (109 loc) · 3.75 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
dist: trusty
# The main language that this repo uses - this enables Gradle support
language: java
# run in container
sudo: false
# Additional packages to install
addons:
apt:
packages:
- openjdk-6-jdk
- oracle-java8-installer
# Job matrix
matrix:
include:
- name: "Java 6 compatible"
jdk: openjdk7 # start with OpenJDK7 and switch later to 6
env:
- INCLUDE_IN_COVERAGE=false
- GRADLE_DIST_URL=https://services.gradle.org/distributions/gradle-3.5.1-bin.zip
- SWITCH_TO_OPENJDK6=true
- name: "Java 7 compatible"
jdk: openjdk7
env:
- INCLUDE_IN_COVERAGE=false
- GRADLE_DIST_URL=https://services.gradle.org/distributions/gradle-3.5.1-bin.zip
- name: "Java 8 compatible"
jdk: oraclejdk8
env:
- INCLUDE_IN_COVERAGE=true
- name: "Java 11 compatible"
jdk: oraclejdk11
env:
- INCLUDE_IN_COVERAGE=false
install:
- |
# next patch the gradle wrapper properties
if [ "x$GRADLE_DIST_URL" != "x" ]; then
GRADLE_WRAPPER_PROPERTIES=./gradle/wrapper/gradle-wrapper.properties
echo "Patching $GRADLE_WRAPPER_PROPERTIES file using dist URL $GRADLE_DIST_URL"
sed -i -e "s#distributionUrl=.*#distributionUrl=$GRADLE_DIST_URL#g" $GRADLE_WRAPPER_PROPERTIES
fi
# next assemble
./gradlew assemble
# Runs tests thatcheck the implementation (unit tests)
script:
- |
# run tests
# check if switching to OpenJDK 6 is needed
$JAVA_6_HOME=""
if [ "$SWITCH_TO_OPENJDK6" = true ]; then
JAVA_6_HOME=$(jdk_switcher home openjdk6)
./gradlew check -Ptest.executable=$JAVA_6_HOME --info
else
# no need to switch to Java 6
./gradlew check --info
fi
# Runs code coverage when everything else was successful
after_success:
- |
if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a "$INCLUDE_IN_COVERAGE" = true ]; then
export CI_NAME="travis-ci"
export CI_BUILD_NUMBER="$TRAVIS_BUILD_NUMBER"
export CI_BRANCH="$TRAVIS_BRANCH"
./gradlew jacocoTestReport coveralls
else
echo "Skipping coveralls [branch=$TRAVIS_BRANCH; pull_request=$TRAVIS_PULL_REQUEST; target_compat=$TARGET_COMPATIBILITY]"
fi
# Creates a GitHub release and deploys artifacts to this release
deploy:
#############################################################################
# The provider that simplifies communication with GitHub
- provider: releases
# The GitHub API key is read from the environment (needs to be configured in Travis CI)
api_key: $API_KEY
# Conditions that all must be true to create a release in the first place
on:
# Only on correct repo
repo: Dynatrace/openkit-java
# Only if this commit has tags should a release be initiated
tags: true
# Only when built using Oracle JDK 8
jdk: oraclejdk8
# Metadata of this release
#
# The name of this release
name: openkit-java $(git tag --contains HEAD)
# This release should be flagged as pre-release
prerelease: true
# Files to be added to this release
file:
- build/libs/openkit-*.jar
- build/distributions/openkit*-javadoc.zip
# Enable wildcard operators in the file selector above
file_glob: true
# Prevent cleanup of build that would otherwise delete artifacts
skip_cleanup: true
#############################################################################
# JFrog Bintray is handled via gradle
- provider: script
script: ./gradlew bintrayUpload
# Prevent cleanup of build that would otherwise delete artifacts
skip_cleanup: true
on:
# Only on correct repo
repo: Dynatrace/openkit-java
# Only if this commit has tags should a release be initiated
tags: true
# Only when built using Oracle JDK 8
jdk: oraclejdk8