-
Notifications
You must be signed in to change notification settings - Fork 6
228 lines (215 loc) · 7.76 KB
/
ci.yaml
File metadata and controls
228 lines (215 loc) · 7.76 KB
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
# Define workflow name.
name: MatrixOne CI
on:
workflow_call:
secrets:
TOKEN_ACTION:
description: "Token for checkout (e.g. pull from fork/private)"
required: false
S3ENDPOINT:
description: "S3ENDPOINT For Test"
required: true
S3REGION:
description: "S3REGION For Test"
required: true
S3APIKEY:
description: "S3APIKEY For Test"
required: true
S3APISECRET:
description: "S3APISECRET For Test"
required: true
S3BUCKET:
description: "S3BUCKET For Test"
required: true
EE_DB_ADDR:
description: "matrixone cloud host"
required: true
EE_DB_PORT:
description: "matrixone cloud port"
required: true
EE_DB_USER:
description: "matrixone cloud user"
required: true
EE_DB_PASSWORD:
description: "matrixone cloud password"
required: true
EE_DB_DB:
description: "matrixone cloud db"
required: true
jobs:
ut-linux-x86:
environment: ci
runs-on: ubuntu-22.04
name: UT Test on Ubuntu/x86
steps:
- name: Pre Clean Some Unneeded Images
run: |
sudo df -h /*
echo "========================================="
sudo docker builder prune -f -a;
sudo docker images | grep -v REPOSITORY | awk '{system("sudo docker rmi "$1":"$2)}';
sudo docker volume prune -f;
echo "========================================="
sudo df -h /*
- name: Parse Time for moc
id: time
run: |
export TZ='Asia/Shanghai'
#utcTime="2024-11-15T08:33:52Z"
action_time=${{ github.event.pull_request.head.repo.pushed_at }}
ACTION_TIME=$(date -d "${action_time}" '+%Y-%m-%d %H:%M:%S')
# 获取格式化的日期时间字符串
time=$(date '+%Y-%m-%d %H:%M:%S')
# action link
action_link="https://github.com/${{ github.event.pull_request.base.repo.full_name }}/actions/runs/${{ github.run_id }}"
echo "ACTION_TIME=${ACTION_TIME}"
echo "START_TIME=${time}"
echo "ACTION_LINK=${action_link}"
echo "ACTION_TIME=${ACTION_TIME}" >> $GITHUB_OUTPUT
echo "START_TIME=${time}" >> $GITHUB_OUTPUT
echo "ACTION_LINK=${action_link}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v6
with:
token: ${{ secrets.TOKEN_ACTION }}
fetch-depth: "3"
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Go
uses: matrixorigin/CI/actions/setup-env@main
with:
setup-java: true
go-version-file: "${{ github.workspace }}/go.mod"
- uses: matrixorigin/setup-hdfs@master
with:
hdfs-download-url: "https://github.com/matrixorigin/CI/releases/download/hadoop-binary-3.4.1/hadoop-3.4.1.tar.gz"
- name: Set env
run: |
echo "endpoint=${{ secrets.S3ENDPOINT }}" >> $GITHUB_ENV
echo "region=${{ secrets.S3REGION }}" >> $GITHUB_ENV
echo "apikey=${{ secrets.S3APIKEY }}" >> $GITHUB_ENV
echo "apisecret=${{ secrets.S3APISECRET }}" >> $GITHUB_ENV
echo "bucket=${{ secrets.S3BUCKET }}" >> $GITHUB_ENV
# set ut workdir
echo "UT_WORKDIR=${{ github.workspace }}" >> $GITHUB_ENV
- name: Unit Testing
id: ut
run: |
cd $GITHUB_WORKSPACE && make clean && make config
make ut UT_PARALLEL=6 UT_TIMEOUT=40
- name: Print Result(Old)
if: ${{ always() }}
continue-on-error: true
run: |
cd $UT_WORKDIR;
find scratch -name "**-UT-Count.out" -exec cat {} \+;
- name: Print Skipped Tests
if: ${{ always() }}
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE;
find ./ut-report -name skipped.txt -exec cat {} \+;
- name: Print No Test Case Packages
if: ${{ always() }}
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE;
find ./ut-report -name no-test.txt -exec cat {} \+;
- name: Print Failed Packages and Tests
id: failed
if: ${{ always() }}
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE;
if [ "$(find ./ut-report/failed | wc -l)" -le "2" ]; then
exit 0;
fi
find ./ut-report/failed -name result.txt -exec cat {} \;
fail_ut_cases=''
files=($(find ./ut-report/failed | grep -v result.txt))
for file in "${files[@]}"; do
if [ -d "$file" ]; then
continue
fi
echo "============================================"
cat "${file}";
fail_ut_cases=${fail_ut_cases}$(basename "${file}")','
done
echo "steps.ut.conclusion: ${{ steps.ut.conclusion }}"
echo "FAIL_UT_CASES=${fail_ut_cases}"
echo "FAIL_UT_CASES=${fail_ut_cases}" >> $GITHUB_OUTPUT
- name: Print the Top 10 Time-Consuming Tests
if: ${{ always() }}
continue-on-error: true
run: |
find ./ut-report -name top.txt -exec cat {} \;
ut-mac-x86:
#if: ${{ !github.event.pull_request.draft }}
if: ${{ false }}
environment: ci
runs-on: macos-12
name: UT Test on Darwin/x86
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.TOKEN_ACTION }}
fetch-depth: "3"
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Go
uses: matrixorigin/CI/actions/setup-env@main
with:
setup-java: true
go-version-file: "${{ github.workspace }}/go.mod"
- uses: matrixorigin/setup-hdfs@master
with:
hdfs-download-url: "https://github.com/matrixorigin/CI/releases/download/hadoop-binary-3.4.1/hadoop-3.4.1.tar.gz"
- name: Set env
run: |
echo "endpoint=${{ secrets.S3ENDPOINT }}" >> $GITHUB_ENV
echo "region=${{ secrets.S3REGION }}" >> $GITHUB_ENV
echo "apikey=${{ secrets.S3APIKEY }}" >> $GITHUB_ENV
echo "apisecret=${{ secrets.S3APISECRET }}" >> $GITHUB_ENV
echo "bucket=${{ secrets.S3BUCKET }}" >> $GITHUB_ENV
# set ut workdir
echo "UT_WORKDIR=${{ github.workspace }}" >> $GITHUB_ENV
- name: Unit Testing
run: |
cd $GITHUB_WORKSPACE && make clean && make config
make ut UT_PARALLEL=6
- name: Print Result
if: ${{ always() }}
continue-on-error: true
run: |
cd $UT_WORKDIR;
find scratch -name "**-UT-Count.out" -exec cat {} \;
sca:
environment: ci
runs-on: ubuntu-22.04
name: SCA Test on Ubuntu/x86
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.TOKEN_ACTION }}
fetch-depth: "3"
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: thiagodnf/yaml-schema-checker@v0.0.12
name: Check Issue Template
with:
jsonSchemaFile: .github/ISSUE_TEMPLATE/schema.json
yamlFiles: |
.github/ISSUE_TEMPLATE/*.yml
.github/ISSUE_TEMPLATE/*.yaml
- name: Set up Go
uses: matrixorigin/CI/actions/setup-env@main
with:
setup-java: false
go-version-file: "${{ github.workspace }}/go.mod"
- name: Prepare ENV
run: |
cd $GITHUB_WORKSPACE && make clean && make config && make build
make install-static-check-tools
- name: Static Code Analysis
run: |
cd $GITHUB_WORKSPACE
make static-check