forked from hyperledger-bevel/bevel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_travis.yml
192 lines (185 loc) · 7.18 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
---
# Travis CI file for automated test, build and release-artifact creation
# Base machine is linux, xenial with openjdk8
dist: xenial
os: linux
language: java
jdk:
- openjdk8
# This starts the docker daemon and services
services:
- docker
# The following tags (staring with _ ) are private aliases which are used to group same stages like a function
# _molecule is used to run molecule test jobs
# ENV Vars are DIR and the molecule SCENARIO
_molecule: &molecule
stage: Unit Tests
language: python
python:
- "3.6"
install:
- pip install molecule==3.0.6 yamllint ansible-lint docker==4.2.2 openshift
- export DOCKER_API_VERSION='1.38'
script:
- cd $DIR
- molecule test -s $SCENARIO
# _node_build is used for maven build and upload to dockerhub
# ENV Vars are DIR and the docker IMAGE_NAME and the docker_build ARGS
_node_build: &node_build
stage: Build
install:
- curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
- sudo apt-get install -y nodejs
script:
- cd $DIR
- mvn clean install
- | # Docker is being repeated because TravisCI does not allow sharing of cache
echo $TRAVIS_BRANCH
echo $TRAVIS_TAG
if [[ $TRAVIS_BRANCH == "master" ]]; then
local_tag="stable"
elif [[ ${TRAVIS_TAG:0:1} == "v" ]]; then
local_tag=$TAG_PREFIX${TRAVIS_TAG:1}
else
local_tag=$TAG_PREFIX"latest"
fi
- echo $local_tag
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
- docker build $ARGS -t $IMAGE_NAME:$local_tag .
- docker push $IMAGE_NAME:$local_tag
# _docker_push is used for build image and upload to dockerhub
# ENV Vars are DIR and the docker IMAGE_NAME and the docker_build ARGS
_docker_push: &docker_push
stage: Build
install: skip
script:
- cd $DIR
- |
echo $TRAVIS_BRANCH
echo $TRAVIS_TAG
if [[ $TRAVIS_BRANCH == "master" ]]; then
local_tag="stable"
elif [[ ${TRAVIS_TAG:0:1} == "v" ]]; then
local_tag=$TAG_PREFIX${TRAVIS_TAG:1}
else
local_tag=$TAG_PREFIX"latest"
fi
- echo $local_tag
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
- docker build $ARGS -t $IMAGE_NAME:$local_tag .
- docker push $IMAGE_NAME:$local_tag
stages:
- name: Unit Tests
# the if condition specifies that this stage will run only if tag is blank
if: tag IS blank
- name: Build
# the if condition specifies all build jobs run only for master and develop branch and for tags starting with v
if: (branch IN ("master", "develop") AND type != pull_request) OR tag =~ /^(v)/
# The actual job definition starts from here
jobs:
fast_finish: true
include:
- stage: Unit Tests # Test the cordapps
name: Test Cordapps
install: skip
script:
- cd examples/supplychain-app/corda/cordApps_springBoot
- ./gradlew test
- <<: *molecule # use _molecule alias to run molecule test for shared dir
name: Shared test
env:
- DIR: platforms/shared/configuration
- SCENARIO: default
- <<: *molecule # use _molecule alias to run molecule test for Corda shared dir
name: Corda test
env:
- DIR: platforms/shared/configuration
- SCENARIO: kubernetes-corda
- <<: *molecule
name: Fabric test # use molecule alias to run molecule test for Fabric shared dir
env:
- DIR: platforms/shared/configuration
- SCENARIO: kubernetes-fabric
- <<: *molecule
name: Indy test # use molecule alias to run molecule test for Indy shared dir
env:
- DIR: platforms/shared/configuration
- SCENARIO: kubernetes-indy
#TODO Add platforms/..corda molecule test(s)
#TODO Add platforms/..fabric molecule test(s)
#TODO Add platforms/..indy molecule test(s)
#TODO Add platforms/..quorum molecule test(s)
#TODO Add fabric chaincode test(s)
#TODO Add quorum smartcontract test(s)
#TODO Add application molecule test(s)
- <<: *node_build # use node_build alias to run doorman build
name: Corda Doorman build
env:
- DIR: platforms/r3-corda/images/doorman
- IMAGE_NAME: "hyperledgerlabs/doorman-linuxkit"
- <<: *node_build # use node_build alias to run networkmap build
name: Corda Networkmap build
env:
- DIR: platforms/r3-corda/images/networkmap
- IMAGE_NAME: "hyperledgerlabs/networkmap-linuxkit"
#TODO Add corda (specific version) image build
#TODO Add baf-build image build
#TODO Add Indy image build job
- stage: Build
name: Build Corda springboot-web and release Cordapps # Build cordapps and push corda springboot image
install: skip
env:
- IMAGE_NAME: "hyperledgerlabs/supplychain_corda"
- TAG_PREFIX: "springboot_"
script:
- |
echo $TRAVIS_TAG
if [[ -z $TRAVIS_TAG ]]; then
VERSION="0.1"
elif [[ ${TRAVIS_TAG:0:1} == "v" ]]; then
VERSION=${TRAVIS_TAG:1}
else
VERSION="0.1"
fi
- cd examples/supplychain-app/corda/cordApps_springBoot
- echo $VERSION
- ./gradlew -Pversion=$VERSION deployWebapps
- ./gradlew -Pversion=$VERSION build
- | # Docker is being repeated because TravisCI does not allow sharing of cache
echo $TRAVIS_BRANCH
echo $TRAVIS_TAG
if [[ $TRAVIS_BRANCH == "master" ]]; then
local_tag="stable"
elif [[ ${TRAVIS_TAG:0:1} == "v" ]]; then
local_tag=$TAG_PREFIX${TRAVIS_TAG:1}
else
local_tag=$TAG_PREFIX"latest"
fi
- echo $local_tag
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
- docker build --build-arg var_WEBAPP_NAME=webserver-supply-chain-$VERSION.jar -t $IMAGE_NAME:$local_tag .
- docker push $IMAGE_NAME:$local_tag
- <<: *docker_push
name: Build Corda express_app image # use docker_push alias to create corda express_app image
env:
- DIR: "examples/supplychain-app/corda/express_nodeJS"
- IMAGE_NAME: "hyperledgerlabs/supplychain_corda"
- TAG_PREFIX: "express_app_"
- <<: *docker_push
name: Build Supplychain frontend image # use docker_push alias to create supplychain frontend image
env:
- DIR: "examples/supplychain-app/supplychain-frontend"
- IMAGE_NAME: "hyperledgerlabs/supplychain_frontend"
- <<: *docker_push
name: Build Fabric rest_server image # use docker_push alias to create fabric restserver image
env:
- DIR: "examples/supplychain-app/fabric/chaincode_rest_server/rest-server"
- IMAGE_NAME: "hyperledgerlabs/supplychain_fabric"
- TAG_PREFIX: "rest_server_"
- <<: *docker_push
name: Build Fabric express_app image # use docker_push alias to create fabric express_app image
env:
- DIR: "examples/supplychain-app/fabric/express_nodeJs"
- IMAGE_NAME: "hyperledgerlabs/supplychain_fabric"
- TAG_PREFIX: "express_app_"
#TODO Add quorum express_app image build