/
.travis.yml
78 lines (72 loc) · 3.74 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
sudo: required
dist: trusty
services:
- docker
language: java
jdk:
- openjdk8
notifications:
irc:
channels:
- chat.freenode.net#hawkular
on_success: change
# manage the caches here https://travis-ci.org/hawkular/hawkular-alerts/caches
cache:
directories: # keep in sync with CACHED_DIRECTORIES below
- $HOME/.m2/repository
- $HOME/.m2/wrapper
before_install:
- ulimit -u 4096
- ulimit -a
install:
- ./mvnw -version -B
# unshallow is needed by license-maven-plugin
- git fetch origin --unshallow
script:
- ./mvnw -s .travis.maven.settings.xml verify -Pitest
env:
global:
- secure: TQJ1pIBM6dGgCQj59OiYxmKI2Nk+0XIT9His/iBt4FGRXHQ4BqWZuMVbtiX0ngGJbyg6Ntq9mJwmioGNl3tyK3jY9eqD/pWg8XjA9YAn+UINSBS3ooPYgAwIjTuJp6o7x9xExLEKCdzyttFjQ0BG+AkNvIEVyjSTZq7ky/ngbP4=
- secure: FxylCjpefGYtjx8tclzaruX6oGirSxSPr2GX6LrRsQVBhTcsCMJAyVfQur3Xobbm1WaJOOvSqFi8CUz7e2Fy6wNX10HaPZs0jGIFgnISATzBYZd3gC9nQwSDDtsvqE9J1cztXYaVtbtmTazLSRpPy5jUi5Trcqx3e/ZCQ2fnt7M=
# for pushing the swagger adoc documentation to the website repository
- secure: W06c620h/B/+Va2SoU+9wSHaop9HpULMSUCyo7lSb9lKGQ7JdNSC+MzgkQdjuYuzNM/WGGTPetV9IWCaQ13q6KrXCbxv9Jj2HD1wzalOG7rPSfhHz+7KkryIOO+PNwtV7pV04/R1bPqkfYfzfGVIfl/0NxGlq9gPHCT4EuUW/Zs=
# for pushing docker images
- secure: "BNvDH4HRvr+usv1FOyEglmRt2JEo7hj3hFVLB9Kx2fB6dnfwF4r7Cfjk9kXegtbfbe2iyX9q4/bRPlMijNvoIMoamzZGEvtNyGFF9MqObrFe+Skn5AzJJGhf5Rk+MvU6ND/eOVok4ZQWkhVZg9SkZ3be/hIt83hqkvBbQ8vPN8g="
- secure: "jUUZK6dexywXDNoWGpsnkfCsm6csa9gy9OfUlrJ9OCJ8djkaTLCrCzzTRrr6jrTFtASzFYq5hzYBsrhPrhMW9Xm3+Lrcn6LrqCGHJjTND2+49WiR+8oqYOPNbjmKyR5f1U8ZigjfRgCzcQiU5TWsoeIPph3I/NxdevBx/2IpX4U="
before_cache:
# Clean the cached directories once their size exceeds the space left on the partition.
# This is important because Travis zips the chached directories to a temporary file on the same partition.
# Note that while we consider the summed size of all cached dirs, we remove only those ones that tend to grow over time
- CACHED_DIRECTORIES=("$HOME/.m2/repository" "$HOME/.m2/wrapper")
- availBytes=$(df -P . | tail -1 | awk '{print $4}')
- cachedBytes=$(du -cs "${CACHED_DIRECTORIES[@]}" | tail -1 | awk '{print $1}')
- echo "Checking if the size of directories to cache ${cachedBytes} Bytes exceeds the free space ${availBytes} Bytes left on the current partition"
- if [ "${cachedBytes}" -gt "${availBytes}" ] ; then
echo "Cleaning the cached dirs (${cachedBytes} Bytes) because their size exceeds the free space (${availBytes} Bytes) left on the current partition" ;
rm -Rf "$HOME/.m2" ;
fi;
# Push docker image to docker hub and build docs
# NOTE .travis.swagger.sh does a mvn clean so it deletes files needed by build-image.sh
# Therefore, do the docker stuff first then the other stuff.
after_success:
- export COMMIT_HASH=${TRAVIS_COMMIT}
- export DOCKER_VERSION=$(if [ "$TRAVIS_TAG" != "" ]; then echo $TRAVIS_TAG; elif [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi)
- export DOCKER_USER=$(if [ "$DOCKER_USER" == "" ]; then echo "unknown"; else echo $DOCKER_USER ; fi)
- export DOCKER_PASS=$(if [ "$DOCKER_PASS" == "" ]; then echo "unknown"; else echo $DOCKER_PASS ; fi)
- echo DOCKER_VERSION=$DOCKER_VERSION
- echo "${TRAVIS_BRANCH}"
- if [[ "${TRAVIS_BRANCH}" == "master" ]];
then
cd dist ;
./build-image.sh ;
docker --version ;
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" ;
docker push hawkular/hawkular-alerts ;
cd .. ;
fi;
- PROJECT_VERSION=`./mvnw --batch-mode org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['`
- if [[ "$PROJECT_VERSION" =~ .*SNAPSHOT ]] && [[ "${TRAVIS_BRANCH}" == "master" ]] && [[ "${TRAVIS_PULL_REQUEST}" == "false" ]];
then
./mvnw -s .travis.maven.settings.xml deploy -DskipTests ;
./.travis.swagger.sh ;
fi;