Add a performance benchmark job in PR E2E pipeline #23
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
name: E2E test for pull request | ||
# read-write repo token | ||
# access to secrets | ||
on: | ||
workflow_run: | ||
workflows: ["PR-CI"] | ||
types: | ||
- completed | ||
env: | ||
DOCKER_REPO: apache/rocketmq-ci | ||
SECRET: $(echo "${{ secrets.ASK_CONFIG_VIRGINA }}" | base64 -w 0) | ||
jobs: | ||
docker: | ||
if: > | ||
github.event.workflow_run.event == 'pull_request' && | ||
github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
base-image: ["ubuntu"] | ||
java-version: ["8"] | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
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@v4 | ||
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@v4 | ||
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: chi3316/rocketmq-test-tool/benchmark-runner@89d3abde74cac994f9a9b3c45bf6ed3096cdc7ea | ||
name: Deploy rocketmq | ||
with: | ||
action: "deploy" | ||
ask-config: "${{ env.SECRET }}" | ||
test-version: "${{ matrix.version }}" | ||
chart-git: "https://mirror.ghproxy.com/https://github.com/chi3316/rocketmq-docker" | ||
chart-branch: "feat-custom-jvm-memory" | ||
chart-path: "./rocketmq-k8s-helm" | ||
job-id: ${{ strategy.job-index }} | ||
helm-values: | | ||
nameserver: | ||
image: | ||
repository: ${{env.DOCKER_REPO}} | ||
tag: ${{ matrix.version }} | ||
broker: | ||
image: | ||
repository: ${{env.DOCKER_REPO}} | ||
tag: ${{ matrix.version }} | ||
proxy: | ||
image: | ||
repository: ${{env.DOCKER_REPO}} | ||
tag: ${{ matrix.version }} | ||
benchmark-test: | ||
if: ${{ success() }} | ||
runs-on: ubuntu-latest | ||
name: Performance benchmark test | ||
needs: [ list-version, deploy ] | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: chi3316/rocketmq-test-tool/benchmark-runner@89d3abde74cac994f9a9b3c45bf6ed3096cdc7ea | ||
name: Performance benchmark | ||
with: | ||
action: "performance-benchmark" | ||
ask-config: "${{ env.SECRET }}" | ||
job-id: 1 | ||
test-time: "600" | ||
- name: Upload test report | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: benchmark-report | ||
path: benchmark/ | ||
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: chi3316/rocketmq-test-tool/benchmark-runner@89d3abde74cac994f9a9b3c45bf6ed3096cdc7ea | ||
name: clean | ||
with: | ||
action: "clean" | ||
ask-config: "${{ env.SECRET }}" | ||
test-version: "${{ matrix.version }}" | ||
job-id: ${{ strategy.job-index }} | ||