From 56dfd903aa689d1f1a4c8e36a3f2f3327225b7b9 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Thu, 21 Aug 2025 15:54:48 +0000 Subject: [PATCH 1/2] fix(bazel): take into account `MODULE.bazel.lock` for cache invalidation This change now considers also `MODULE.bazel.lock` as part of the cache key. Also, we which an issue where we had an invalid path in the cache key `\%LocalAppData\%`. These paths are not expanded. See: https://github.com/actions/cache?tab=readme-ov-file#windows-environment-variables --- github-actions/bazel/setup/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github-actions/bazel/setup/action.yml b/github-actions/bazel/setup/action.yml index 5a37924f4..fcf45b203 100644 --- a/github-actions/bazel/setup/action.yml +++ b/github-actions/bazel/setup/action.yml @@ -17,8 +17,8 @@ runs: with: path: | ~/.cache/bazelisk - \%LocalAppData\%/bazelisk - key: bazel-version-${{ hashFiles('**/.bazelversion') }} + ~/AppData/Local/bazelisk + key: bazel-version-${{ runner.os }}-${{ hashFiles('**/.bazelversion') }} - name: Setup CI bazelrc config run: node $GITHUB_ACTION_PATH/setup-ci-bazelrc.mjs @@ -32,6 +32,6 @@ runs: # Note: Bazel repository cache is located in system locations and cannot use # a shared cache between different runner operating systems. path: '~/.cache/bazel_repo_cache' - key: bazel-cache-${{ runner.os }}-${{ hashFiles('**/WORKSPACE') }} + key: bazel-cache-${{ runner.os }}-${{ hashFiles('**/WORKSPACE') }}-${{ hashFiles('**/MODULE.bazel.lock') }} restore-keys: | bazel-cache-${{ runner.os }}- From afd8ba42e623499d6efc02268376d980dd5d7b79 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Thu, 21 Aug 2025 15:59:31 +0000 Subject: [PATCH 2/2] fix(github-actions): replace `C:\` to `/mnt/c` Since Bazel will run in WSL under Windows we need to update the `--repository_cache` to use the WSL mounted path. --- github-actions/bazel/setup/setup-ci-bazelrc.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/github-actions/bazel/setup/setup-ci-bazelrc.mjs b/github-actions/bazel/setup/setup-ci-bazelrc.mjs index ba24c995a..113aa1445 100755 --- a/github-actions/bazel/setup/setup-ci-bazelrc.mjs +++ b/github-actions/bazel/setup/setup-ci-bazelrc.mjs @@ -7,7 +7,7 @@ import fs from 'fs'; // in the bazelrc file need to be escaled as otherwise those would escape // followed characters that weren't supposed to be escaped. const cachePath = path.join(os.homedir(), '.cache/bazel_repo_cache'); -const escapedCachePath = cachePath.replace(/\\/g, '\\\\'); +const escapedCachePath = cachePath.replace(/\\/g, '/'); const bazelRcContent = ` # Print all the options that apply to the build. @@ -16,7 +16,8 @@ const bazelRcContent = ` build --announce_rc # Avoids re-downloading NodeJS/browsers all the time. -build --repository_cache=${escapedCachePath} +# Replace path to make it compatable with WSL +build --repository_cache=${escapedCachePath.replace(/c:\//i, '/mnt/c/')} # More details on failures build --verbose_failures=true