forked from tjfoc/hyperledger-fabric-gm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
103 lines (86 loc) · 3.79 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
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
language: go
go:
- 1.8.3
sudo: required
services:
- docker
env:
# - TEST_TARGET=unit-test
- TEST_TARGET=behave
# - TEST_TARGET=node-sdk-unit-tests
before_install:
- echo "Starting Docker Daemon "
- |
export TR_PULL_REQUEST="$TRAVIS_PULL_REQUEST" && export GIT_USER="$TRAVIS_REPO_SLUG"
USER_NAME="$(echo $GIT_USER | cut -d '/' -f 1)" && REPO_NAME="$(echo $GIT_USER | cut -d '/' -f 2)"
ip="$(ifconfig docker0 | grep "inet addr:" | awk '{print $2}' | cut -d ':' -f 2)"
port="$(ps -ef | grep docker | awk '{print $10}' | cut -d ':' -f 3 | cut -d '' -f 1)"
sudo stop docker
sudo docker daemon -H tcp://0.0.0.0:$port -H unix:///var/run/docker.sock >> dockerlogfile.log 2>&1 &
install:
- echo " INSTALLING DEPENDENCIES "
- |
cd $HOME/gopath/src/github.com/$USER_NAME/$REPO_NAME
git clone https://github.com/hyperledger/fabric-baseimage.git
cd $HOME/gopath/src/github.com/$USER_NAME/$REPO_NAME/fabric-baseimage/scripts/devenv && chmod +x setup.sh && sudo ./setup.sh
rm -rf ../../../fabric-baseimage
echo " Compilers & Dependencies "
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get -qq update && sudo apt-get -qq install g++-4.8 && sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
sudo apt-get install build-essential -y
sudo ldconfig
before_script:
- cd $HOME/gopath/src/github.com/$USER_NAME/$REPO_NAME/scripts && chmod +x foldercopy.sh && ./foldercopy.sh $TR_PULL_REQUEST $USER_NAME $REPO_NAME
- sudo rm -rf /var/hyperledger/ && sudo mkdir /var/hyperledger/ && sudo chown $USER:$USER /var/hyperledger
- mkdir -p $GOPATH/src/golang.org/x
- cd $HOME/gopath/src/golang.org/x
- go get golang.org/x/tools/cmd/goimports
- cd $HOME/gopath/src/github.com/hyperledger/fabric
- chmod -R 777 *
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/bccsp
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/common
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/core
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/events
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/examples
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/gossip
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/msp
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/orderer
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/peer
- goimports -w $GOPATH/src/github.com/hyperledger/fabric/protos
- echo " CREATING BASE IMAGE "
- cd $HOME/gopath/src/github.com/$USER_NAME/$REPO_NAME/scripts && chmod +x foldercopy.sh && ./foldercopy.sh $TR_PULL_REQUEST $USER_NAME $REPO_NAME
- sudo rm -rf /var/hyperledger/ && sudo mkdir /var/hyperledger/ && sudo chown $USER:$USER /var/hyperledger
- cd /$HOME/gopath/src/github.com/hyperledger/fabric
#- make linter
script:
- echo "Executing Tests"
- cd $HOME/gopath/src/github.com/hyperledger/fabric
- sed -i -e 's/172.17.0.1:2375\b/'"$ip:$port"'/g' $HOME/gopath/src/github.com/hyperledger/fabric/bddtests/compose-defaults.yml
- sudo chmod -R 777 /usr/local/lib/python2.7/dist-packages/
- pip install b3j0f.aop
- mkdir sha3
- cd sha3
- git clone https://github.com/bjornedstrom/python-sha3
- cd python-sha3
- python setup.py build
- python setup.py install
- export BEHAVE_OPTS="-D logs=Y -o testsummary.log"
# - make behave
after_failure:
- |
echo "Click below links to view behave container log files"
cd $HOME/gopath/src/github.com/hyperledger/fabric
chmod +x scripts/containerlogs.sh
sudo ./scripts/containerlogs.sh
notifications:
email:
recipients:
- zhiqiang@tj-fintech.com
- yanwenze@tj-fintech.com
- maoxiuze@tj-fintech.com
- yewei@tj-fintech.com
on_success: never # default: change
on_failure: never # default: always