-
Notifications
You must be signed in to change notification settings - Fork 34
197 lines (187 loc) · 6.32 KB
/
nightly-build.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
name: Nightly Build
on:
workflow_dispatch:
schedule:
- cron: '0 20 * * *'
env:
HELM_NAME: automq-for-rocketmq
DOCKER_REPO: automqinc/automq-for-rocketmq
DOCKER_NIGHTLY_VERSION: nightly
JOB_INDEX: 1
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'AutoMQ/automq-for-rocketmq'
timeout-minutes: 30
outputs:
version-json: ${{ steps.build_images.outputs.nightly-version }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install flatc
run: sudo bash install_flatc.sh
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "maven"
- name: Build with Maven
run: |
mvn -Prelease-all clean install -U
- name: docker-login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and save docker images
id: build_images
working-directory: ./distribution/docker
env:
DOCKER_REPO: ${{ env.DOCKER_REPO }}
DOCKER_NIGHTLY_VERSION: ${{ env.DOCKER_NIGHTLY_VERSION }}
run: |
FULL_NODE_VERSION=$(git ls-remote --tags | awk -F '/' 'END{print $3}')
COMMIT_VERSION=$(git rev-parse --short HEAD)
NIGHT_VERSION=${FULL_NODE_VERSION}-${COMMIT_VERSION}-${DOCKER_NIGHTLY_VERSION}
VERSION=${FULL_NODE_VERSION}
sh build-ci.sh ${DOCKER_REPO} ${VERSION}
docker tag ${DOCKER_REPO}:${VERSION} ${DOCKER_REPO}:${NIGHT_VERSION}
docker push ${DOCKER_REPO}:${NIGHT_VERSION}
docker push ${DOCKER_REPO}:${VERSION}
echo "nightly-version=$NIGHT_VERSION" >> $GITHUB_OUTPUT
deploy:
if: ${{ success() }}
name: Deploy AutoMQ for RocketMQ
needs: [build]
runs-on: private-k3s
timeout-minutes: 60
outputs:
namespace: ${{ steps.create_namespace.outputs.namespace }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Get kubeconfig
env:
KUBECONFIG_FILE: '${{ secrets.KUBE_CONFIG }}'
run: |
mkdir -p ~/.kube
echo $KUBECONFIG_FILE | base64 -d > ~/.kube/config
- name: Create Namespace
id: create_namespace
env:
JOB_INDEX: ${{ env.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 }}
VERSION: ${{ needs.build.outputs.version-json }}
run: |
sh deploy-ci.sh ${DOCKER_REPO} ${VERSION} ${NAMESPACE}
run_e2e_grpc_java:
if: ${{ success() }}
name: Run e2e test for grpc java
needs: [ build, deploy ]
runs-on: private-k3s
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
token: ${{ secrets.PAT_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
run_e2e_remoting_java:
if: ${{ success() }}
name: Run e2e test for remoting java
needs: [ build, deploy ]
runs-on: private-k3s
steps:
- name: Delay
env:
DELAY_SECONDS: 60
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
token: ${{ secrets.PAT_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 AutoMQ for RocketMQ
needs: [build, deploy, run_e2e_grpc_java, run_e2e_remoting_java]
runs-on: private-k3s
timeout-minutes: 60
steps:
- name: clean Rocketmq
working-directory: distribution/helm
env:
NAMESPACE: ${{ needs.deploy.outputs.namespace }}
DOCKER_REPO: ${{ env.DOCKER_REPO }}
run: |
sh clean-ci.sh ${NAMESPACE}
- uses: apache/rocketmq-test-tool@7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288
name: clean
with:
action: "clean"
ask-config: "${{ secrets.KUBE_CONFIG }}"
test-version: "${{ needs.build.outputs.version-json }}"
job-id: "${{ env.JOB_INDEX }}"