-
Notifications
You must be signed in to change notification settings - Fork 13
/
.travis.yml
133 lines (113 loc) · 4.91 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
127
128
129
130
131
132
133
sudo: required
language: go
services:
- docker
os:
- linux
dist: xenial
go:
- "1.14.4"
- master
addons:
apt:
packages:
- docker-ce
- apt-cacher-ng
install:
- . $HOME/.nvm/nvm.sh
- nvm install 'lts/*'
- nvm use 'lts/*'
- npm install
cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
- $TRAVIS_BUILD_DIR/.gitian-builder-cache
- /var/cache/apt-cacher-ng
env:
global:
- GO111MODULE=on
- BUILD_VERSION=$(echo ${TRAVIS_COMMIT} | cut -c 1-10)
- GORACE="halt_on_error=1"
- MAIN_GO_VERSION=1.14.4
- VERSION=$(git describe --tags | sed 's/^v//')
- COMMIT=$(git log -1 --format='%H')
- IMAGE_NAME="iov1/iovns:${BUILD_VERSION}"
- IMAGE_NAME_FAUCET="iov1/iovns-faucet:${BUILD_VERSION}"
- IMAGE_NAME_METRICS="iov1/iovns-block-metrics:${BUILD_VERSION}"
script:
- set -eo pipefail
- make test
- make install
- 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 ;
mkdir -p ${TRAVIS_BUILD_DIR}/build && tar -zxf $TRAVIS_BUILD_DIR/iovns-build-linux/build/out/iovns-${VERSION}-linux-amd64.tar.gz -C ${TRAVIS_BUILD_DIR}/build ;
docker build --pull --tag ${IMAGE_NAME} . ;
( cd cmd/faucet && make build && docker build --pull --tag ${IMAGE_NAME_FAUCET} . );
( cd cmd/block-metrics && make build && docker build --pull --tag ${IMAGE_NAME_METRICS} . );
fi;
if [[ $release_latest == "yes" ]]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker tag "iov1/iovns:${BUILD_VERSION}" "iov1/iovns:latest" ;
docker push "iov1/iovns:latest";
docker tag "iov1/iovns-faucet:${BUILD_VERSION}" "iov1/iovns-faucet:latest" ;
docker push "iov1/iovns-faucet:latest";
docker tag "iov1/iovns-block-metrics:${BUILD_VERSION}" "iov1/iovns-block-metrics:latest" ;
docker push "iov1/iovns-block-metrics:latest";
docker logout;
fi;
if [[ $release_tag == "yes" ]]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker tag "iov1/iovns:${BUILD_VERSION}" "iov1/iovns:$TRAVIS_TAG" ;
docker push "iov1/iovns:$TRAVIS_TAG";
docker tag "iov1/iovns-faucet:${BUILD_VERSION}" "iov1/iovns-faucet:$TRAVIS_TAG" ;
docker push "iov1/iovns-faucet:$TRAVIS_TAG";
docker tag "iov1/iovns-block-metrics:${BUILD_VERSION}" "iov1/iovns-block-metrics:$TRAVIS_TAG" ;
docker push "iov1/iovns-block-metrics:$TRAVIS_TAG";
docker logout;
fi;
fi;
- iovnsd version --long
- curl --fail https://gist.githubusercontent.com/davepuchyr/e1482e63cb81443cde1616f353c4779f/raw/genesis.json > genesis.json
- export CHAIN_ID=$(jq -r .chain_id genesis.json)
- iovnsd init ${CHAIN_ID} --chain-id ${CHAIN_ID} > /dev/null 2> /dev/null
- sed --in-place 's/timeout_commit = "5s"/timeout_commit = "1s"/' ~/.iovnsd/config/config.toml
- jq '.genesis_time = "2020-04-15T10:00:00Z"' genesis.json > ~/.iovnsd/config/genesis.json
- iovnscli config chain-id ${CHAIN_ID}
- iovnscli config trust-node true
- iovnscli config keyring-backend test
- iovnscli keys add ${CHAIN_ID} --no-backup
- iovnsd add-genesis-account $(iovnscli keys show ${CHAIN_ID} -a) 1112111000000uvoi
- iovnsd gentx --name ${CHAIN_ID} --keyring-backend test --amount 1111111000000uvoi
- iovnsd collect-gentxs > /dev/null 2> /dev/null
- iovnsd validate-genesis
- iovnsd start --minimum-gas-prices='10.0uvoi' > /dev/null &
- iovnscli rest-server --trust-node true --chain-id ${CHAIN_ID} --node http://localhost:26657 > /dev/null &
- ( cd scripts/integration && yarn install && yarn test && killall iovnscli && killall iovnsd )
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}/iovns-build-linux/build/out/iovns-${VERSION}-linux-amd64.tar.gz
- ${TRAVIS_BUILD_DIR}/iovns-build-linux/build/out/src/iovns-${VERSION}.tar.gz
- ${TRAVIS_BUILD_DIR}/iovns-build-linux/result/iovns-linux-res.yml
skip_cleanup: true
on:
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$