Skip to content

Commit 454f319

Browse files
authored
Merge pull request #21 from aminya/make-task
2 parents 5c0c45d + eb3db26 commit 454f319

31 files changed

+260
-96
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ The package can be used locally or from CI services like GitHub Actions.
2323
- vcpkg
2424
- meson
2525
- conan
26+
- make
27+
- task
2628
- ccache
2729
- cppcheck
2830
- clangtidy

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ inputs:
3030
conan:
3131
description: "The conan version to install."
3232
required: false
33+
make:
34+
description: "The make version to install."
35+
required: false
36+
task:
37+
description: "The task version to install."
38+
required: false
3339
vcpkg:
3440
description: "The vcpkg version to install."
3541
required: false

dist/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/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/chocolatey/chocolatey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function setupChocolatey(
5656
if (maybeChoco !== null) {
5757
binDir = dirname(maybeChoco)
5858
} else {
59-
binDir = "C:/ProgramData/Chocolatey/bin/"
59+
binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
6060
}
6161

6262
if (existsSync(binDir)) {

src/cmake/__tests__/cmake.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { setupCmake } from "../cmake"
22
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
3+
import { isGitHubCI } from "../../utils/env/isci"
34

45
jest.setTimeout(300000)
56

@@ -10,14 +11,16 @@ describe("setup-cmake", () => {
1011
})
1112

1213
it("should setup CMake", async () => {
13-
const { binDir } = await setupCmake("3.20.2", directory, "")
14+
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
1415
await testBin("cmake", ["--version"], binDir)
1516
})
1617

1718
it("should find CMake in the cache", async () => {
18-
const { binDir } = await setupCmake("3.20.2", directory, "")
19+
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
1920
await testBin("cmake", ["--version"], binDir)
20-
expect(binDir.includes("ToolCache")).toBeTruthy()
21+
if (isGitHubCI()) {
22+
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
23+
}
2124
})
2225

2326
afterAll(async () => {

src/cmake/cmake.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { extractZip, extractTar } from "@actions/tool-cache"
2-
import { getInput } from "@actions/core"
32
import semverLte from "semver/functions/lte"
43
import semverCoerce from "semver/functions/coerce"
54
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
65
import { addBinExtension } from "../utils/extension/extension"
76

87
/** Get the platform data for cmake */
9-
function getCmakePackageInfo(version: string, platform?: NodeJS.Platform): PackageInfo {
8+
function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {
109
const semVersion = semverCoerce(version) ?? version
11-
const platformStr = platform ?? process.platform
12-
const arch = getInput("architecture") || process.arch
13-
switch (platformStr) {
10+
switch (platform) {
1411
case "win32": {
1512
const isOld = semverLte(semVersion, "v3.19.6")
1613
let osArchStr: string
@@ -58,12 +55,11 @@ function getCmakePackageInfo(version: string, platform?: NodeJS.Platform): Packa
5855
}
5956
}
6057
default:
61-
throw new Error(`Unsupported platform '${platformStr}'`)
58+
throw new Error(`Unsupported platform '${platform}'`)
6259
}
6360
}
6461

6562
/** Setup cmake */
66-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
67-
export function setupCmake(version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
68-
return setupBin("cmake", version, getCmakePackageInfo, setupDir)
63+
export function setupCmake(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
64+
return setupBin("cmake", version, getCmakePackageInfo, setupDir, arch)
6965
}

src/default_versions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const DefaultVersions: Record<string, string> = {
1111
meson: "0.61.1",
1212
python: "3.8.10",
1313
kcov: "v39",
14+
task: "3.10.0",
1415
gcc: process.platform === "win32" ? "11.2.0.07112021" : "11",
1516
}
1617

src/gcc/gcc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export async function setupGcc(version: string, _setupDir: string, arch: string)
2424
} else if (arch === "ia32" && existsSync("C:/tools/mingw32/bin")) {
2525
binDir = "C:/tools/mingw32/bin"
2626
addPath(binDir)
27-
} else if (existsSync("C:/ProgramData/Chocolatey/bin/g++.exe")) {
28-
binDir = "C:/ProgramData/Chocolatey/bin/"
27+
} else if (existsSync(`${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin/g++.exe`)) {
28+
binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
2929
}
3030
break
3131
}

src/kcov/__tests__/kcov.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("setup-Kcov", () => {
3131
// it("should find Kcov in the cache", async () => {
3232
// const directory = await setupTmpDir("kcov-v39")
3333
// const binDir = await testKcov("v39", directory)
34-
// expect(binDir.includes("ToolCache")).toBeTruthy()
34+
// expect(binDir.includes("hostedtoolcache")).toBeTruthy()
3535
// await cleanupTmpDir("kcov-v39")
3636
// })
3737
})

0 commit comments

Comments
 (0)