From 78c3696651830c63699e353718ec2c9b682f3668 Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Thu, 23 Mar 2023 02:32:53 +0100 Subject: [PATCH] CI: Cache build folder on Windows Since the initial `cmake -G "Visual Studio 17 2022" ..` seems to be a real bottleneck on the Windows CI (sometimes taking multiple minutes for seemingly no reason), cache the build folder based on the hash of CMakeLists.txt. It should be possible to reuse the build folder if CMakeLists hasn't changed, and if it does change (because someone adds a source file or library or something), we'll just do that initial cmake with -G once, and cache that version as well. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows --- .github/workflows/ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd342ce9..8634c84a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,17 @@ jobs: Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$env:SDL_VERSION/SDL2-devel-$env:SDL_VERSION-VC.zip" -o C:\SDL.zip Expand-Archive C:\SDL.zip -DestinationPath C:\ - - name: CMake configure (default version) + - name: Cache build folder for this CMakeLists.txt + id: cache-windows-build-folder + uses: actions/cache@v3 + env: + cache-name: cache-windows-build-folder-VS2022 + with: + path: desktop_version/build + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('desktop_version/CMakeLists.txt') }}-SDL${{ env.SDL_VERSION }} + + - if: ${{ steps.cache-windows-build-folder.outputs.cache-hit != 'true' }} + name: CMake initial configure/generate run: | mkdir $env:SRC_DIR_PATH/build cd $env:SRC_DIR_PATH/build @@ -147,6 +157,11 @@ jobs: cmake -G "Visual Studio 17 2022" -A Win32 ` -DSDL2_INCLUDE_DIRS="C:\SDL2-$env:SDL_VERSION\include" ` -DSDL2_LIBRARIES="SDL2;SDL2main" .. + + - name: CMake configure (default version) + run: | + cd $env:SRC_DIR_PATH/build + cmake .. - name: Build (default version) run: | cd $env:SRC_DIR_PATH/build