This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
forked from thulab/iotdb-daily-build
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (156 loc) · 6.07 KB
/
test_upload.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
name: test for upload
on:
workflow_dispatch:
jobs:
#--------
check-commit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 20
matrix:
iotdb_version: [ master,rel/0.12,rel/0.13 ]
# iotdb_version: [ master ]
java_version: [ 8 ]
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 }}
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)"
# 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/program
run: |
cd ${{ github.workspace }}/iotdb-daily-build/program
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)"
# 输出检查结果
- name: echo check status
run: |
echo ${{ steps.check-commit.outputs.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/program
# run: |
# cd ${{ github.workspace }}/iotdb-daily-build/program
# python3 test_db.py '${{ github.workspace }}/db/db/db.db' 'select * from commit_last'
#--------
build-in-linux:
needs: [ check-commit ]
runs-on: ubuntu-latest
steps:
# set java
- name: Set java 8
uses: actions/setup-java@v1
with:
java-version: 8
# 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: Collect IoTDB info
id: iotdb-info
run: |
cd ${{ github.workspace }}/iotdb
git checkout ${{ needs.check-commit.outputs.commit_id }}
# echo "::set-output name=commit::$(git rev-parse --short HEAD)"
# echo "::set-output name=branch::$(git branch |grep ^*|cut -d ' ' -f 2)"
# echo "::set-output name=version::$(cat pom.xml | grep -e '^ <version>' | sed 's# ##g' | sed 's#<version>##g' | sed 's#</version>##g')"
# 编译打包iotdb
- name: Build Apache IoTDB binaries
id: dest-info
run: |
zip -r iotdb.zip iotdb
echo "::set-output name=destpath::$(echo /home/ubuntu/web/downloads/8)"
# cd ${{ github.workspace }}/iotdb
# mvn clean package -DskipTests
# 创建对应文件夹
- 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 /home/ubuntu/web/downloads/8
# 上传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.zip"
# source: "${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ steps.iotdb-info.outputs.version }}-all-bin.zip,${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ steps.iotdb-info.outputs.version }}-server-bin.zip,${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ steps.iotdb-info.outputs.version }}-cli-bin.zip"
# target: "/home/ubuntu/web/downloads/${{ matrix.java_version }}"
target: "${{ steps.dest-info.outputs.destpath }}"