From 955e49dca194d0a2694fc4d1a3608a0b36b5634e Mon Sep 17 00:00:00 2001 From: tangxifan Date: Tue, 24 Nov 2020 15:10:33 -0700 Subject: [PATCH] [Test] bug fix for ccache and enhance printing messages --- .github/workflows/build.yml | 21 +++++++++++++++++++-- .github/workflows/reg_test.yml | 18 +++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11f87e8d4..f025a625b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,11 +108,25 @@ jobs: - name: ccache cache files uses: actions/cache@v1.1.0 with: - path: ${{runner.workspace}}/build/.ccache + path: .ccache key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | ${{ matrix.config.name }}-ccache- + # Set up the paths for ccache and control the size under 400MB + - name: Configure ccache + shell: cmake -P {0} + run: | + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) + set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") + set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") + set(ENV{CCACHE_COMPRESS} "true") + set(ENV{CCACHE_COMPRESSLEVEL} "6") + set(ENV{CCACHE_MAXSIZE} "400M") + + execute_process(COMMAND ccache -p) + execute_process(COMMAND ccache -z) + - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system @@ -130,4 +144,7 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + # Check the cache size and see if it is over the limit + run: | + cmake --build . --config $BUILD_TYPE + ccache -s diff --git a/.github/workflows/reg_test.yml b/.github/workflows/reg_test.yml index e77f55909..ea786178b 100644 --- a/.github/workflows/reg_test.yml +++ b/.github/workflows/reg_test.yml @@ -104,6 +104,20 @@ jobs: restore-keys: | ${{ matrix.config.name }}-ccache- + # Set up the paths for ccache and control the size under 400MB + - name: Configure ccache + shell: cmake -P {0} + run: | + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) + set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") + set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") + set(ENV{CCACHE_COMPRESS} "true") + set(ENV{CCACHE_COMPRESSLEVEL} "6") + set(ENV{CCACHE_MAXSIZE} "400M") + + execute_process(COMMAND ccache -p) + execute_process(COMMAND ccache -z) + - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system @@ -121,7 +135,9 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + run: | + cmake --build . --config $BUILD_TYPE + ccache -s - name: ${{matrix.config.name}} shell: bash