You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by zh...@apache.org on 2023/02/14 10:53:41 UTC

[rocketmq] 03/10: Create push-ci.yml

This is an automated email from the ASF dual-hosted git repository.

zhouxzhan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git

commit c7142c8e0c787fbe76f724344291d5b773f31a2e
Author: deepsola <wa...@alibaba-inc.com>
AuthorDate: Mon Feb 6 17:42:57 2023 +0800

    Create push-ci.yml
---
 .github/workflows/push-ci.yml | 202 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 202 insertions(+)

diff --git a/.github/workflows/push-ci.yml b/.github/workflows/push-ci.yml
new file mode 100644
index 000000000..16aabb0e0
--- /dev/null
+++ b/.github/workflows/push-ci.yml
@@ -0,0 +1,202 @@
+name: PUSH-CI
+
+on:
+  push:
+  #schedule:
+  #  - cron: "0 18 * * *" # TimeZone: UTC 0
+
+concurrency:
+  group: rocketmq-${{ github.ref }}
+  cancel-in-progress: true
+
+env:
+  MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
+  
+jobs:
+  unit-test:
+    if: always()
+    name: Unit test
+    # needs: []
+    runs-on: ${{ matrix.os }}-latest
+    timeout-minutes: 30
+    strategy:
+      matrix:
+        os: [ubuntu, macos, windows]
+        java-version: [8]
+        include:
+          - os: ubuntu
+            java-version: 11
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+      - name: Cache maven repository
+        uses: actions/cache@v3
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: ${{ runner.os }}-maven-
+      - uses: actions/setup-java@v3
+        with:
+          java-version: ${{ matrix.java-version }}
+          distribution: adopt
+      - name: Build and test
+        run: |
+          cd broker
+          mvn -B test --file pom.xml
+      - 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'
+            
+  dist-tar:
+    if: ${{ success() }}
+    name: Build dist tar
+    needs: [unit-test]
+    runs-on: ubuntu-latest
+    timeout-minutes: 30
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+      - uses: actions/setup-java@v3
+        with:
+          distribution: "temurin"
+          java-version: "8"
+          cache: "maven"
+      - name: Build distribution tar
+        run: |
+          mvn -Prelease-all -DskipTests clean install -U
+      - uses: actions/upload-artifact@v3
+        name: Upload distribution tar
+        with:
+          name: rocketmq
+          path: distribution/target/rocketmq*/rocketmq*
+
+  docker:
+    if: ${{ success() }}
+    name: Docker images
+    needs: [dist-tar]
+    runs-on: ubuntu-latest
+    timeout-minutes: 30
+    strategy:
+      matrix:
+        base-image: ["ubuntu"]
+        java-version: ["8"]
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          repository: apache/rocketmq-docker.git
+          ref: master
+          path: rocketmq-docker
+      - uses: actions/download-artifact@v3
+        name: Download distribution tar
+        with:
+          name: rocketmq
+          path: rocketmq
+      - 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 }} "cn-cicd-repo-registry.cn-hangzhou.cr.aliyuncs.com/cicd/rocketmq" ${{ secrets.DOCKER_REPO_USERNAME }} ${{ secrets.DOCKER_REPO_PASSWORD }}
+      - 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: alibaba/cloud-native-test-ci-tool@v0.0.1
+        name: Deploy rocketmq
+        with:
+          action: "deploy"
+          ask-config: "${{ secrets.ASK_CONFIG }}"
+          test-version: "${{ matrix.version }}"
+          docker-repo-username: "${{ secrets.DOCKER_REPO_USERNAME }}"
+          docker-repo-password: "${{ secrets.DOCKER_REPO_PASSWORD }}"
+          chart-git: "https://ghproxy.com/https://github.com/cryptoya/rocketmq-docker.git"
+          chart-branch: "master"
+          chart-path: "./rocketmq-k8s-helm"
+          job-id: ${{ strategy.job-index }}
+
+  e2e-test:
+    if: ${{ success() }}
+    name: E2E Test
+    needs: [list-version, deploy]
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    strategy:
+      matrix:
+        version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
+    steps:
+      - uses: alibaba/cloud-native-test-ci-tool@v0.0.1
+        name: e2e test
+        with:
+          action: "test"
+          ask-config: "${{ secrets.ASK_CONFIG }}"
+          test-version: "${{ matrix.version }}"
+          test-code-git: "https://ghproxy.com/https://github.com/apache/rocketmq-e2e.git"
+          test-code-branch: "master"
+          test-code-path: java/e2e
+          test-cmd: "mvn -B test"
+          job-id: ${{ strategy.job-index }}
+      - 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
+
+  clean:
+    if: always()
+    name: Clean
+    needs: [list-version, e2e-test]
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    strategy:
+      matrix:
+        version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
+    steps:
+      - uses: alibaba/cloud-native-test-ci-tool@v0.0.1
+        name: clean
+        with:
+          action: "clean"
+          ask-config: "${{ secrets.ASK_CONFIG }}"
+          test-version: "${{ matrix.version }}"
+          job-id: ${{ strategy.job-index }}