Skip to content

Nightly Build

Nightly Build #5

Workflow file for this run

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 }}"