feat: add sccache support

This commit is contained in:
Amin Yahyaabadi 2022-11-20 19:14:20 -08:00
parent 946a5bb524
commit 45d9ac5ca2
9 changed files with 42 additions and 5 deletions

View File

@ -51,6 +51,9 @@ inputs:
ccache:
description: "The ccache version to install."
required: false
sccache:
description: "The sccache version to install."
required: false
doxygen:
description: "The doxygen version to install."
required: false

View File

@ -67,6 +67,7 @@ words:
- pwsh
- pygments
- pypy
- Sccache
- setupcpp
- setx
- Syuu

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

@ -47,6 +47,7 @@ import { setupBazel } from "./bazel/bazel"
import { setupPowershell } from "./powershell/powershell"
import { isArch } from "./utils/env/isArch"
import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
import { setupSccache } from "./sccache/sccache"
/** The setup functions */
const setups = {
@ -66,6 +67,7 @@ const setups = {
brew: setupBrew,
powershell: setupPowershell,
ccache: setupCcache,
sccache: setupSccache,
doxygen: setupDoxygen,
graphviz: setupGraphviz,
cppcheck: setupCppcheck,
@ -366,6 +368,7 @@ All the available tools:
--make
--task
--ccache
--sccache
--cppcheck
--clangformat
--clangtidy
@ -373,13 +376,13 @@ All the available tools:
--gcovr
--opencppcoverage
--kcov
--python
--choco
--brew
--nala
--sevenzip
--graphviz
--powershell
`)
}

View File

@ -0,0 +1,12 @@
import { setupSccache } from "../sccache"
import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(300000)
describe("setup-sccache", () => {
it("should setup sccache", async () => {
const installInfo = await setupSccache("", "", process.arch)
await testBin("sccache", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
})
})

18
src/sccache/sccache.ts Normal file
View File

@ -0,0 +1,18 @@
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupSccache(version: string, _setupDir: string, _arch: string) {
switch (process.platform) {
case "win32": {
return setupChocoPack("sccache", version)
}
case "linux":
case "darwin": {
return setupBrewPack("sccache", version)
}
default: {
throw new Error(`Unsupported platform`)
}
}
}