-
Notifications
You must be signed in to change notification settings - Fork 34
242 lines (232 loc) · 7.6 KB
/
pr-e2e-test.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
name: E2E test for pull request
on:
workflow_call:
env:
HELM_NAME: automq-for-rocketmq
DOCKER_REPO: automqinc/rocketmq_e2e
jobs:
docker:
runs-on: ubuntu-latest
if: always()
timeout-minutes: 30
strategy:
matrix:
java-version: ["17"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: 'Download artifact'
uses: actions/download-artifact@v2
with:
name: rocketmq
path: ${{github.workspace}}/distribution/target
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and save docker images
id: build-images
working-directory: ./distribution/docker
run: |
mkdir versionlist
full_node_version=$(git ls-remote --tags | awk -F '/' 'END{print $3}')
commit_version=$(git rev-parse --short HEAD)
version=${full_node_version}-${commit_version}
touch versionlist/"${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
ls versionlist/
sh build-ci.sh ${DOCKER_REPO} ${version}
rm Dockerfile
mv Dockerfile-ci Dockerfile
- name: Docker export
uses: docker/build-push-action@v5
with:
context: ./distribution/docker
tags: ${{ env.DOCKER_REPO }}:${{ steps.build-images.outputs.version }}
outputs: type=docker,dest=/tmp/automq-for-rocketmq.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: automq-for-rocketmq
path: /tmp/automq-for-rocketmq.tar
- uses: actions/upload-artifact@v3
name: Upload distribution versionlist
with:
name: versionlist
path: ./distribution/docker/versionlist/*
list-version:
if: always()
name: List version
needs: [docker]
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
version-json: ${{ steps.show_versions.outputs.version-json }}
steps:
- uses: actions/download-artifact@v3
name: Download versionlist
with:
name: versionlist
path: versionlist
- name: Show versions
id: show_versions
run: |
a=(`ls versionlist`)
printf '%s\n' "${a[@]}" | jq -R . | jq -s .
echo version-json=`printf '%s\n' "${a[@]}" | jq -R . | jq -s .` >> $GITHUB_OUTPUT
docker_push:
if: ${{ success() }}
name: Docker push
needs: [ list-version, docker ]
runs-on: private-k3s
timeout-minutes: 60
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: automq-for-rocketmq
path: /tmp
- name: Load image
run: |
docker load --input /tmp/automq-for-rocketmq.tar
docker image ls -a
docker login
docker push ${{ env.DOCKER_REPO }}:${{ matrix.version }}
docker rmi ${{ env.DOCKER_REPO }}:${{ matrix.version }}
deploy:
if: ${{ success() }}
name: Deploy RocketMQ
needs: [list-version, docker, docker_push]
runs-on: private-k3s
timeout-minutes: 60
outputs:
namespace: ${{ steps.create_namespace.outputs.namespace }}
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Create Namespace
id: create_namespace
env:
JOB_INDEX: ${{ strategy.job-index }}
run: |
REPO_NAME=`echo ${GITHUB_REPOSITORY#*/} | sed -e "s/\//-/g" | cut -c1-36 | tr '[A-Z]' '[a-z]'`
NAMESPACE=${REPO_NAME}-${GITHUB_RUN_ID}-${JOB_INDEX}
kubectl create namespace $NAMESPACE
echo "namespace=$NAMESPACE" >> $GITHUB_OUTPUT
- name: Deploy RocketMQ
working-directory: distribution/helm
env:
NAMESPACE: ${{ steps.create_namespace.outputs.namespace }}
DOCKER_REPO: ${{ env.DOCKER_REPO }}
run: |
bash deploy-ci.sh ${DOCKER_REPO} ${{ matrix.version }} ${NAMESPACE}
test-e2e-grpc-java:
if: ${{ success() }}
name: Test E2E grpc java
needs: [list-version, deploy]
runs-on: private-k3s
timeout-minutes: 60
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install flatc
run: sudo bash install_flatc.sh
- name: Build rocketmq dependency
run: |
mvn clean install -U -DskipTests
- uses: actions/checkout@v3
if: always()
with:
repository: AutoMQ/rocketmq-e2e
ref: master
path: rocketmq-e2e
- name: e2e test
env:
HELM_NAME: ${{ env.HELM_NAME }}
NAMESPACE: ${{ needs.deploy.outputs.namespace }}
run: |
cd rocketmq-e2e
cd java/e2e && mvn -B test -DnamesrvAddr=${HELM_NAME}-rocketmq-broker.${NAMESPACE}.svc.pve1.local:8081 -DendPoint=${HELM_NAME}-rocketmq-broker.${NAMESPACE}.svc.pve1.local:8081
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/surefire-reports/TEST-*.xml'
annotate_only: true
include_passed: true
detailed_summary: true
# test-e2e-remoting-java:
# if: ${{ success() }}
# name: Test E2E remoting java
# needs: [ list-version, deploy ]
# runs-on: private-k3s
# timeout-minutes: 60
# strategy:
# matrix:
# version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
# steps:
# - name: Delay
# env:
# DELAY_SECONDS: 30
# run: |
# sleep $DELAY_SECONDS
# - uses: actions/checkout@v3
# with:
# submodules: true
# - name: Install flatc
# run: sudo bash install_flatc.sh
# - name: Build rocketmq dependency
# run: |
# mvn clean install -U -DskipTests
# - uses: actions/checkout@v3
# if: always()
# with:
# repository: AutoMQ/rocketmq-e2e
# ref: master
# path: rocketmq-e2e
# - name: e2e test
# env:
# HELM_NAME: ${{ env.HELM_NAME }}
# NAMESPACE: ${{ needs.deploy.outputs.namespace }}
# run: |
# cd rocketmq-e2e
# cd java/e2e-v4 && mvn -B test -DnamesrvAddr=${HELM_NAME}-rocketmq-broker.${NAMESPACE}.svc.pve1.local:8081
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v3
# if: always() # always run even if the previous step fails
# with:
# report_paths: '**/surefire-reports/TEST-*.xml'
# annotate_only: true
# include_passed: true
# detailed_summary: true
clean:
if: always()
name: Clean
# needs: [deploy, list-version, test-e2e-grpc-java, test-e2e-remoting-java]
needs: [deploy, list-version, test-e2e-grpc-java]
runs-on: private-k3s
timeout-minutes: 60
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- name: clean deployment
working-directory: distribution/helm
env:
NAMESPACE: ${{ needs.deploy.outputs.namespace }}
run: |
bash clean-ci.sh ${NAMESPACE}
kubectl delete namespace $NAMESPACE