-
Notifications
You must be signed in to change notification settings - Fork 46
/
.travis.yml
113 lines (95 loc) · 3.41 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
sudo: required
language: go
dist: xenial
services:
- docker
addons:
apt:
packages:
- docker-ce
- apt-cacher-ng
cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
- $TRAVIS_BUILD_DIR/.gitian-builder-cache
- /var/cache/apt-cacher-ng
os:
- linux
go:
# When changing, remember to update MAIN_GO_VERSION below.
- "1.12.14"
- "1.13.5"
- master
env:
global:
- GO111MODULE=on
- TM_VERSION=v0.31.12
- BUILD_VERSION=$(echo ${TRAVIS_COMMIT} | cut -c 1-10)
- MAIN_GO_VERSION=1.12.14
- GORACE="halt_on_error=1"
- FORCE_TM_TEST=1
- VERSION=$(git describe --tags --abbrev=9 | sed 's/^v//')
- COMMIT=$(git log -1 --format='%H')
- IMAGE_NAME="iov1/bnsd:${BUILD_VERSION}"
install:
- wget --quiet https://github.com/tendermint/tendermint/releases/download/${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.zip -O tendermint_linux_amd64.zip &&
unzip tendermint_linux_amd64.zip &&
sudo install -D -m 777 -o root tendermint /usr/local/bin
script:
- set -eo pipefail
- make protolint
- make protodocs
- make install
- make all
- if [[ "$TRAVIS_GO_VERSION" == "$MAIN_GO_VERSION" ]]; then
make cover;
./coverage/upload.sh;
fi;
- printenv TRAVIS_COMMIT_MESSAGE > commit.msg
- unset TRAVIS_COMMIT_MESSAGE && printenv | grep -Ev "PATH|path|GEM" > env.list
- export TRAVIS_COMMIT_MESSAGE=`cat commit.msg` && rm -rf commit.msg
- docker run -it --rm --env-file env.list -v "$(pwd):/usr/src/app" iov1ops/danger:latest > danger.out; cat danger.out
- if [[ "$TRAVIS_GO_VERSION" == "$MAIN_GO_VERSION" && "$TRAVIS_OS_NAME" == "linux" ]]; then
release_latest=$( [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_TAG" == "" && "$TRAVIS_PULL_REQUEST_BRANCH" == "" ]] && echo "yes" || echo "no" );
release_tag=$( [[ "$TRAVIS_TAG" != "" ]] && echo "yes" || echo "no" );
if [[ $release_latest == "yes" || $release_tag == "yes" ]]; then
./contrib/gitian-build.sh linux ;
tar -zxf $TRAVIS_BUILD_DIR/bns-build-linux/build/out/bnsd-${VERSION}-linux-amd64.tar.gz -C ${TRAVIS_BUILD_DIR} ;
docker build --pull --file ${TRAVIS_BUILD_DIR}/cmd/bnsd/Dockerfile --tag ${IMAGE_NAME} . ;
tar -czvf spec/weave-${VERSION}-proto-spec.tar.gz ${TRAVIS_BUILD_DIR}/spec/proto ;
fi;
if [[ $release_latest == "yes" ]]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker tag "iov1/bnsd:${BUILD_VERSION}" "iov1/bnsd:latest" ;
docker push "iov1/bnsd:latest";
docker logout;
fi;
if [[ $release_tag == "yes" ]]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker tag "iov1/bnsd:${BUILD_VERSION}" "iov1/bnsd:$TRAVIS_TAG" ;
docker push "iov1/bnsd:$TRAVIS_TAG";
docker logout;
fi;
fi;
notifications:
email: false
# whitelist long living branches to avoid testing feature branches twice (as branch and as pull request)
branches:
only:
- master
- /^v[0-9]+\.[0-9]+\.x$/
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
deploy:
provider: releases
api_key:
${GITHUB_API_KEY}
file:
- ${TRAVIS_BUILD_DIR}/bns-build-linux/build/out/bnsd-${VERSION}-linux-amd64.tar.gz
- ${TRAVIS_BUILD_DIR}/bns-build-linux/build/out/src/bnsd-${VERSION}.tar.gz
- ${TRAVIS_BUILD_DIR}/bns-build-linux/result/bns-linux-res.yml
- ${TRAVIS_BUILD_DIR}/spec/weave-${VERSION}-proto-spec.tar.gz
skip_cleanup: true
on:
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$