From 981acaa420b2c8458d8af2ec46dee94a00b6b4b5 Mon Sep 17 00:00:00 2001 From: Lesserkuma Date: Thu, 30 Jan 2025 16:49:01 +0100 Subject: [PATCH] Build cache for Windows --- .github/workflows/cd_main.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/cd_main.yml b/.github/workflows/cd_main.yml index 6286145..71a5eb0 100644 --- a/.github/workflows/cd_main.yml +++ b/.github/workflows/cd_main.yml @@ -30,6 +30,31 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Restore file modification times + if: runner.os == 'Windows' + run: | + git ls-tree -r --name-only HEAD | while read filename; do + commit_date=$(git log -1 --follow --format=%ci -- "$filename") + timestamp=$(date -d "$commit_date" +'%Y%m%d%H%M.%S') + touch -t "$timestamp" "$filename" + mod_time=$(stat -c %y "$filename") + echo "File: $filename | Git timestamp: $timestamp | File mtime: $mod_time" + done + shell: bash + + - name: Cache build folders + id: build-cache + if: runner.os == 'Windows' + uses: actions/cache@v4 + with: + path: | + build + key: ${{ runner.os }}-${{ matrix.platform.artifact_name }}-build-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-${{ matrix.platform.artifact_name }}-build- - name: Configure if: runner.os != 'Linux'