From 0ae246a93bcdf82a4ed2df05e2718c656e9fdd99 Mon Sep 17 00:00:00 2001 From: Adonis Ling Date: Fri, 25 Nov 2022 07:52:03 +0800 Subject: [PATCH] [chore](github) Optimize BE UT workflows (#14565) In #14533 , we run BE UT workflows periodically to share the cache with brand new pull requests. However, we don't need to save the cache when the unit tests doesn't run, otherwise it may occupy huge cache space and some useful caches will be evicted by GitHub. --- .github/workflows/be-ut-clang.yml | 23 +++++++++++------------ .github/workflows/be-ut-mac.yml | 23 +++++++++++------------ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/be-ut-clang.yml b/.github/workflows/be-ut-clang.yml index 4d41b12751..aa09e705e5 100644 --- a/.github/workflows/be-ut-clang.yml +++ b/.github/workflows/be-ut-clang.yml @@ -37,14 +37,8 @@ jobs: persist-credentials: false submodules: recursive - - name: Ccache ${{ github.ref }} - uses: ./.github/actions/ccache-action - with: - key: BE-UT-Clang - max-size: "2G" - restore-keys: BE-UT-Clang- - - - name: Paths filter + - name: Paths Filter + if: ${{ github.event_name != 'schedule' }} uses: ./.github/actions/paths-filter id: filter with: @@ -54,8 +48,16 @@ jobs: - 'gensrc/proto/**' - 'gensrc/thrift/**' + - name: Ccache ${{ github.ref }} + if: ${{ github.event_name == 'schedule' || steps.filter.outputs.be_changes == 'true' }} + uses: ./.github/actions/ccache-action + with: + key: BE-UT-Clang + max-size: "2G" + restore-keys: BE-UT-Clang- + - name: Run UT ${{ github.ref }} - if: ${{ steps.filter.outputs.be_changes == 'true' }} + if: ${{ github.event_name == 'schedule' || steps.filter.outputs.be_changes == 'true' }} run: | export DEFAULT_DIR='/opt/doris' @@ -81,6 +83,3 @@ jobs: export PATH="${DEFAULT_DIR}/ldb-toolchain/bin/:$(pwd)/thirdparty/installed/bin/:${PATH}" DORIS_TOOLCHAIN=clang ./run-be-ut.sh -j "$(nproc)" --run --clean - - name: Skip UT ${{ github.ref }} - if: ${{ steps.filter.outputs.be_changes == 'false' }} - run: echo 'No need to run.' diff --git a/.github/workflows/be-ut-mac.yml b/.github/workflows/be-ut-mac.yml index a373b81ca8..e0e939f633 100644 --- a/.github/workflows/be-ut-mac.yml +++ b/.github/workflows/be-ut-mac.yml @@ -37,14 +37,8 @@ jobs: persist-credentials: false submodules: recursive - - name: Ccache ${{ github.ref }} - uses: ./.github/actions/ccache-action - with: - key: BE-UT-macOS - max-size: "2G" - restore-keys: BE-UT-macOS- - - - name: Paths filter + - name: Paths Filter + if: ${{ github.event_name != 'schedule' }} uses: ./.github/actions/paths-filter id: filter with: @@ -54,8 +48,16 @@ jobs: - 'gensrc/proto/**' - 'gensrc/thrift/**' + - name: Ccache ${{ github.ref }} + if: ${{ github.event_name == 'schedule' || steps.filter.outputs.be_changes == 'true' }} + uses: ./.github/actions/ccache-action + with: + key: BE-UT-macOS + max-size: "2G" + restore-keys: BE-UT-macOS- + - name: Run UT ${{ github.ref }} - if: ${{ steps.filter.outputs.be_changes == 'true' }} + if: ${{ github.event_name == 'schedule' || steps.filter.outputs.be_changes == 'true' }} run: | cellars=( 'automake' @@ -88,6 +90,3 @@ jobs: ./run-be-ut.sh --run -j "$(nproc)" --clean - - name: Skip UT ${{ github.ref }} - if: ${{ steps.filter.outputs.be_changes == 'false' }} - run: echo 'No need to run.'