-
Notifications
You must be signed in to change notification settings - Fork 4
315 lines (307 loc) · 12 KB
/
workflow-check-start_stop.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# 用于在多种不同操作系统,多种jdk环境下,进行iotdb的启停测试
name: iotdb 启停测试
on:
schedule:
- cron: "0 12 * * *"
workflow_dispatch:
jobs:
#--------
check-commit:
outputs:
commit_id: ${{steps.check-cur-status.outputs.commit_id}}
commit_id_short: ${{ steps.check-cur-status.outputs.commit_id_short }}
version: ${{ steps.check-cur-status.outputs.version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 20
matrix:
os: [ ubuntu-latest ]
steps:
# get iotdb
- name: Checkout apache/iotdb
uses: actions/checkout@v2
with:
path: iotdb
repository: 'apache/iotdb'
ref: 'rel/1.0'
fetch-depth: 0
# get cur-repository
- name: Checkout iotdb-daily-build
uses: actions/checkout@v2
with:
path: iotdb-daily-build
repository: 'xiaoyekanren/iotdb-daily-build'
ref: 'master'
fetch-depth: 0
# check cur status
- name: check
id: check-cur-status
run: |
cd ${{ github.workspace }}/iotdb
echo "commit_id=$( git rev-parse HEAD )" >> $GITHUB_OUTPUT
echo "commit_id_short=$( git rev-parse --short HEAD )" >> $GITHUB_OUTPUT
echo "commit_time=$(git log -n1 --pretty='format:%cd' --date=iso)" >> $GITHUB_OUTPUT
echo "commit_user=$(git log | head -n 2 | tail -n 1 | cut -d ' ' -f 2)" >> $GITHUB_OUTPUT
echo "version=$(cat pom.xml | grep -e '^ <version>' | sed 's# ##g' | sed 's#<version>##g' | sed 's#</version>##g')" >> $GITHUB_OUTPUT
echo $(git rev-parse HEAD)
# check update
- name: check
id: check-old-commit
run: |
cd ${{ github.workspace }}/iotdb-daily-build
echo "last_commit=$(cat .github/release_history.txt | tail -n 1)" >> $GITHUB_OUTPUT
echo $(cat .github/release_history.txt | tail -n 1)
# compare
- name: check check's results
run: |
echo "txt pid: ${{ steps.check-old-commit.outputs.last_commit }}"
echo "res pid: ${{ steps.check-cur-status.outputs.commit_id }}"
# equal means no update
# "exit 0" is exits normally,"exit other" is exception exit
- name: check check's results
if: ${{ steps.check-cur-status.outputs.commit_id == steps.check-old-commit.outputs.last_commit || steps.check-cur-status.outputs.commit_user == 'github-actions[bot]' }}
run: |
exit 0
exit 1
check-in-windows:
needs: check-commit
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 20
matrix:
# java_version: [ 8 ]
java_version: [ 8, 11, 13, 15, 17, 18, 19 ]
os: [ windows-latest ]
steps:
# set java
- name: Set java ${{ matrix.java_version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java_version }}
distribution: 'zulu'
# clone i-d-b
- name: checkout iotdb-daily-build
uses: actions/checkout@v2
with:
path: iotdb-daily-build
repository: 'xiaoyekanren/iotdb-daily-build'
ref: master
fetch-depth: 0
# collect i-d-b information
- name: iotdb-daily-build info
id: info-idb
shell: pwsh
run: |
cd ${{ github.workspace }}/iotdb-daily-build
echo "idb_home=$(pwd)" >> $env:GITHUB_OUTPUT
# get iotdb
- name: Checkout apache/iotdb
uses: actions/checkout@v2
with:
path: iotdb-src
repository: 'apache/iotdb'
ref: 'rel/1.0'
fetch-depth: 0
# build iotdb
- name: build iotdb
id: build-iotdb
shell: pwsh
run: |
cd ${{ github.workspace }}/iotdb-src
mvn clean package -DskipTests -am -pl distribution
mv ${{ github.workspace }}/iotdb-src/distribution/target/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin ${{ github.workspace }}/iotdb-bin
cd ${{ github.workspace }}/iotdb-bin
echo "iotdb_home=$(pwd)" >> $env:GITHUB_OUTPUT
# C:\msys64\usr\bin\wget.exe -O${{ github.workspace }}/apache-iotdb-1.0.1-SNAPSHOT-all-bin-master-e68f560463.zip https://github.com/xiaoyekanren/iotdb-daily-build/releases/download/2022-12-12-java8-apache-iotdb/apache-iotdb-1.0.1-SNAPSHOT-all-bin-master-e68f560463.zip
# 7z x apache-iotdb-1.0.1-SNAPSHOT-all-bin-master-e68f560463.zip
# cd apache-iotdb-1.0.1-SNAPSHOT-all-bin
# echo "::set-output name=iotdb_home::$(pwd)"
- name: check para.
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
echo "iotdb_home: ${{ steps.build-iotdb.outputs.iotdb_home }}"
echo "idb_home: ${{ steps.info-idb.outputs.idb_home }}"
echo "copy start-scripts to <iotdb>/sbin..."
cp ${{ steps.info-idb.outputs.idb_home }}/action-workflow-check-start_stop/check_scripts/step_1_start_confignode.vbs ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin/step_1_start_confignode.vbs
cp ${{ steps.info-idb.outputs.idb_home }}/action-workflow-check-start_stop/check_scripts/step_3_start_datanode.vbs ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin/step_3_start_datanode.vbs
# start test...
- name: start confignode.
shell: cmd
run: |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin
step_1_start_confignode.vbs
- name: sleep 10.
shell: pwsh
run: |
sleep 10
- name: check start confignode.
shell: cmd
run: |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts
step_2_check_start_confignode.bat ${{ steps.build-iotdb.outputs.iotdb_home }}
- name: start datanode.
shell: cmd
run: |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin
step_3_start_datanode.vbs
- name: sleep 10.
shell: pwsh
run: |
sleep 10
- name: check start datanode
shell: cmd
run: |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts
step_4_check_start_datanode.bat ${{ steps.build-iotdb.outputs.iotdb_home }}
- name: echo pid.
shell: cmd
run: |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts
step_0_get_path.bat ${{ steps.build-iotdb.outputs.iotdb_home }}
- name: stop datanode.
shell: cmd
run: |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin
echo "stop datanode."
stop-datanode.bat
- name: sleep 3.
shell: pwsh
run: |
sleep 3
- name: check stop datanode.
shell: cmd
run: |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts
step_5_check_stop_datanode.bat ${{ steps.build-iotdb.outputs.iotdb_home }}
- name: stop confignode.
shell: cmd
run: |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin
echo "stop confignode."
stop-confignode.bat
- name: sleep 3.
shell: pwsh
run: |
sleep 3
- name: check stop confignode.
shell: cmd
run: |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts
step_6_check_stop_confignode.bat ${{ steps.build-iotdb.outputs.iotdb_home }}
check-in-linux:
needs: check-commit
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 20
matrix:
java_version: [ 8, 11, 13, 15, 17, 18, 19 ]
os: [ ubuntu-latest ]
steps:
# set java
- name: Set java ${{ matrix.java_version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java_version }}
distribution: 'zulu'
# get iotdb
- name: Checkout apache/iotdb
uses: actions/checkout@v2
with:
path: iotdb
repository: 'apache/iotdb'
ref: 'rel/1.0'
fetch-depth: 0
# build iotdb
- name: build iotdb
id: build-iotdb
run: |
cd ${{ github.workspace }}/iotdb
mvn clean package -DskipTests -am -pl distribution
mv ${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin ${{ github.workspace }}/iotdb-binary
# test
- name: test start on ${{matrix.os}}
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd ${{ github.workspace }}/iotdb-binary
nohup sbin/start-confignode.sh > /dev/null 2>&1 &
cf_pid=$!
echo "confignode pid is ${cf_pid}"
sleep 10
nohup sbin/start-datanode.sh > /dev/null 2>&1 &
df_pid=$!
echo "datanode pid is ${df_pid}"
sleep 5
ps_cf_pid=$(ps -aux | grep $cf_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}')
ps_df_pid=$(ps -aux | grep $df_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}')
if [ "${ps_df_pid}1" == "1" ]; then
echo "Check start-datanode failed. exit.."
echo ------${ps_df_pid}1------
exit 1
else
echo "Check start-datanode Success. "
fi
if [ "${ps_cf_pid}1" == "1" ]; then
echo "Check start-confignode failed. exit.."
echo ------${ps_cf_pid}1------
exit 1
else
echo "Check start-confignode Success. "
fi
sbin/stop-datanode.sh
sleep 5
ps -aux | grep $df_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}'
ps_df_pid=$(ps -aux | grep $df_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}')
if [ "${ps_df_pid}1" == "1" ]; then
echo "Check stop-datanode Success. "
else
echo "Check stop-datanode failed. exit.."
ps -aux | grep $df_pid
echo ------${ps_df_pid}1------
exit 1
fi
sbin/stop-confignode.sh
sleep 5
ps -aux | grep $cf_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}'
ps_cf_pid=$(ps -aux | grep $cf_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}')
if [ "${ps_cf_pid}1" == "1" ]; then
echo "Check stop-confignode Success. "
else
echo "Check stop-confignode failed. exit.."
ps -aux | grep $cf_pid
echo ------${ps_cf_pid}1------
exit 1
fi
push-commit-id:
needs: [ check-commit,check-in-linux,check-in-windows ]
runs-on: ubuntu-latest
steps:
# get time
- name: collect common info
shell: bash
id: sys-info
run: |
echo "date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
# get cur-repository
- name: Checkout iotdb-daily-build
uses: actions/checkout@v2
with:
path: iotdb-daily-build
repository: 'xiaoyekanren/iotdb-daily-build'
ref: 'master'
fetch-depth: 0
# push commit id to repository
- name: push commit
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ${{ github.workspace }}/iotdb-daily-build
git config --local user.email "876670773+github-actions[bot]@qq.com"
git config --local user.name "github-actions[bot]"
echo ${{ needs.check-commit.outputs.commit_id }} >> .github/release_history.txt
git add .github/release_history.txt
git commit -m "${{ steps.sys-info.outputs.date }}-${{ needs.check-commit.outputs.commit_id_short }}"
git push -u origin master