mirror of https://github.com/aminya/setup-cpp
fix: only cache if RUNNER_TOOL_CACHE is defined
This commit is contained in:
parent
e5bc00a601
commit
d4d00ac16b
|
@ -27,7 +27,6 @@ export async function setupBin(
|
||||||
setupCppDir: string
|
setupCppDir: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
process.env.RUNNER_TEMP = process.env.RUNNER_TEMP ?? tmpdir()
|
process.env.RUNNER_TEMP = process.env.RUNNER_TEMP ?? tmpdir()
|
||||||
process.env.RUNNER_TOOL_CACHE = process.env.RUNNER_TOOL_CACH ?? join(setupCppDir, "ToolCache")
|
|
||||||
|
|
||||||
// Build artifact name
|
// Build artifact name
|
||||||
const binName = process.platform === "win32" ? `${name}.exe` : name
|
const binName = process.platform === "win32" ? `${name}.exe` : name
|
||||||
|
@ -62,7 +61,10 @@ export async function setupBin(
|
||||||
endGroup()
|
endGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
await cacheDir(workDir, name, version)
|
// check if inside Github Actions. If so, cache the installation
|
||||||
|
if (typeof process.env.RUNNER_TOOL_CACHE === "string") {
|
||||||
|
await cacheDir(workDir, name, version)
|
||||||
|
}
|
||||||
|
|
||||||
return join(binDir, binName)
|
return join(binDir, binName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ export async function setupTmpDir(testName: string) {
|
||||||
await io.rmRF(tempDirectory)
|
await io.rmRF(tempDirectory)
|
||||||
await io.mkdirP(tempDirectory)
|
await io.mkdirP(tempDirectory)
|
||||||
process.env.SETUP_CPP_DIR = tempDirectory
|
process.env.SETUP_CPP_DIR = tempDirectory
|
||||||
|
process.env.RUNNER_TOOL_CACHE = process.env.RUNNER_TOOL_CACH ?? path.join(tempDirectory, "ToolCache")
|
||||||
return tempDirectory
|
return tempDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue