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 }}- 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