Skip to content

Commit 45d9ac5

Browse files
committed
feat: add sccache support
1 parent 946a5bb commit 45d9ac5

File tree

9 files changed

+42
-5
lines changed

9 files changed

+42
-5
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ inputs:
5151
ccache:
5252
description: "The ccache version to install."
5353
required: false
54+
sccache:
55+
description: "The sccache version to install."
56+
required: false
5457
doxygen:
5558
description: "The doxygen version to install."
5659
required: false

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ words:
6767
- pwsh
6868
- pygments
6969
- pypy
70+
- Sccache
7071
- setupcpp
7172
- setx
7273
- Syuu

dist/node12/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node12/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { setupBazel } from "./bazel/bazel"
4747
import { setupPowershell } from "./powershell/powershell"
4848
import { isArch } from "./utils/env/isArch"
4949
import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
50+
import { setupSccache } from "./sccache/sccache"
5051

5152
/** The setup functions */
5253
const setups = {
@@ -66,6 +67,7 @@ const setups = {
6667
brew: setupBrew,
6768
powershell: setupPowershell,
6869
ccache: setupCcache,
70+
sccache: setupSccache,
6971
doxygen: setupDoxygen,
7072
graphviz: setupGraphviz,
7173
cppcheck: setupCppcheck,
@@ -366,20 +368,21 @@ All the available tools:
366368
--make
367369
--task
368370
--ccache
371+
--sccache
369372
--cppcheck
370373
--clangformat
371374
--clangtidy
372375
--doxygen
373376
--gcovr
374377
--opencppcoverage
375378
--kcov
376-
377379
--python
378380
--choco
379381
--brew
380382
--nala
381383
--sevenzip
382384
--graphviz
385+
--powershell
383386
`)
384387
}
385388

src/sccache/__tests__/sccache.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { setupSccache } from "../sccache"
2+
import { testBin } from "../../utils/tests/test-helpers"
3+
import { InstallationInfo } from "../../utils/setup/setupBin"
4+
5+
jest.setTimeout(300000)
6+
describe("setup-sccache", () => {
7+
it("should setup sccache", async () => {
8+
const installInfo = await setupSccache("", "", process.arch)
9+
10+
await testBin("sccache", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
11+
})
12+
})

src/sccache/sccache.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { setupBrewPack } from "../utils/setup/setupBrewPack"
2+
import { setupChocoPack } from "../utils/setup/setupChocoPack"
3+
4+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5+
export function setupSccache(version: string, _setupDir: string, _arch: string) {
6+
switch (process.platform) {
7+
case "win32": {
8+
return setupChocoPack("sccache", version)
9+
}
10+
case "linux":
11+
case "darwin": {
12+
return setupBrewPack("sccache", version)
13+
}
14+
default: {
15+
throw new Error(`Unsupported platform`)
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)