You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by ti...@apache.org on 2022/06/29 07:40:55 UTC

[incubator-kvrocks] branch unstable updated: ci: refactor CI yaml settings (#689)

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

tison 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 4b0f135  ci: refactor CI yaml settings (#689)
4b0f135 is described below

commit 4b0f135a9936298bd37e6a764dffafaff46fb21e
Author: tison <wa...@gmail.com>
AuthorDate: Wed Jun 29 15:40:49 2022 +0800

    ci: refactor CI yaml settings (#689)
    
    Signed-off-by: tison <wa...@gmail.com>
---
 .github/workflows/daily-ci.yaml | 53 +++++++++++++++++++------------
 .github/workflows/kvrocks.yaml  | 69 +++++++++++++++++++----------------------
 tests/tcl/tests/test_helper.tcl |  1 +
 3 files changed, 66 insertions(+), 57 deletions(-)

diff --git a/.github/workflows/daily-ci.yaml b/.github/workflows/daily-ci.yaml
index 91abf2c..9fdc72e 100644
--- a/.github/workflows/daily-ci.yaml
+++ b/.github/workflows/daily-ci.yaml
@@ -92,38 +92,51 @@ jobs:
 
     runs-on: ${{ matrix.os }}
     steps:
-      - name: Checkout Code Base
-        uses: actions/checkout@v3
+      - name: Cache redis
+        id: cache-redis
+        uses: actions/cache@v2
         with:
-          fetch-depth: 64
+          path: |
+            ~/local/bin/redis-cli
+          key: ${{ runner.os }}-redis-cli
+
+      - name: Setup macOS
+        if: ${{ startsWith(matrix.os, 'macos') }}
+        run: |
+          brew install cmake gcc autoconf automake libtool
+          echo "NPROC=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
+
+      - name: Setup Linux
+        if: ${{ startsWith(matrix.os, 'ubuntu') }}
+        run: |
+          sudo apt update
+          sudo apt install -y tcl8.5
+          echo "NPROC=$(nproc)" >> $GITHUB_ENV
 
       - 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: Install redis
+        if: steps.cache-redis.outputs.cache-hit != 'true'
+        run: |
+          curl -O https://download.redis.io/releases/redis-6.2.6.tar.gz
+          tar -xzvf redis-6.2.6.tar.gz
+          mkdir -p $HOME/local/bin
+          pushd redis-6.2.6 && BUILD_TLS=yes make -j$NPROC redis-cli && mv src/redis-cli $HOME/local/bin/ && popd
+
+      - name: Checkout Code Base
+        uses: actions/checkout@v3
 
       - name: Build Kvrocks
         run: |
           ./build.sh build -j$NPROC --unittest \
             ${{ matrix.clang }} ${{ matrix.with_ninja }} ${{ matrix.with_sanitizer }} ${{ matrix.without_jemalloc }}
-        
+
       - name: Run Unit Test
         run: ./build/unittest
 
       - name: Run Redis Tcl Test
-        run: cd tests/tcl && ./runtest
+        run: |
+          cp $HOME/local/bin/redis-cli tests/tcl/redis-cli
+          cd tests/tcl && ./runtest
diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml
index 6e367d8..c344ee3 100644
--- a/.github/workflows/kvrocks.yaml
+++ b/.github/workflows/kvrocks.yaml
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: kvrocks ci actions  # don't edit while the badge was depend on this
+name: CI
 
 on: [push, pull_request]
 
@@ -36,7 +36,6 @@ jobs:
         with:
           config: tools/ci/licenserc.yml
 
-
   lint:
     name: Lint and check code
     runs-on: ubuntu-latest
@@ -48,8 +47,8 @@ jobs:
         run: |
           sudo pip install --upgrade pip
           sudo pip install --upgrade setuptools
-          sudo apt-get update
-          sudo apt-get install -y cppcheck
+          sudo apt update
+          sudo apt install -y cppcheck
           sudo pip install cpplint==1.5.0
 
       - name: Lint and check code
@@ -57,7 +56,6 @@ jobs:
           ./cpplint.sh
           ./cppcheck.sh
 
-
   build-and-test:
     name: Build and test
     needs: [license, lint]
@@ -69,57 +67,54 @@ jobs:
           - name: Ubuntu Clang
             os: ubuntu-18.04
             clang: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
-          - name: Mac OS
+          - name: macOS AppleClang
             os: macos-latest
 
     runs-on: ${{ matrix.os }}
     steps:
-      - name: Checkout Code Base
-        uses: actions/checkout@v3
+      - name: Cache redis
+        id: cache-redis
+        uses: actions/cache@v2
         with:
-          fetch-depth: 64
+          path: |
+            ~/local/bin/redis-cli
+          key: ${{ runner.os }}-redis-cli
 
-      - name: Setup Mac OS
+      - name: Setup macOS
         if: ${{ startsWith(matrix.os, 'macos') }}
-        run: brew install cmake gcc autoconf automake libtool
+        run: |
+          brew install cmake gcc autoconf automake libtool
+          echo "NPROC=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
+      
+      - name: Setup Linux
+        if: ${{ startsWith(matrix.os, 'ubuntu') }}
+        run: |
+          sudo apt update
+          sudo apt install -y tcl8.5
+          echo "NPROC=$(nproc)" >> $GITHUB_ENV
 
-      - name: Get cpu core number
-        if: ${{ startsWith(matrix.os, 'macos') }}
-        run: echo "NPROC=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
+      - name: Install redis
+        if: steps.cache-redis.outputs.cache-hit != 'true'
+        run: |
+          curl -O https://download.redis.io/releases/redis-6.2.6.tar.gz
+          tar -xzvf redis-6.2.6.tar.gz
+          mkdir -p $HOME/local/bin
+          pushd redis-6.2.6 && BUILD_TLS=yes make -j$NPROC redis-cli && mv src/redis-cli $HOME/local/bin/ && popd
 
-      - name: Get cpu core number
-        if: ${{ startsWith(matrix.os, 'ubuntu') }}
-        run: echo "NPROC=$(nproc)" >> $GITHUB_ENV
+      - name: Checkout Code Base
+        uses: actions/checkout@v3
 
       - name: Build Kvrocks
-        run: |
-          ./build.sh build -j$NPROC --unittest ${{ matrix.clang }}
+        run: ./build.sh build -j$NPROC --unittest ${{ matrix.clang }}
 
       - name: Run Unit Test
         run: ./build/unittest
 
-      - name: Install TCL
-        if: ${{ startsWith(matrix.os, 'ubuntu') }}
-        run: sudo apt install -y tcl8.5
-
-      - name: Prepare Redis CLI
-        if: ${{ startsWith(matrix.os, 'ubuntu') }}
-        run: |
-          wget https://github.com/redis/redis/archive/refs/tags/6.2.6.tar.gz
-          tar -zxvf 6.2.6.tar.gz
-          cd redis-6.2.6 && make -j$NPROC redis-cli && cd -
-          cp redis-6.2.6/src/redis-cli tests/tcl/redis-cli
-
       - name: Run Redis Tcl Test
         run: |
+          cp $HOME/local/bin/redis-cli tests/tcl/redis-cli
           cd tests/tcl && ./runtest
 
-      - name: Run Redis Tcl Test (Redis CLI)
-        if: ${{ startsWith(matrix.os, 'ubuntu') }}
-        run: |
-          cd tests/tcl && ./runtest --single integration/redis-cli
-
-
   required:
     if: always()
     name: Required
diff --git a/tests/tcl/tests/test_helper.tcl b/tests/tcl/tests/test_helper.tcl
index 274d4a4..e550137 100644
--- a/tests/tcl/tests/test_helper.tcl
+++ b/tests/tcl/tests/test_helper.tcl
@@ -60,6 +60,7 @@ set ::all_tests {
     unit/scripting
     integration/slotmigrate
     integration/slotimport
+    integration/redis-cli
     integration/replication
     integration/rsid_psync
     integration/cluster