-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(store): add e2e action 1. add e2e action Signed-off-by: TheR1sing3un <[email protected]> feat(store): add e2e action 1. add e2e action Signed-off-by: TheR1sing3un <[email protected]>
- Loading branch information
1 parent
68b637f
commit 6fed864
Showing
2 changed files
with
266 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build with Maven | ||
name: BUILD-CI | ||
|
||
on: | ||
pull_request: | ||
|
@@ -24,5 +24,19 @@ jobs: | |
uses: ScribeMD/[email protected] | ||
with: | ||
key: docker-${{ runner.os }} | ||
- name: Build with Maven | ||
run: mvn clean install -U | ||
- name: Build distribution tar | ||
run: | | ||
mvn -Prelease-all clean install -U | ||
- uses: actions/upload-artifact@v3 | ||
name: Upload distribution tar | ||
with: | ||
name: rocketmq | ||
path: distribution/target/rocketmq*/rocketmq* | ||
- name: Save PR number | ||
run: | | ||
mkdir -p ./pr | ||
echo ${{ github.event.number }} > ./pr/NR | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr | ||
path: pr/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
name: E2E test for pull request | ||
|
||
# read-write repo token | ||
# access to secrets | ||
on: | ||
workflow_run: | ||
workflows: ["BUILD-CI"] | ||
types: | ||
- completed | ||
branches: ['**'] | ||
|
||
env: | ||
DOCKER_REPO: apache/rocketmq-ci | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
if: > | ||
github.event.workflow_run.event == 'pull_request' && | ||
github.event.workflow_run.conclusion == 'success' | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
base-image: ["ubuntu"] | ||
java-version: ["17"] | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
var matchArtifactRmq = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "rocketmq" | ||
})[0]; | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifactRmq.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/rocketmq.zip', Buffer.from(download.data)); | ||
- run: | | ||
unzip rocketmq.zip | ||
mkdir rocketmq | ||
cp -r rocketmq-* rocketmq/ | ||
ls | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: apache/rocketmq-docker.git | ||
ref: master | ||
path: rocketmq-docker | ||
- 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 | ||
run: | | ||
cd rocketmq-docker/image-build-ci | ||
version=${{ github.event.pull_request.number || github.ref_name }}-$(uuidgen) | ||
mkdir versionlist | ||
touch versionlist/"${version}-`echo ${{ matrix.base-image }} | sed -e "s/:/-/g"`" | ||
sh ./build-image-local.sh ${version} ${{ matrix.base-image }} ${{ matrix.java-version }} ${DOCKER_REPO} | ||
- uses: actions/upload-artifact@v3 | ||
name: Upload distribution tar | ||
with: | ||
name: versionlist | ||
path: rocketmq-docker/image-build-ci/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 | ||
deploy: | ||
if: ${{ success() }} | ||
name: Deploy RocketMQ | ||
needs: [list-version,docker] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
version: ${{ fromJSON(needs.list-version.outputs.version-json) }} | ||
steps: | ||
- uses: apache/rocketmq-test-tool@7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288 | ||
name: Deploy rocketmq | ||
with: | ||
action: "deploy" | ||
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}" | ||
test-version: "${{ matrix.version }}" | ||
chart-git: "https://ghproxy.com/https://github.com/apache/rocketmq-docker.git" | ||
chart-branch: "master" | ||
chart-path: "./rocketmq-k8s-helm" | ||
job-id: ${{ strategy.job-index }} | ||
helm-values: | | ||
broker: | ||
image: | ||
repository: ${{env.DOCKER_REPO}} | ||
tag: ${{ matrix.version }} | ||
test-e2e-grpc-java: | ||
if: ${{ success() }} | ||
name: Test E2E grpc java | ||
needs: [list-version, deploy] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
version: ${{ fromJSON(needs.list-version.outputs.version-json) }} | ||
steps: | ||
- uses: apache/rocketmq-test-tool@7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288 | ||
name: e2e test | ||
with: | ||
action: "test" | ||
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}" | ||
test-version: "${{ matrix.version }}" | ||
test-code-git: "https://ghproxy.com/https://github.com/automq/rocketmq-e2e" | ||
test-code-branch: "master" | ||
test-code-path: java/e2e | ||
test-cmd: "mvn -B test" | ||
job-id: 0 | ||
- name: Publish Test Report | ||
uses: mikepenz/action-junit-report@v3 | ||
if: always() # always run even if the previous step fails | ||
with: | ||
report_paths: '**/test_report/TEST-*.xml' | ||
annotate_only: true | ||
include_passed: true | ||
detailed_summary: true | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
name: Upload test log | ||
with: | ||
name: test-e2e-grpc-java-log.txt | ||
path: testlog.txt | ||
|
||
test-e2e-golang: | ||
if: ${{ success() }} | ||
name: Test E2E golang | ||
needs: [list-version, deploy] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
version: ${{ fromJSON(needs.list-version.outputs.version-json) }} | ||
steps: | ||
- uses: apache/rocketmq-test-tool@7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288 | ||
name: e2e test | ||
with: | ||
action: "test" | ||
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}" | ||
test-version: "${{ matrix.version }}" | ||
test-code-git: "https://ghproxy.com/https://github.com/automq/rocketmq-e2e" | ||
test-code-branch: "master" | ||
test-code-path: golang | ||
test-cmd: | | ||
cd ../common && mvn -Prelease -DskipTests clean package -U | ||
cd ../rocketmq-admintools && source bin/env.sh | ||
cd ../golang && go get -u github.com/apache/rocketmq-clients/golang && gotestsum --junitfile ./target/surefire-reports/TEST-report.xml ./mqgotest/... -timeout 2m -v | ||
job-id: 0 | ||
- name: Publish Test Report | ||
uses: mikepenz/action-junit-report@v3 | ||
if: always() # always run even if the previous step fails | ||
with: | ||
report_paths: '**/test_report/TEST-*.xml' | ||
annotate_only: true | ||
include_passed: true | ||
detailed_summary: true | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
name: Upload test log | ||
with: | ||
name: test-e2e-golang-log.txt | ||
path: testlog.txt | ||
|
||
test-e2e-remoting-java: | ||
if: ${{ success() }} | ||
name: Test E2E remoting java | ||
needs: [ list-version, deploy ] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
version: ${{ fromJSON(needs.list-version.outputs.version-json) }} | ||
steps: | ||
- uses: apache/rocketmq-test-tool@7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288 | ||
name: e2e test | ||
with: | ||
action: "test" | ||
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}" | ||
test-version: "${{ matrix.version }}" | ||
test-code-git: "https://ghproxy.com/https://github.com/automq/rocketmq-e2e" | ||
test-code-branch: "master" | ||
test-code-path: java/e2e-v4 | ||
test-cmd: "mvn -B test" | ||
job-id: 0 | ||
- name: Publish Test Report | ||
uses: mikepenz/action-junit-report@v3 | ||
if: always() # always run even if the previous step fails | ||
with: | ||
report_paths: '**/test_report/TEST-*.xml' | ||
annotate_only: true | ||
include_passed: true | ||
detailed_summary: true | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
name: Upload test log | ||
with: | ||
name: test-e2e-remoting-java-log.txt | ||
path: testlog.txt | ||
|
||
clean: | ||
if: always() | ||
name: Clean | ||
needs: [list-version, test-e2e-grpc-java, test-e2e-golang, test-e2e-remoting-java] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
version: ${{ fromJSON(needs.list-version.outputs.version-json) }} | ||
steps: | ||
- uses: apache/rocketmq-test-tool@7d84d276ad7755b1dc5cf9657a7a9bff6ae6d288 | ||
name: clean | ||
with: | ||
action: "clean" | ||
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}" | ||
test-version: "${{ matrix.version }}" | ||
job-id: ${{ strategy.job-index }} | ||
|