fix: configurable runner tool cache + disabled by default

Runner tool cache can fill up the disk space (e.g. for LLVM), so it is disabled by default
This commit is contained in:
Amin Yahyaabadi 2024-08-08 13:49:29 -07:00
parent 76b3fd37b4
commit e2c1dd3622
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
11 changed files with 94 additions and 85 deletions

View File

@ -3,6 +3,9 @@ description: "Install all the tools required for building and testing C++/C proj
author: "Amin Yahyaabadi"
inputs:
cache-tools:
description: "If should cache the installed tools? (Default: false)"
required: false
compiler:
description: "The compiler to use and its optional version separated by - e.g. llvm-13.0.0"
required: false

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,7 @@ describe("setup-cmake", () => {
let directory: string
beforeAll(async () => {
directory = await setupTmpDir("cmake")
process.env.CACHE_TOOLS = "true"
})
it("should setup CMake", async () => {

View File

@ -14,6 +14,7 @@ describe("setup-ninja", () => {
let directory: string
beforeEach(async () => {
directory = await setupTmpDir("ninja")
process.env.CACHE_TOOLS = "true"
})
it("should setup Ninja", async () => {

View File

@ -8,6 +8,7 @@ describe("setup-task", () => {
let directory: string
beforeAll(async () => {
directory = await setupTmpDir("task")
process.env.CACHE_TOOLS = "true"
})
it("should setup task", async () => {

View File

@ -7,6 +7,7 @@ import { tmpdir } from "os"
import { GITHUB_ACTIONS } from "ci-info"
import { pathExists } from "path-exists"
import retry from "retry-as-promised"
import { maybeGetInput } from "../../cli-options"
import { hasDnf } from "../env/hasDnf"
import { isArch } from "../env/isArch"
import { isUbuntu } from "../env/isUbuntu"
@ -132,7 +133,9 @@ export async function setupBin(
// check if inside Github Actions. If so, cache the installation
if (GITHUB_ACTIONS && typeof process.env.RUNNER_TOOL_CACHE === "string") {
await cacheDir(setupDir, name, version)
if (maybeGetInput("cache-tools") === "true" || process.env.CACHE_TOOLS === "true") {
await cacheDir(setupDir, name, version)
}
}
return { installDir, binDir }