fix: install everything into ~/setup_cpp

This commit is contained in:
Amin Yahyaabadi 2021-09-14 05:11:42 -05:00
parent a3c53e221f
commit d3abd11c4f
2 changed files with 9 additions and 8 deletions

View File

@ -3,7 +3,6 @@ import { addPath, group, startGroup, endGroup } from "@actions/core"
import { join } from "path" import { join } from "path"
import { existsSync } from "fs" import { existsSync } from "fs"
import * as hasha from "hasha" import * as hasha from "hasha"
import { tmpdir } from "os"
/** A type that describes a package */ /** A type that describes a package */
export type PackageInfo = { export type PackageInfo = {
@ -39,7 +38,7 @@ export async function setupBin(
// Get an unique output directory name from the URL. // Get an unique output directory name from the URL.
const key: string = await hasha.async(url) const key: string = await hasha.async(url)
const workDir = join(process.env.RUNNER_TEMP ?? tmpdir(), key) const workDir = join(process.env.SETUP_CPP_DIR ?? "~/setup_cpp", key)
/** The directory which the tool is installed to */ /** The directory which the tool is installed to */
const binDir = join(workDir, extractedFolderName, binRelativeDir) const binDir = join(workDir, extractedFolderName, binRelativeDir)

View File

@ -9,18 +9,20 @@ export async function setupTmpDir(testName: string) {
await io.mkdirP(tempDirectory) await io.mkdirP(tempDirectory)
process.env.INPUT_DESTINATION = tempDirectory process.env.INPUT_DESTINATION = tempDirectory
process.env.GITHUB_WORKSPACE = tempDirectory process.env.GITHUB_WORKSPACE = tempDirectory
process.env.RUNNER_TEMP = path.join(tempDirectory, "temp") process.env.SETUP_CPP_DIR = path.join(tempDirectory, "temp", "setup-cpp")
process.env.RUNNER_TOOL_CACHE = path.join(tempDirectory, "tempToolCache") process.env.RUNNER_TOOL_CACHE = path.join(tempDirectory, "tempToolCache")
return tempDirectory return tempDirectory
} }
export async function cleanupTmpDir(testName: string) { export async function cleanupTmpDir(testName: string) {
const tempDirectory = path.join(tmpdir(), "setup-cpp", testName) if (process.env.SETUP_CPP_DIR != undefined) {
const tempDirectory = path.join(process.env.SETUP_CPP_DIR, testName)
try { try {
await io.rmRF(tempDirectory) await io.rmRF(tempDirectory)
} catch { } catch {
console.log("Failed to remove test directories") console.log("Failed to remove test directories")
} }
}
} }