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: ccache:
description: "The ccache version to install." description: "The ccache version to install."
required: false required: false
sccache:
description: "The sccache version to install."
required: false
doxygen: doxygen:
description: "The doxygen version to install." description: "The doxygen version to install."
required: false required: false

View File

@ -67,6 +67,7 @@ words:
- pwsh - pwsh
- pygments - pygments
- pypy - pypy
- Sccache
- setupcpp - setupcpp
- setx - setx
- Syuu - 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 { setupPowershell } from "./powershell/powershell"
import { isArch } from "./utils/env/isArch" import { isArch } from "./utils/env/isArch"
import { setupPacmanPack } from "./utils/setup/setupPacmanPack" import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
import { setupSccache } from "./sccache/sccache"
/** The setup functions */ /** The setup functions */
const setups = { const setups = {
@ -66,6 +67,7 @@ const setups = {
brew: setupBrew, brew: setupBrew,
powershell: setupPowershell, powershell: setupPowershell,
ccache: setupCcache, ccache: setupCcache,
sccache: setupSccache,
doxygen: setupDoxygen, doxygen: setupDoxygen,
graphviz: setupGraphviz, graphviz: setupGraphviz,
cppcheck: setupCppcheck, cppcheck: setupCppcheck,
@ -366,6 +368,7 @@ All the available tools:
--make --make
--task --task
--ccache --ccache
--sccache
--cppcheck --cppcheck
--clangformat --clangformat
--clangtidy --clangtidy
@ -373,13 +376,13 @@ All the available tools:
--gcovr --gcovr
--opencppcoverage --opencppcoverage
--kcov --kcov
--python --python
--choco --choco
--brew --brew
--nala --nala
--sevenzip --sevenzip
--graphviz --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`)
}
}
}