mirror of https://github.com/aminya/setup-cpp
feat: add ccache
This commit is contained in:
parent
a614cdbf27
commit
10883e7f0e
|
@ -22,6 +22,8 @@ The package will be usable from any environment (locally, GitHub Actions, etc).
|
||||||
- [x] setup python
|
- [x] setup python
|
||||||
- [x] setup msvc
|
- [x] setup msvc
|
||||||
- [x] setup cppcheck
|
- [x] setup cppcheck
|
||||||
|
- [x] setup doxygen
|
||||||
|
- [x] setup ccache
|
||||||
- [ ] setup gcc/mingw
|
- [ ] setup gcc/mingw
|
||||||
- [ ] setup OpenCppCoverage
|
- [ ] setup OpenCppCoverage
|
||||||
- [ ] setup doxygen
|
- [ ] setup doxygen
|
||||||
|
|
|
@ -33,6 +33,9 @@ inputs:
|
||||||
description: "The pyhon version to install."
|
description: "The pyhon version to install."
|
||||||
default: "3.x"
|
default: "3.x"
|
||||||
required: false
|
required: false
|
||||||
|
ccache:
|
||||||
|
description: "The ccache version to install."
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node12"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { setupCcache } from "../ccache"
|
||||||
|
import { spawnSync as spawn } from "child_process"
|
||||||
|
|
||||||
|
jest.setTimeout(200000)
|
||||||
|
describe("setup-ccache", () => {
|
||||||
|
it("should setup ccache", async () => {
|
||||||
|
await setupCcache()
|
||||||
|
|
||||||
|
const { status } = spawn("ccache", ["--version"], {
|
||||||
|
encoding: "utf8",
|
||||||
|
})
|
||||||
|
expect(status).toBe(0)
|
||||||
|
})
|
||||||
|
})
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
|
|
||||||
|
export function setupCcache(version?: string) {
|
||||||
|
switch (process.platform) {
|
||||||
|
case "win32": {
|
||||||
|
return setupChocoPack("ccache", version)
|
||||||
|
}
|
||||||
|
case "darwin": {
|
||||||
|
return setupBrewPack("ccache", version)
|
||||||
|
}
|
||||||
|
case "linux": {
|
||||||
|
return setupAptPack("ccache", version)
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
throw new Error(`Unsupported platform`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
import * as core from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
import { setupBrew } from "./brew/brew"
|
import { setupBrew } from "./brew/brew"
|
||||||
|
import { setupCcache } from "./ccache/ccache"
|
||||||
import { setupChocolatey } from "./chocolatey/chocolatey"
|
import { setupChocolatey } from "./chocolatey/chocolatey"
|
||||||
import { setupCmake } from "./cmake/cmake"
|
import { setupCmake } from "./cmake/cmake"
|
||||||
import { setupConan } from "./conan/conan"
|
import { setupConan } from "./conan/conan"
|
||||||
|
@ -76,6 +77,12 @@ export async function main(): Promise<number> {
|
||||||
await setupBrew()
|
await setupBrew()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup ccache
|
||||||
|
const ccacheVersion = maybeGetInput("ccache")
|
||||||
|
if (ccacheVersion !== undefined) {
|
||||||
|
await setupCcache(ccacheVersion)
|
||||||
|
}
|
||||||
|
|
||||||
// setup msvc
|
// setup msvc
|
||||||
const msvcVersion = maybeGetInput("msvc")
|
const msvcVersion = maybeGetInput("msvc")
|
||||||
if (msvcVersion !== undefined) {
|
if (msvcVersion !== undefined) {
|
||||||
|
|
Loading…
Reference in New Issue