-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
71 lines (58 loc) · 1.2 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
---
###
### Enable sudo (required for docker service)
###
sudo: required
###
### Language
###
language: minimal
###
### Add services
###
services:
- docker
###
### Build Matrix
###
env:
matrix:
- VERSION=latest
###
### Install requirements
###
install:
- retry() {
for ((n=0; n<10; n++)); do
echo "[${n}] ${*}";
if eval "${*}"; then
return 0;
fi;
done;
return 1;
}
###
### Check generation changes, build and test
###
before_script:
- retry make lint
- retry make build
###
### Push to Dockerhub
###
script:
# Push to docker hub on success
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
while ! make login USER="${DOCKER_USERNAME}" PASS="${DOCKER_PASSWORD}"; do sleep 1; done;
if [ -n "${TRAVIS_TAG}" ]; then
while ! make push TAG="${TRAVIS_TAG}"; do sleep 1; done;
elif [ "${TRAVIS_BRANCH}" == "master" ]; then
while ! make push; do sleep 1; done;
elif [[ ${TRAVIS_BRANCH} =~ ^(release-[.0-9]+)$ ]]; then
while ! make push TAG="${TRAVIS_BRANCH}"; do sleep 1; done;
else
echo "Skipping branch ${TRAVIS_BRANCH}";
fi
else
echo "Skipping push on PR";
fi