From aac246a111c8aab719a08c5d258b3e9dc8c2691a Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 3 Jan 2024 12:56:55 +0100 Subject: [PATCH] Update ccache version to v4.9 Also use upstream ccache since now it provides binaries for all platforms. --- .github/workflows/build_cmake.yml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 08ee691..35061e3 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -6,7 +6,7 @@ env: CMAKE_VERSION: 3.24.3 NINJA_VERSION: 1.11.1 BUILD_TYPE: Release - CCACHE_VERSION: 4.7.3 + CCACHE_VERSION: 4.9 jobs: build: @@ -90,9 +90,32 @@ jobs: id: ccache shell: cmake -P {0} run: | - set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_VERSION}/${{ runner.os }}.tar.xz") - file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz) + if ("${{ runner.os }}" STREQUAL "Windows") + set(ccache_dir "ccache-$ENV{CCACHE_VERSION}-windows-x86_64") + set(ccache_archive "${ccache_dir}.zip") + elseif ("${{ runner.os }}" STREQUAL "Linux") + set(ccache_dir "ccache-$ENV{CCACHE_VERSION}-linux-x86_64") + set(ccache_archive "${ccache_dir}.tar.xz") + elseif ("${{ runner.os }}" STREQUAL "macOS") + set(ccache_dir "ccache-$ENV{CCACHE_VERSION}-darwin") + set(ccache_archive "${ccache_dir}.tar.gz") + endif() + + set(ccache_url "https://github.com/ccache/ccache/releases/download/v$ENV{CCACHE_VERSION}/${ccache_archive}") + file(DOWNLOAD "${ccache_url}" ./${ccache_archive} SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./${ccache_archive}) + + # Add to PATH environment variable + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${ccache_dir}" ccache_dir) + set(path_separator ":") + if ("${{ runner.os }}" STREQUAL "Windows") + set(path_separator ";") + endif() + file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${ccache_dir}") + + if (NOT "${{ runner.os }}" STREQUAL "Windows") + execute_process(COMMAND chmod +x ${ccache_dir}/ccache) + endif() - name: Prepare ccache timestamp id: ccache_cache_timestamp