forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
128 lines (108 loc) · 3.98 KB
/
config.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
version: 2
jobs:
build:
# must be IROHA_HOME:
working_directory: /opt/iroha
docker:
- image: warchantua/iroha-dev
environment:
IROHA_HOME: /opt/iroha
IROHA_BUILD: /tmp/build
- image: ubuntu:16.04
steps:
- run:
name: build and install grpc
command: |
apt-get -qq update; apt-get -y install golang
cd /tmp; git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
cd grpc && git submodule update --init && make && make install
- checkout
- run:
name: ensure, required folders created
command: |
mkdir -p $IROHA_HOME
mkdir -p $IROHA_BUILD
- run:
name: cmake
command: |
cd $IROHA_BUILD
cmake $IROHA_HOME
- run:
name: make
command: |
cd $IROHA_BUILD
make -j2
- run:
name: run tests
command: |
TEST_FOLDER=$IROHA_BUILD/test_bin
total=0
for file in ${TEST_FOLDER}/*; do
# run test
${file}
total=$((total + $?))
done
exit $total
# integrated into circle 2.0
- setup_docker_engine
## At this step we have compiled and tested iroha.
- run:
name: setup docker
command: |
set -ex
curl -L -o /tmp/docker.tgz https://get.docker.com/builds/Linux/x86_64/docker-17.03.0-ce.tgz
tar -xz -C /tmp -f /tmp/docker.tgz
mv /tmp/docker/* /usr/bin
- run:
name: setup docker-compose
command: |
set -ex
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- run:
name: build and push hyperledger/iroha-docker:$CIRCLE_BRANCH image
command: |
# replace all invalid characters to dots
TAG=$(echo $CIRCLE_BRANCH | sed "s/[^a-zA-Z0-9_\-\.]/./g")
export TAG=$TAG
# directory, where iroha build files will reside
export RELEASE=$IROHA_HOME/docker/tiny/iroha
mkdir -p $RELEASE/lib
# extract all libraries which use iroha:
LIBS=$(ldd $IROHA_BUILD/bin/iroha-main | cut -f 2 | cut -d " " -f 3)
# copy libraries (-H = follow links)
cp -H $LIBS $RELEASE/lib
# copy build artifacts
rsync -avr ${IROHA_BUILD}/bin ${RELEASE}
rsync -avr ${IROHA_HOME}/docker/tiny/scripts ${RELEASE}
mkdir -p ${RELEASE}/config
cp ${IROHA_HOME}/config/config.json ${RELEASE}/config/config.json
# build image
cd $IROHA_HOME/docker/tiny
docker build -t hyperledger/iroha-docker:$TAG .
# login
expect -c '\
set timeout 10
spawn docker login
expect "Username:*"
send -- "$env(DOCKER_USER)\r"
expect "Password:*"
send -- "$env(DOCKER_PASS)\r"
expect "*Login Succeeded*"'
# and push
docker push hyperledger/iroha-docker:$TAG
# clean up
rm -rf $RELEASE
## At this step we have hyperledger/iroha-docker:$TAG image, we can test it now
## you can use it by tag:
## hyperledger/iroha-docker:$TAG
## don't forget, that call docker run hyperledger/iroha-docker:$TAG is blocking.
## to make in unblocking, run with -d
##
## put your tests here as separate run command, here is the template:
#- run:
# name: test name
# command: |
# test body (bash)
# test body (bash)
# don't forget to clean up after tests (if needed)