-
Notifications
You must be signed in to change notification settings - Fork 326
188 lines (183 loc) · 7.06 KB
/
dml_ddl_test.yaml
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
name: DML_DDL_Test
on:
push:
branches:
- "main"
paths-ignore:
- "README.md"
- "docs/**"
pull_request_target:
types: [labeled]
branches:
- "main"
paths-ignore:
- "README.md"
- "docs/**"
concurrency:
# main branch should complete running
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && format('ci-pull-{0}', github.event.pull_request.number) || format('ci-main-{0}', github.sha) }}
cancel-in-progress: true
permissions:
checks: write
contents: read
issues: read
pull-requests: write
env:
GIT_URL: https://github.com/${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
COMMIT_ID: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
CODE_REF: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.ref || github.ref }}
jobs:
DML_Test:
runs-on: ubuntu-latest
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ready for test')
env:
TEST_UID: ${{ github.run_id }}-${{ github.run_attempt }}-dml
steps:
- name: Print ENV
run: |
echo "test_uid: ${TEST_UID}"
echo "git_url: ${GIT_URL}"
echo "commit_id: ${COMMIT_ID}"
echo "code_ref: ${CODE_REF}"
- name: Deploy PolarDB-X Cluster
uses: appleboy/ssh-action@master
id: dml_deploy
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 100m
script: |
cd workspace/github
./k8s_deploy.sh -u ${TEST_UID} --repository ${GIT_URL} --ref ${CODE_REF} --commit ${COMMIT_ID}
- name: Load Init Data
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 60m
script: |
cd workspace/github
./load_data_by_pod.sh -u ${TEST_UID} --parallel
- name: Test DML Case
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 200m
script: |
cd workspace/github
./create_test_runner.sh -u ${TEST_UID} -i 1 -t dml
- name: Get DML Test Report Files
id: dml_reports
run: |
mkdir -p dml
sshpass -p ${{ secrets.ECS_PASSWORD }} scp -r -o StrictHostKeyChecking=no -P ${{ secrets.ECS_PORT }} ${{ secrets.ECS_USERNAME }}@${{ secrets.ECS_HOST }}:/root/workspace/reports/${TEST_UID}/1/surefire-reports.tar.gz dml/surefire-reports.tar.gz
ls -R dml
echo "tar file:"
tar -zxvf dml/surefire-reports.tar.gz -C dml
- name: Analyze DML Test Result
if: ${{ always() && steps.dml_reports.outcome == 'success' }}
uses: scacap/action-surefire-report@v1
with:
check_name: DML Test Result
report_paths: dml/surefire-reports/TEST-*.xml
fail_on_test_failures: true
- name: Clean up PolarDB-X Cluster
if: ${{ always() && steps.dml_deploy.outcome == 'success' }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 200m
script: |
cd workspace/github
./cleanup.sh -u ${TEST_UID}
DDL_TEST:
runs-on: ubuntu-latest
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ready for test')
env:
TEST_UID: ${{ github.run_id }}-${{ github.run_attempt }}-ddl
steps:
- name: Print ENV
run: |
echo "test_uid: ${TEST_UID}"
echo "git_url: ${GIT_URL}"
echo "commit_id: ${COMMIT_ID}"
echo "code_ref: ${CODE_REF}"
- name: Deploy PolarDB-X Cluster
uses: appleboy/ssh-action@master
id: ddl_deploy
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 100m
script: |
cd workspace/github
./k8s_deploy.sh -u ${TEST_UID} --repository ${GIT_URL} --ref ${CODE_REF} --commit ${COMMIT_ID}
- name: Load Init Data
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 60m
script: |
cd workspace/github
./load_data_by_pod.sh -u ${TEST_UID} --only_create_database
- name: Test DDL Case
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 400m
script: |
cd workspace/github
./create_test_runner.sh -u ${TEST_UID} -i 2 -t ddl
- name: Get DDL Test Report Files
id: ddl_reports
run: |
mkdir -p ddl
sshpass -p ${{ secrets.ECS_PASSWORD }} scp -r -o StrictHostKeyChecking=no -P ${{ secrets.ECS_PORT }} ${{ secrets.ECS_USERNAME }}@${{ secrets.ECS_HOST }}:/root/workspace/reports/${TEST_UID}/2/surefire-reports.tar.gz ddl/surefire-reports.tar.gz
ls -R ddl
echo "tar file:"
tar -zxvf ddl/surefire-reports.tar.gz -C ddl
- name: Analyze DDL Test Result
if: ${{ always() && steps.ddl_reports.outcome == 'success' }}
uses: scacap/action-surefire-report@v1
with:
check_name: DDL Test Result
report_paths: ddl/surefire-reports/TEST-*.xml
fail_on_test_failures: true
- name: Clean up PolarDB-X Cluster
if: ${{ always() && steps.ddl_deploy.outcome == 'success' }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ECS_HOST }}
username: ${{ secrets.ECS_USERNAME }}
key: ${{ secrets.ECS_KEY }}
port: ${{ secrets.ECS_PORT }}
envs: TEST_UID,GIT_URL,COMMIT_ID,CODE_REF
command_timeout: 200m
script: |
cd workspace/github
./cleanup.sh -u ${TEST_UID}