You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2022/06/19 05:53:54 UTC

[incubator-kvrocks] branch unstable updated: Refactor daily CI configuration using matrix (#630)

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

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 19da433  Refactor daily CI configuration using matrix (#630)
19da433 is described below

commit 19da43373566a3a9c70e10660e8ff9e09d31555e
Author: Twice <i...@twice.moe>
AuthorDate: Sun Jun 19 13:53:49 2022 +0800

    Refactor daily CI configuration using matrix (#630)
    
    - fix missing ninja binary in ninja build of daily CI
    - add `pull_request` trigger for the specific configuration file
    - refactor the daily CI using a unified matrix instead of some repeated jobs
---
 .github/workflows/daily-ci.yaml | 160 ++++++++++++++++++----------------------
 1 file changed, 70 insertions(+), 90 deletions(-)

diff --git a/.github/workflows/daily-ci.yaml b/.github/workflows/daily-ci.yaml
index 54e825a..91abf2c 100644
--- a/.github/workflows/daily-ci.yaml
+++ b/.github/workflows/daily-ci.yaml
@@ -18,19 +18,21 @@
 name: Daily CI
 
 on:
+  pull_request:
+    paths:
+      - ".github/workflows/daily-ci.yaml"
   schedule:
     # Daily run this action at 1am
     - cron: '0 1 * * *'
   workflow_dispatch:
 
 jobs:
-  build-on-ubuntu-docker:
+  build-docker-image:
     name: Build Docker Image
     runs-on: ubuntu-18.04
     steps:
-
       - name: Checkout Code Base
-        uses: actions/checkout@v2.3.4
+        uses: actions/checkout@v3
         with:
           fetch-depth: 64
 
@@ -48,102 +50,80 @@ jobs:
         run: |
           docker buildx build --platform linux/amd64,linux/arm64 .
 
-  build-on-ubuntu-without-jemalloc:
+  build-and-test:
+    name: Build And Test
     strategy:
+      fail-fast: false
       matrix:
-        os: [ubuntu-18.04]
-    
-    runs-on: ${{ matrix.os }}
-    steps:
-      - name: Checkout Code Base
-        uses: actions/checkout@v2.3.4
-        with:
-          fetch-depth: 64
-
-      - name: Build
-        run: |
-          mkdir build && cd build
-          cmake -DDISABLE_JEMALLOC=true -DCMAKE_BUILD_TYPE=Release ..
-          make -j4
-          cd ..
-
-      - name: Redis Tcl Test
-        run: |
-          sudo apt-get install tcl8.5
-          cd tests/tcl && sh runtest && cd -
+        include:
+          - name: Ubuntu GCC ASan
+            os: ubuntu-18.04
+            with_sanitizer: -DENABLE_ASAN=ON
+          # - name: Ubuntu GCC TSan
+          #   os: ubuntu-18.04
+          #   with_sanitizer: -DENABLE_TSAN=ON
+          - name: Ubuntu GCC without Jemalloc
+            os: ubuntu-18.04
+            without_jemalloc: -DDISABLE_JEMALLOC=ON
+          - name: Ubuntu Clang ASan
+            os: ubuntu-18.04
+            with_sanitizer: -DENABLE_ASAN=ON
+            clang: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+          # - name: Ubuntu Clang TSan
+          #   os: ubuntu-18.04
+          #   with_sanitizer: -DENABLE_TSAN=ON
+          #   clang: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+          - name: Ubuntu Clang without Jemalloc
+            os: ubuntu-18.04
+            without_jemalloc: -DDISABLE_JEMALLOC=ON
+            clang: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+          - name: Ubuntu GCC Ninja
+            os: ubuntu-18.04
+            with_ninja: --ninja
+          - name: Ubuntu GCC Ninja without Jemalloc
+            os: ubuntu-18.04
+            with_ninja: --ninja
+            without_jemalloc: -DDISABLE_JEMALLOC=ON
+          - name: MacOS Clang
+            os: macos-latest
+          - name: MacOS Clang without Jemalloc
+            os: macos-latest
+            without_jemalloc: -DDISABLE_JEMALLOC=ON
 
-  build-on-ubuntu-with-sanitizers:
-    strategy:
-      matrix:
-        os: [ubuntu-18.04]
-        sanitizer: [ENABLE_ASAN=ON, ENABLE_TSAN=ON]
-    
     runs-on: ${{ matrix.os }}
     steps:
       - name: Checkout Code Base
-        uses: actions/checkout@v2.3.4
+        uses: actions/checkout@v3
         with:
           fetch-depth: 64
 
-      - name: Build
+      - name: Install Ninja
+        if: ${{ matrix.with_ninja && startsWith(matrix.os, 'ubuntu') }}
+        run: sudo apt install -y ninja-build
+      
+      - name: Setup Mac OS
+        if: ${{ startsWith(matrix.os, 'macos') }}
+        run: brew install cmake gcc autoconf automake libtool
+      
+      - name: Install TCL
+        if: ${{ startsWith(matrix.os, 'ubuntu') }}
+        run: sudo apt install -y tcl8.5
+      
+      - name: Get cpu core number
+        if: ${{ startsWith(matrix.os, 'macos') }}
+        run: echo "NPROC=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
+
+      - name: Get cpu core number
+        if: ${{ startsWith(matrix.os, 'ubuntu') }}
+        run: echo "NPROC=$(nproc)" >> $GITHUB_ENV
+
+      - name: Build Kvrocks
         run: |
-          mkdir build && cd build
-          cmake -D${{ matrix.sanitizer }} ..
-          make -j4
-          cd ..
+          ./build.sh build -j$NPROC --unittest \
+            ${{ matrix.clang }} ${{ matrix.with_ninja }} ${{ matrix.with_sanitizer }} ${{ matrix.without_jemalloc }}
         
-      - name: Unit Test
-        run: |
-          ./build/unittest
+      - name: Run Unit Test
+        run: ./build/unittest
 
-      - name: Redis Tcl Test
-        run: |
-          sudo apt-get install tcl8.5
-          cd tests/tcl && sh runtest && cd -
-
-  build-test-on-macos-latest:
-    runs-on: macos-latest
-    steps:
-      - name: Checkout Code Base
-        uses: actions/checkout@v2.3.4
-        with:
-          fetch-depth: 64
-
-      - name: Install Dependencies
-        run: |
-          brew install cmake gcc autoconf automake libtool
-          mkdir build
-      - name: Build
-        run: |
-          cd build
-          cmake ..
-          make -j4
-          cd ..
-      - name: Unit Test
-        run: |
-          cd build
-          ./unittest
-          cd ..
-      - name: Redis Tcl Test
-        run:
-          cd tests/tcl && sh runtest && cd -
-
-  build-on-ubuntu-with-ninja:
-    strategy:
-      matrix:
-        os: [ubuntu-18.04]
-    
-    runs-on: ${{ matrix.os }}
-    steps:
-      - name: Checkout Code Base
-        uses: actions/checkout@v2.3.4
-        with:
-          fetch-depth: 64
-
-      - name: Build
-        run: |
-          ./build.sh build --ninja
-        
-      - name: Unit Test
-        run: |
-          ./build/unittest
+      - name: Run Redis Tcl Test
+        run: cd tests/tcl && ./runtest