11
11
DOCKER_REPO : wuyfeedocker/nacos-ci
12
12
DOCKER_REPO_B : wuyfeehub/nacos-ci
13
13
TEST_REPO_NAME : nacos-group/nacos-e2e
14
+ HEADER_PARAMS : " -H \" Accept: application/vnd.github+json\" -H \" Authorization: Bearer ${{ secrets.ACTION_TOKEN }}\" -H \" X-GitHub-Api-Version: 2022-11-28\" "
15
+ HEADER_PARAMS_WRITE_COMMENT : " -H \" Accept: application/vnd.github+json\" -H \" Authorization: Bearer ${{ secrets.ACTION_TOKEN }}\" -H \" X-GitHub-Api-Version: 2022-11-28\" "
16
+ BASE_URL_NACOS : https://api.github.com/repos/${GITHUB_REPOSITORY}
17
+ BASE_URL_ROBOT : https://api.github.com/repos/wuyfee/nacos
14
18
15
19
jobs :
16
20
docker :
@@ -108,20 +112,28 @@ jobs:
108
112
REPLICA_COUNT : 3
109
113
DATABASE : mysql
110
114
NODE_PORT : 30000
115
+ AUTH_ENABLED : false
116
+ ACTUAL_MODE : cluster
111
117
strategy :
112
118
fail-fast : false
113
119
matrix :
114
- mode : ["cluster","standalone"]
120
+ mode : ["cluster","standalone","standalone_auth" ]
115
121
version : ${{ fromJSON(needs.docker.outputs.version-json) }}
116
122
steps :
117
123
- name : set nodeport
118
124
run : |
119
125
echo "NODE_PORT=$(expr $(expr $(expr $(expr ${{ strategy.job-index }} + 1) * ${{ github.run_number }}) % 30000) + 30000)" >> $GITHUB_ENV
120
- - name : set cluster params
121
- if : ${{ matrix.mode == 'standalone' }}
126
+ - name : set params values
122
127
run : |
123
- echo "REPLICA_COUNT=1" >> $GITHUB_ENV
124
- echo "DATABASE=embedded" >> $GITHUB_ENV
128
+ if [[ ${{ matrix.mode }} == "standalone"* ]];then
129
+ if [[ ${{ matrix.mode }} = "standalone_auth" ]]; then
130
+ echo "AUTH_ENABLED=true" >> $GITHUB_ENV
131
+ fi
132
+ echo "ACTUAL_MODE=standalone" >> $GITHUB_ENV
133
+ echo "REPLICA_COUNT=1" >> $GITHUB_ENV
134
+ echo "DATABASE=embedded" >> $GITHUB_ENV
135
+ echo ${{ matrix.mode }}-nacos-${{ github.run_id }}-${{ strategy.job-index }}
136
+ fi
125
137
- name : allocate docker repo
126
138
run : |
127
139
if [[ $(expr $(expr ${{ github.run_id }} + ${{ strategy.job-index }} ) % 2 ) -eq 1 ]]; then
@@ -149,12 +161,14 @@ jobs:
149
161
values:
150
162
namespace: nacos-${{ github.run_id }}-${{ strategy.job-index }}
151
163
global:
152
- mode: ${{ matrix.mode }}
164
+ mode: ${{ env.ACTUAL_MODE }}
153
165
nacos:
154
166
replicaCount: ${{ env.REPLICA_COUNT }}
155
167
image:
156
168
repository: ${{ env.DOCKER_REPO_ACTUAL }}
157
169
tag: ${{ matrix.version }}
170
+ auth:
171
+ enabled: ${{ env.AUTH_ENABLED }}
158
172
storage:
159
173
type: ${{ env.DATABASE }}
160
174
db:
@@ -165,18 +179,27 @@ jobs:
165
179
service:
166
180
nodePort: ${{ env.NODE_PORT }}
167
181
type: ClusterIP
182
+
168
183
e2e-java-test :
169
184
if : ${{ success() }}
170
185
name : Java e2e Test
171
186
needs : [docker, deploy]
172
187
runs-on : ubuntu-latest
173
188
timeout-minutes : 60
189
+ env :
190
+ CODE_PATH : java/nacos-2X
174
191
strategy :
175
192
fail-fast : false
176
193
matrix :
177
- mode : ["cluster","standalone"]
194
+ mode : ["cluster","standalone","standalone_auth" ]
178
195
version : ${{ fromJSON(needs.docker.outputs.version-json) }}
179
196
steps :
197
+ - name : set code path
198
+ run : |
199
+ if [[ ${{ matrix.mode }} = "standalone_auth" ]]; then
200
+ echo "CODE_PATH=java/auth" >> $GITHUB_ENV
201
+ echo ${{ matrix.mode }}-nacos-${{ github.run_id }}-${{ strategy.job-index }}
202
+ fi
180
203
- uses : apache/rocketmq-test-tool@java-dev
181
204
name : java e2e test
182
205
with :
@@ -192,7 +215,7 @@ jobs:
192
215
REPO_NAME: ${{ env.TEST_REPO_NAME }}
193
216
CODE: https://github.com/${{ env.TEST_REPO_NAME }}
194
217
BRANCH: main
195
- CODE_PATH: java/nacos-2X
218
+ CODE_PATH: ${{ env.CODE_PATH }}
196
219
CMD: mvn clean test -B
197
220
ALL_IP: null
198
221
CONTAINER:
@@ -203,7 +226,6 @@ jobs:
203
226
RESOURCE_REQUIRE:
204
227
cpu: 2
205
228
memory: 2Gi
206
-
207
229
- uses : actions/upload-artifact@v3
208
230
if : always()
209
231
name : Upload test log
@@ -296,6 +318,7 @@ jobs:
296
318
BRANCH: main
297
319
CODE_PATH: cpp
298
320
CMD: |
321
+ yum-config-manager remove centos-sclo-rh
299
322
cd /root/code/cpp && make install
300
323
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc && source ~/.bashrc
301
324
cd /root/code/cpp/nacoscpptest
@@ -454,7 +477,7 @@ jobs:
454
477
BRANCH: main
455
478
CODE_PATH: python
456
479
CMD: |
457
- cd /root/code/python
480
+ cd /root/code/python
458
481
pip3 install -r requirements.txt
459
482
source ~/.bashrc
460
483
cd nacospythontest && pytest --junitxml ../target/surefire-reports/TEST-report.xml test/*_test.py --log-cli-level=DEBUG
@@ -480,15 +503,15 @@ jobs:
480
503
481
504
482
505
clean :
483
- if : always()
506
+ if : ${{ always() }}
484
507
name : Clean
485
508
needs : [docker, e2e-java-test, e2e-go-test, e2e-cpp-test, e2e-csharp-test, e2e-nodejs-test, e2e-python-test]
486
509
runs-on : ubuntu-latest
487
- timeout-minutes : 60
510
+ timeout-minutes : 5
488
511
strategy :
489
512
fail-fast : false
490
513
matrix :
491
- mode : ["cluster","standalone"]
514
+ mode : ["cluster","standalone","standalone_auth" ]
492
515
version : ${{ fromJSON(needs.docker.outputs.version-json) }}
493
516
steps :
494
517
- uses : apache/rocketmq-test-tool@java-dev
@@ -498,3 +521,69 @@ jobs:
498
521
action: clean
499
522
namespace: nacos-${{ github.run_id }}-${{ strategy.job-index }}
500
523
askConfig: ${{ secrets.ASK_CONFIG_VIRGINA }}
524
+ write-comment :
525
+ if : ${{ always() }}
526
+ name : write comment to pr
527
+ needs : [docker, deploy, e2e-java-test, e2e-go-test, e2e-cpp-test, e2e-csharp-test, e2e-nodejs-test, e2e-python-test, clean]
528
+ runs-on : ubuntu-latest
529
+ timeout-minutes : 5
530
+ steps :
531
+ - name : ' Download artifact'
532
+
533
+ with :
534
+ script : |
535
+ var artifacts = await github.actions.listWorkflowRunArtifacts({
536
+ owner: context.repo.owner,
537
+ repo: context.repo.repo,
538
+ run_id: ${{ github.event.workflow_run.id }},
539
+ });
540
+
541
+ var matchArtifactPR = artifacts.data.artifacts.filter((artifact) => {
542
+ return artifact.name == "pr"
543
+ })[0];
544
+ var download = await github.actions.downloadArtifact({
545
+ owner: context.repo.owner,
546
+ repo: context.repo.repo,
547
+ artifact_id: matchArtifactPR.id,
548
+ archive_format: 'zip',
549
+ });
550
+ var fs = require('fs');
551
+ fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
552
+ - name : unzip pr
553
+ run : |
554
+ unzip pr.zip
555
+ cat pr.txt
556
+ pr_number=`cat pr.txt`
557
+ echo "PR_NUMBER=${pr_number}" >> $GITHUB_ENV
558
+ - name : write issue comment
559
+ run : |
560
+ echo ${{ env.PR_NUMBER }}
561
+ job_status=""
562
+ if [ ${{ needs.docker.result }} = 'success' ] && [ ${{ needs.deploy.result }} = 'success' ] && [ ${{ needs.e2e-java-test.result }} = 'success' ] && [ ${{ needs.e2e-go-test.result }} = 'success' ] && [ ${{ needs.e2e-cpp-test.result }} = 'success' ] && [ ${{ needs.e2e-csharp-test.result }} = 'success' ] && [ ${{ needs.e2e-nodejs-test.result }} = 'success' ] && [ ${{ needs.e2e-python-test.result }} = 'success' ]; then
563
+ jobs_status='$\\color{green}{SUCCESS}$'
564
+ jobs_status+="\n[DETAILS](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }})"
565
+ else
566
+ jobs_status='$\\color{red}{FAILURE}$'
567
+ jobs_status+="\n[DETAILS](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }})"
568
+ fi
569
+ echo ${jobs_status}
570
+ markdown_content="${jobs_status}"
571
+ generate_content() {
572
+ if [ $1 = "success" ];then
573
+ echo "\n ✅ $2 $1 "
574
+ else
575
+ echo "\n ❌ $2 $1 "
576
+ fi
577
+ }
578
+ markdown_content+=$(generate_content ${{ needs.docker.result }} "- docker: ")
579
+ markdown_content+=$(generate_content ${{ needs.deploy.result }} "- deploy (standalone & cluster & standalone_auth): ")
580
+ markdown_content+=$(generate_content ${{ needs.e2e-java-test.result }} "- e2e-java-test (standalone & cluster & standalone_auth): ")
581
+ markdown_content+=$(generate_content ${{ needs.e2e-go-test.result }} "- e2e-go-test (standalone & cluster): ")
582
+ markdown_content+=$(generate_content ${{ needs.e2e-cpp-test.result }} "- e2e-cpp-test (standalone & cluster): ")
583
+ markdown_content+=$(generate_content ${{ needs.e2e-csharp-test.result }} "- e2e-csharp-test (standalone & cluster): ")
584
+ markdown_content+=$(generate_content ${{ needs.e2e-nodejs-test.result }} "- e2e-nodejs-test (standalone & cluster): ")
585
+ markdown_content+=$(generate_content ${{ needs.e2e-python-test.result }} "- e2e-python-test (standalone & cluster): ")
586
+ markdown_content+=$(generate_content ${{ needs.clean.result }} "- clean (standalone & cluster & standalone_auth): ")
587
+ echo "markdown_content: \n ${markdown_content}"
588
+ payload=`echo "{\"body\": \"${markdown_content}\"}" | jq .`
589
+ curl -L -X POST ${{ env.HEADER_PARAMS_WRITE_COMMENT }} ${{ env.BASE_URL_NACOS }}/issues/${{ env.PR_NUMBER }}/comments -d "${payload}"
0 commit comments