@@ -32,6 +32,9 @@ concurrency:
3232 group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
3333 cancel-in-progress : true
3434
35+ env :
36+ KVROCKS_DEPS_CACHE_DIR : build-deps
37+
3538jobs :
3639 precondition :
3740 name : Precondition
7275 runs-on : ubuntu-24.04
7376 steps :
7477 - uses : actions/checkout@v6
78+ - name : Restore Kvrocks dependency cache
79+ id : cache-kvrocks-deps
80+ uses : actions/cache@v5
81+ with :
82+ path : ${{ env.KVROCKS_DEPS_CACHE_DIR }}
83+ key : kvrocks-full-deps-${{ hashFiles('x.py', 'CMakeLists.txt', 'cmake/**/*.cmake') }}
84+ enableCrossOsArchive : true
85+ - name : Fetch Kvrocks dependencies
86+ if : ${{ steps.cache-kvrocks-deps.outputs.cache-hit != 'true' }}
87+ run : |
88+ ./x.py fetch-deps ${{ env.KVROCKS_DEPS_CACHE_DIR }}
89+ ./x.py fetch-deps ${{ env.KVROCKS_DEPS_CACHE_DIR }} -D ENABLE_LUAJIT=OFF
7590 - uses : actions/setup-go@v6
7691 with :
7792 go-version-file : ' tests/gocase/go.mod'
87102 run : ./x.py check format --clang-format-path clang-format-18
88103 - name : Check with clang-tidy
89104 run : |
90- ./x.py build --skip-build
105+ ./x.py build --skip-build --dep-dir ${{ env.KVROCKS_DEPS_CACHE_DIR }}
91106 ./x.py check tidy -j $(nproc) --clang-tidy-path clang-tidy-18 --run-clang-tidy-path run-clang-tidy-18
92107 - name : Lint with golangci-lint
93108 run : ./x.py check golangci-lint
@@ -317,6 +332,12 @@ jobs:
317332 - uses : actions/checkout@v6
318333 with :
319334 fetch-depth : 0
335+ - name : Restore Kvrocks dependency cache
336+ uses : actions/cache@v5
337+ with :
338+ path : ${{ env.KVROCKS_DEPS_CACHE_DIR }}
339+ key : kvrocks-full-deps-${{ hashFiles('x.py', 'CMakeLists.txt', 'cmake/**/*.cmake') }}
340+ enableCrossOsArchive : true
320341 - uses : actions/setup-python@v6
321342 if : ${{ !matrix.arm_linux }}
322343 with :
@@ -339,19 +360,19 @@ jobs:
339360 run : |
340361 ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.without_jemalloc }} \
341362 ${{ matrix.without_luajit }} ${{ matrix.with_ninja }} ${{ matrix.with_sanitizer }} ${{ matrix.with_openssl }} \
342- ${{ matrix.new_encoding }} ${{ env.CMAKE_EXTRA_DEFS }}
363+ ${{ matrix.new_encoding }} ${{ env.CMAKE_EXTRA_DEFS }} --dep-dir ${{ env.KVROCKS_DEPS_CACHE_DIR }}
343364
344365 - name : Build Kvrocks (SonarCloud)
345366 if : ${{ matrix.sonarcloud }}
346367 run : |
347- build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --compiler ${{ matrix.compiler }} --skip-build
368+ build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --compiler ${{ matrix.compiler }} --skip-build --dep-dir ${{ env.KVROCKS_DEPS_CACHE_DIR }}
348369 cp -r build _build
349- build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.sonarcloud }}
370+ build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.sonarcloud }} --dep-dir ${{ env.KVROCKS_DEPS_CACHE_DIR }}
350371
351372 - name : Build Kvrocks (RISC-V)
352373 if : ${{ matrix.riscv_toolchain }}
353374 run : |
354- ./x.py build -j$NPROC --unittest --toolchain ${{ matrix.toolchain_file }}
375+ ./x.py build -j$NPROC --unittest --toolchain ${{ matrix.toolchain_file }} --dep-dir ${{ env.KVROCKS_DEPS_CACHE_DIR }}
355376
356377 - name : Setup Coredump
357378 if : ${{ startsWith(matrix.os, 'ubuntu') }}
@@ -618,6 +639,12 @@ jobs:
618639 pushd redis-6.2.14 && USE_JEMALLOC=no make -j$NPROC redis-server && mv src/redis-server $HOME/local/bin/ && popd
619640
620641 - uses : actions/checkout@v6
642+ - name : Restore Kvrocks dependency cache
643+ uses : actions/cache@v5
644+ with :
645+ path : ${{ env.KVROCKS_DEPS_CACHE_DIR }}
646+ key : kvrocks-full-deps-${{ hashFiles('x.py', 'CMakeLists.txt', 'cmake/**/*.cmake') }}
647+ enableCrossOsArchive : true
621648 - uses : actions/setup-go@v6
622649 if : ${{ !startsWith(matrix.image, 'opensuse') }}
623650 with :
@@ -626,7 +653,7 @@ jobs:
626653
627654 - name : Build Kvrocks
628655 run : |
629- ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.disable_jemalloc }}
656+ ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.disable_jemalloc }} --dep-dir ${{ env.KVROCKS_DEPS_CACHE_DIR }}
630657
631658 - name : Run Unit Test
632659 run : |
0 commit comments