From 9a21fcb3145e3cc3a7a87620626b2048bc0a6300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 8 Sep 2023 07:22:41 +0200 Subject: [PATCH] Fix #146: use compiler hash instead of volatile mtime (#147) * Fix #146: use compiler hash instead of volatile mtime This addresses issue where GitHub actions runners report different mtime for compiler causing incorrect cache misses * Fix #146: use compiler hash instead of volatile mtime for darwin This addresses issue where GitHub actions runners report different mtime for compiler causing incorrect cache misses --- src/restore.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/restore.ts b/src/restore.ts index 8b0c0b31..024d4f9f 100644 --- a/src/restore.ts +++ b/src/restore.ts @@ -45,7 +45,7 @@ async function restore(ccacheVariant : string) : Promise { } } -async function configure(ccacheVariant : string) : Promise { +async function configure(ccacheVariant : string, platform : string) : Promise { const ghWorkSpace = process.env.GITHUB_WORKSPACE || "unreachable, make ncc happy"; const maxSize = core.getInput('max-size'); @@ -53,6 +53,9 @@ async function configure(ccacheVariant : string) : Promise { await execBash(`ccache --set-config=cache_dir='${path.join(ghWorkSpace, '.ccache')}'`); await execBash(`ccache --set-config=max_size='${maxSize}'`); await execBash(`ccache --set-config=compression=true`); + if (platform === "darwin") { + await execBash(`ccache --set-config=compiler_check=content`); + } core.info("Cccache config:"); await execBash("ccache -p"); } else { @@ -194,8 +197,8 @@ async function runInner() : Promise { await restore(ccacheVariant); core.endGroup(); - core.startGroup(`Configure ${ccacheVariant}`); - await configure(ccacheVariant); + core.startGroup(`Configure ${ccacheVariant}, ${process.platform}`); + await configure(ccacheVariant, process.platform); await execBash(`${ccacheVariant} -z`); core.endGroup(); }