-
Notifications
You must be signed in to change notification settings - Fork 177
260 lines (257 loc) · 11.2 KB
/
CI.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master, develop, release/** ]
jobs:
weid-java-sdk-ci:
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3
- name: Start Redis Server
uses: karenlrx/[email protected]
with:
redis-version: 5
- name: Verify Redis connection
run: |
sudo docker exec redis redis-cli -p 6379 -a 123456 ping
- name: Verify MySQL connection and create CI DB
run: |
sudo systemctl start mysql.service
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'CREATE DATABASE IF NOT EXISTS cidb;'
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'show databases;'
- name: Prepare blockchain nodes and certificates
run: |
mkdir -p fisco && cd fisco
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.7.1/build_chain.sh && chmod u+x build_chain.sh
bash build_chain.sh -l "127.0.0.1:2" -p 30300,20200,8545
bash nodes/127.0.0.1/start_all.sh
ps -ef | grep -v grep | grep fisco
cd ..
cp ./fisco/nodes/127.0.0.1/sdk/* ./.ci/
- name: Prepare gradle
uses: eskatos/gradle-command-action@v1
with:
gradle-version: 5.6
- name: source-code deployment
run: |
export NODE_IP=127.0.0.1:20200
export NODE2_IP=127.0.0.1:20201
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
chmod u+x .ci/script/build-ci.sh
.ci/script/build-ci.sh 127.0.0.1:3306 cidb root root 127.0.0.1:6379 123456 redis
- name: Run CI
run: |
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
gradle check -i
gradle jacocoTestReport
bash <(curl -s https://codecov.io/bash)
- name: Download failed log (if any)
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: sdk-log
path: /home/runner/work/WeIdentity/WeIdentity/build/reports/
weid-sample-ci:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3
- name: Verify MySQL connection and create CI DB
run: |
sudo systemctl start mysql.service
sudo apt-get install -y mysql-client
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'CREATE DATABASE IF NOT EXISTS cidb;'
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'show databases;'
- name: Prepare blockchain nodes and certificates
run: |
mkdir -p fisco && cd fisco
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.7.1/build_chain.sh && chmod u+x build_chain.sh
bash build_chain.sh -l "127.0.0.1:2" -p 30300,20200,8545
bash nodes/127.0.0.1/start_all.sh
ps -ef | grep -v grep | grep fisco
cd ..
cp ./fisco/nodes/127.0.0.1/sdk/* ./.ci/
- name: Prepare gradle
uses: eskatos/gradle-command-action@v1
with:
gradle-version: 5.6
- name: source-code deployment
run: |
export NODE_IP=127.0.0.1:20200
export NODE2_IP=127.0.0.1:20201
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
chmod u+x .ci/script/build-ci.sh
.ci/script/build-ci.sh 127.0.0.1:3306 cidb root root 127.0.0.1:6379 123456 redis
- name: Checkout and prepare
run: |
git clone https://github.com/WeBankFinTech/weid-sample.git
cd weid-sample
git checkout develop
cd ..
mkdir -p weid-sample/dependencies
cp dist/app/*.jar weid-sample/dependencies/weid-java-sdk-pipeline.jar
mkdir -p weid-sample/libs
cp dist/lib/*.jar weid-sample/libs/
cp ecdsa_key weid-sample/keys/priv/
cp src/main/resources/fisco.properties weid-sample/resources/
cp src/main/resources/weidentity.properties weid-sample/resources/
cp .ci/ca.crt weid-sample/resources/
cp .ci/node.crt weid-sample/resources/
cp .ci/node.key weid-sample/resources/
- name: Run CI
run: |
cd weid-sample
chmod u+x *.sh
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
export NODE_IP=127.0.0.1:20200
export NODE2_IP=127.0.0.1:20201
./build.sh
- name: Download failed log (if any)
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: sample-log
path: /home/runner/work/WeIdentity/WeIdentity/weid-sample/build/reports/
weid-http-service-ci:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3
- name: Verify MySQL connection and create CI DB
run: |
sudo systemctl start mysql.service
sudo apt-get install -y mysql-client
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'CREATE DATABASE IF NOT EXISTS cidb;'
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'show databases;'
- name: Prepare blockchain nodes and certificates
run: |
mkdir -p fisco && cd fisco
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.7.1/build_chain.sh && chmod u+x build_chain.sh
bash build_chain.sh -l "127.0.0.1:2" -p 30300,20200,8545
bash nodes/127.0.0.1/start_all.sh
ps -ef | grep -v grep | grep fisco
cd ..
cp ./fisco/nodes/127.0.0.1/sdk/* ./.ci/
- name: Prepare gradle
uses: eskatos/gradle-command-action@v1
with:
gradle-version: 5.6
- name: source-code deployment
run: |
export NODE_IP=127.0.0.1:20200
export NODE2_IP=127.0.0.1:20201
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
chmod u+x .ci/script/build-ci.sh
.ci/script/build-ci.sh 127.0.0.1:3306 cidb root root
- name: Checkout and prepare
run: |
git clone https://github.com/WeBankFinTech/weid-http-service.git
cp dist/app/*.jar weid-http-service/dependencies/weid-java-sdk-pipeline.jar
mkdir -p weid-http-service/libs
cp dist/lib/* weid-http-service/libs
cp ecdsa_key weid-http-service/src/main/resources/ && cp ecdsa_key weid-http-service/src/test/resources/ && cp ecdsa_key weid-http-service/keys/priv/ && cp ecdsa_key weid-http-service/dist/keys/priv/
cp src/main/resources/fisco.properties weid-http-service/src/main/resources/
cp src/main/resources/fisco.properties weid-http-service/src/test/resources/
cp src/main/resources/weidentity.properties weid-http-service/src/main/resources/
cp src/main/resources/weidentity.properties weid-http-service/src/test/resources/
cp .ci/ca.crt weid-http-service/src/test/resources/
cp .ci/ca.crt weid-http-service/src/main/resources/
cp .ci/node.crt weid-http-service/src/test/resources/
cp .ci/node.crt weid-http-service/src/main/resources/
cp .ci/node.key weid-http-service/src/test/resources/
cp .ci/node.key weid-http-service/src/main/resources/
- name: Run CI
run: |
cd weid-http-service/
export PATH=/home/runner/gradle-installations/installs/gradle-5.6.1/bin:$PATH
ls -ll libs
gradle clean build -i -x test
- name: Download failed log (if any)
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: http-service-log
path: /home/runner/work/WeIdentity/WeIdentity/weid-http-service/build/reports/
weid-build-tools-ci:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3
- name: Verify MySQL connection and create CI DB
run: |
sudo systemctl start mysql.service
sudo apt-get install -y mysql-client
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'CREATE DATABASE IF NOT EXISTS cidb;'
mysql --host=127.0.0.1 --port=3306 --user=root --password=root -e 'show databases;'
- name: Prepare blockchain nodes and certificates
run: |
mkdir -p fisco && cd fisco
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.7.1/build_chain.sh && chmod u+x build_chain.sh
bash build_chain.sh -l "127.0.0.1:2" -p 30300,20200,8545
bash nodes/127.0.0.1/start_all.sh
ps -ef | grep -v grep | grep fisco
cd ..
cp ./fisco/nodes/127.0.0.1/sdk/* ./.ci/
- name: Prepare gradle
uses: eskatos/gradle-command-action@v1
with:
gradle-version: 5.6
- name: source-code deployment
run: |
export NODE_IP=127.0.0.1:20200
export NODE2_IP=127.0.0.1:20201
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
chmod u+x .ci/script/build-ci.sh
.ci/script/build-ci.sh 127.0.0.1:3306 cidb root root
- name: Checkout and prepare
run: |
git clone https://github.com/WeBankFinTech/weid-build-tools.git
mkdir -p weid-build-tools/dependencies
cp dist/app/*.jar weid-build-tools/dependencies/weid-java-sdk-pipeline.jar
wget https://github.com/FISCO-BCOS/fisco-solc/raw/master/fisco-solc-ubuntu
sudo cp fisco-solc-ubuntu /usr/bin/fisco-solc
sudo chmod u+x /usr/bin/fisco-solc
cp .ci/ca.crt weid-build-tools/resources/
cp .ci/node.crt weid-build-tools/resources/
cp .ci/node.key weid-build-tools/resources/
- name: Run CI
run: |
cd weid-build-tools/
export PATH=/home/runner/gradle-installations/installs/gradle-5.6/bin:$PATH
sed -i -e '$a\org_id=test' run.config
sed -i -e '$a\amop_id=test' run.config
sed -i -e '$a\blockchain_address=127.0.0.1:20200' run.config
sed -i -e '$a\mysql_address=127.0.0.1:3306' run.config
sed -i -e '$a\mysql_database=cidb' run.config
sed -i -e '$a\mysql_username=root' run.config
sed -i -e '$a\mysql_password=root' run.config
chmod u+x compile.sh
./compile.sh
chmod u+x deploy.sh
./deploy.sh
cp ./common/script/build_tools_ci.sh .
chmod u+x build_tools_ci.sh
./build_tools_ci.sh
- name: Download failed log (if any)
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: build-tools-log
path: /home/runner/work/WeIdentity/WeIdentity/weid-build-tools/build/reports/