-
Notifications
You must be signed in to change notification settings - Fork 4
268 lines (268 loc) · 10.9 KB
/
test-build_rel0.12.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
name: test build rel/0.12
on:
# push:
# branches:
# - master
workflow_dispatch:
jobs:
#--------
check-commit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 20
matrix:
iotdb_version: [ rel/0.12 ]
outputs:
check_date: ${{ steps.sys-info.outputs.date }}
commit_id: ${{ steps.iotdb-info.outputs.commit_id }}
commit_time: ${{ steps.iotdb-info.outputs.commit_time }}
branch: ${{ steps.iotdb-info.outputs.branch }}
version: ${{ matrix.iotdb_version }}
filename_version: ${{ steps.iotdb-info.outputs.filename_version }}
steps:
# 收集公共信息
- name: collect common info
shell: bash
id: sys-info
run: echo "::set-output name=date::$(date +"%Y-%m-%d")"
# clone iotdb
- name: checkout apache/iotdb
uses: actions/checkout@v2
with:
path: iotdb
repository: 'apache/iotdb'
ref: ${{ matrix.iotdb_version }}
fetch-depth: 0
# 收集iotdb信息
- name: collect IoTDB information
id: iotdb-info
run: |
cd ${{ github.workspace }}/iotdb
echo "::set-output name=commit_id::$(git log -n 1 | head -n 1 | cut -d ' ' -f 2)"
echo "::set-output name=commit_time::$(git log -n1 --pretty='format:%cd' --date=iso)"
echo "::set-output name=branch::$(git branch |grep ^*|cut -d ' ' -f 2)"
echo "::set-output name=filename_version::$(cat pom.xml | grep -e '^ <version>' | sed 's# ##g' | sed 's#<version>##g' | sed 's#</version>##g')"
# clone 本程序
- name: checkout iotdb-daily-build
uses: actions/checkout@v2
with:
path: iotdb-daily-build
repository: 'xiaoyekanren/iotdb-daily-build'
ref: master
fetch-depth: 0
# clone 本程序 db分支
- name: Checkout db for save results
uses: actions/checkout@v2
with:
path: db
repository: 'xiaoyekanren/iotdb-daily-build'
ref: db
fetch-depth: 0
# 检查db文件,如果有commit就更新db,并开始后续测试
- name: check
id: check-commit
env:
PYTHONPATH: $PYTHONPATH:${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012
run: |
cd ${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012
result=$(python3 check_commit.py '${{ github.workspace }}/db/db/db.db' '${{ steps.iotdb-info.outputs.branch }}' '${{ steps.iotdb-info.outputs.commit_id }}' '${{ steps.iotdb-info.outputs.commit_time }}')
echo "::set-output name=result::$(echo $result)"
echo $result
# 判断是stop还是update
# exit 0 是正常退出,exit 其他数 是错误退出
- name: check check's results
if: ${{ steps.check-commit.outputs.result == 'stop' }}
run: exit 0
## 上传db文件
# - name: upload db
# if: ${{ steps.check-commit.outputs.result == 'update' }}
# env:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# run: |
# cd ${{ github.workspace }}/db
# git config --local user.email "876670773+github-actions[bot]@qq.com"
# git config --local user.name "github-actions[bot]"
# cd db
# git add db.db
# git commit -m "${{steps.sys-info.outputs.date}} github-actions[bot] push update "
# git push -u origin db
## debug
# - name: check
# id: check-commit
# env:
# PYTHONPATH: $PYTHONPATH:${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012
# run: |
# cd ${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012
# python3 test_db.py '${{ github.workspace }}/db/db/db.db' 'select * from commit_last'
- name: for Collapse code
run: echo "whoami,hhahha"
#--------
remote-mkdir-path:
if: ${{ steps.check-commit.outputs.result != 'stop' }}
needs: [ check-commit ]
runs-on: ubuntu-latest
outputs:
remote_path: ${{ steps.ready-upload.outputs.dest_path }}
steps:
# 准备上传用信息
- name: ready to upload
id: ready-upload
run: |
echo "::set-output name=dest_path::$(echo /home/ubuntu/web/downloads/${{ matrix.java_version }})"
# 创建对应文件夹
- name: ssh to mkdir
uses: appleboy/ssh-action@master
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }}
with:
host: ${{ secrets.IOTDBFUTURE_HOST }}
username: ${{ secrets.IOTDBFUTURE_HOST_USER }}
key: ${{ secrets.IOTDBFUTURE_TOKEN }}
port: ${{ secrets.IOTDBFUTURE_HOST_PORT }}
script: mkdir -p ${{ steps.ready-upload.outputs.dest_path }}
#--------
create-release:
needs: collect
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Create release java-8
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.collect.outputs.date }}-apache-iotdb
release_name: ${{ needs.collect.outputs.date }} apache iotdb
body: |
${{ needs.check-commit.outputs.check_date }},
${{ needs.check-commit.outputs.commit_id }},
${{ needs.check-commit.outputs.commit_time }},
${{ needs.check-commit.outputs.branch }},
${{ needs.check-commit.outputs.version }},
${{ needs.check-commit.outputs.filename_version }}
draft: false
prerelease: false
#--------
build-in-linux:
if: ${{ steps.check-commit.outputs.result != 'stop' }}
needs: [ check-commit,remote-mkdir-path,create-release ]
strategy:
fail-fast: false
max-parallel: 20
matrix:
java_version: [ 8,11 ]
runs-on: ubuntu-latest
steps:
# set java
- name: Set java 8
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java_version }}
# clone iotdb
- name: Checkout apache/iotdb
uses: actions/checkout@v2
with:
path: iotdb
repository: 'apache/iotdb'
ref: ${{ needs.check-commit.outputs.branch }}
fetch-depth: 0
# 编译IoTDB
- name: compile iotdb
run: |
cd ${{ github.workspace }}/iotdb
git checkout ${{ needs.check-commit.outputs.commit_id }}
mvn clean package -DskipTests
# 上传iotdb包到远程服务器
- name: scp to upload file
uses: appleboy/scp-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
host: ${{ secrets.IOTDBFUTURE_HOST }}
username: ${{ secrets.IOTDBFUTURE_HOST_USER }}
port: ${{ secrets.IOTDBFUTURE_HOST_PORT }}
key: ${{ secrets.IOTDBFUTURE_TOKEN }}
source: ${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ needs.check-commit.outputs.filename_version }}-all-bin.zip
target: ${{ steps.ready-upload.outputs.dest_path }}
#--------
build-in-win:
if: ${{ steps.check-commit.outputs.result != 'stop' }}
needs: [ check-commit ]
strategy:
fail-fast: false
max-parallel: 20
matrix:
java_version: [ 8,11 ]
os: [ windows-2022 ]
runs-on: ${{ matrix.os }}
steps:
# 设置java
- name: Set java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java_version }}
# 从iotdb-daily-build-dependence下载已经编译好的boost
- name: download & unpack & install -> boost
shell: cmd
run: |
C:\msys64\usr\bin\wget.exe -O ${{ github.workspace }}/boost_1_78_0-bin.7z https://github.com/xiaoyekanren/iotdb-daily-build-dependence/releases/download/release-depend-bin/boost_1_78_0-bin.7z
7z x ${{ github.workspace }}/boost_1_78_0-bin.7z -o${{ github.workspace }}/boost_1_78_0
# C:\msys64\usr\bin\wget.exe -O ${{ github.workspace }}/boost_1_78_0.zip https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip
# 7z x ${{ github.workspace }}/boost_1_78_0.zip -o${{ github.workspace }}/boost_1_78_0
# cd ${{ github.workspace }}/boost_1_78_0/boost_1_78_0
# .\bootstrap.bat
# .\b2
# echo "::set-output name=include::$(git branch |grep ^*|cut -d ' ' -f 2)"
# echo "::set-output name=library::$(git branch |grep ^*|cut -d ' ' -f 2)"
# 下载解压flex和bison
- name: download & unpack flex&bison
shell: cmd
run: |
C:\msys64\usr\bin\wget.exe -O ${{ github.workspace }}/win_flex_bison-latest.zip https://jaist.dl.sourceforge.net/project/winflexbison/win_flex_bison-latest.zip
7z x ${{ github.workspace }}/win_flex_bison-latest.zip -o${{ github.workspace }}/win_flex_bison-latest
# chcoc安装openssl
- name: install openssl
run: |
choco install openssl
# clone iotdb
- name: Checkout apache/iotdb
uses: actions/checkout@v2
with:
path: iotdb
repository: 'apache/iotdb'
ref: ${{ needs.check-commit.outputs.branch }}
fetch-depth: 0
# 编译iotdb client-cpp
- name: compile client-cpp
shell: cmd
env:
boost-include-dir: ${{ github.workspace }}\boost_1_78_0\boost_1_78_0
boost-library.dir: ${{ github.workspace }}\boost_1_78_0\boost_1_78_0\stage\lib
cmake-url: https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-windows-x86_64.zip
cmake-root-dir: ${{ github.workspace }}\iotdb\compile-tools\thrift\target\cmake-3.23.1-windows-x86_64
run: |
cd ${{ github.workspace }}\iotdb
set Path=%Path%;${{ github.workspace }}\win_flex_bison-latest
set Path
mvn package -Dcmake.generator="Visual Studio 17 2022" -P compile-cpp -pl server,client-cpp,example/client-cpp-example -am -DskipTests -Dboost.include.dir="%boost-include-dir%" -Dboost.library.dir="%boost-library.dir%" -Dcmake.url="%cmake-url%" -Dcmake.root.dir="%cmake-root-dir%"
# 压缩example文件
- name: compress client-cpp-example
shell: bash
run: |
cd iotdb/example/client-cpp-example/target
7z a client-cpp-example-${{ steps.iotdb-info.outputs.version }}-cpp-windows-x86_64.zip client CMakeLists.txt SessionExample.cpp
# 上传iotdb包到远程服务器
- name: scp to upload file
uses: appleboy/scp-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
host: ${{ secrets.IOTDBFUTURE_HOST }}
username: ${{ secrets.IOTDBFUTURE_HOST_USER }}
port: ${{ secrets.IOTDBFUTURE_HOST_PORT }}
key: ${{ secrets.IOTDBFUTURE_TOKEN }}
source: ${{ github.workspace }}/iotdb/example/client-cpp-example/target/client-cpp-example-${{ needs.check-commit.outputs.filename_version }}-cpp-windows-x86_64.zip
target: ${{ steps.ready-upload.outputs.dest_path }}