Skip to content

Commit

Permalink
Merge pull request #49 from aminya/defaults [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Apr 16, 2022
2 parents f97db97 + d10c4e9 commit fd6d2a6
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/cmake/__tests__/cmake.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { setupCmake } from "../cmake"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { isGitHubCI } from "../../utils/env/isci"
import { getVersion } from "../../default_versions"

jest.setTimeout(300000)

Expand All @@ -11,12 +12,12 @@ describe("setup-cmake", () => {
})

it("should setup CMake", async () => {
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
const { binDir } = await setupCmake(getVersion("cmake", "true"), directory, process.arch)
await testBin("cmake", ["--version"], binDir)
})

it("should find CMake in the cache", async () => {
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
const { binDir } = await setupCmake(getVersion("cmake", "true"), directory, process.arch)
await testBin("cmake", ["--version"], binDir)
if (isGitHubCI()) {
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
Expand Down
3 changes: 2 additions & 1 deletion src/conan/__tests__/conan.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { setupConan } from "../conan"
import { testBin } from "../../utils/tests/test-helpers"
import { getVersion } from "../../default_versions"

jest.setTimeout(300000)
describe("setup-conan", () => {
it("should setup conan", async () => {
const installInfo = await setupConan("", "", process.arch)
const installInfo = await setupConan(getVersion("conan", "true"), "", process.arch)

await testBin("conan", ["--version"], installInfo.binDir)
})
Expand Down
18 changes: 9 additions & 9 deletions src/default_versions.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const DefaultVersions: Record<string, string> = {
llvm: "13.0.0", // https://github.com/llvm/llvm-project/releases
clangtidy: "13.0.0",
clangformat: "13.0.0",
llvm: "14.0.0", // https://github.com/llvm/llvm-project/releases
clangtidy: "14.0.0",
clangformat: "14.0.0",
ninja: "1.10.2", // https://github.com/ninja-build/ninja/releases
cmake: "3.22.2", // https://github.com/Kitware/CMake/releases
cmake: "3.23.1", // https://github.com/Kitware/CMake/releases
gcovr: "5.0", // https://pypi.org/project/gcovr/
conan: "1.45.0", // https://github.com/conan-io/conan/releases
meson: "0.61.2", // https://github.com/mesonbuild/meson/releases
conan: "1.47.0", // https://github.com/conan-io/conan/releases
meson: "0.61.4", // https://github.com/mesonbuild/meson/releases
python: "3.8.10",
kcov: "39", // https://github.com/SimonKagstrom/kcov/releases
task: "3.11.0", // https://github.com/go-task/task/releases
kcov: "40", // https://github.com/SimonKagstrom/kcov/releases
task: "3.12.0", // https://github.com/go-task/task/releases
doxygen: "1.9.1", // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=doxygen
gcc: process.platform === "win32" ? "11.2.0.07112021" : "11",
gcc: process.platform === "win32" ? "11.2.0.07112021" : "11", // https://community.chocolatey.org/packages/mingw#versionhistory and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
}

/** Get the default version if passed true or undefined, otherwise return the version itself */
Expand Down
3 changes: 2 additions & 1 deletion src/gcovr/__tests__/gcovr.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { setupGcovr } from "../gcovr"
import { testBin } from "../../utils/tests/test-helpers"
import { getVersion } from "../../default_versions"

jest.setTimeout(300000)
describe("setup-gcovr", () => {
it("should setup gcovr", async () => {
const installInfo = await setupGcovr("", "", process.arch)
const installInfo = await setupGcovr(getVersion("gcovr", "true"), "", process.arch)
await testBin("gcovr", ["--version"], installInfo.binDir)
})
})
14 changes: 7 additions & 7 deletions src/kcov/__tests__/kcov.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ describe("setup-Kcov", () => {
return
}

let directory: string
beforeAll(async () => {
directory = await setupTmpDir("kcov-v39")
it("should setup Kcov v40", async () => {
const directory = await setupTmpDir("kcov-v40")
const { binDir } = (await setupKcov("40", directory, "")) as InstallationInfo
await testBin("kcov", ["--version"], binDir)
await cleanupTmpDir("kcov-v40")
})

it("should setup Kcov v39", async () => {
const directory = await setupTmpDir("kcov-v39")
const { binDir } = (await setupKcov("39", directory, "")) as InstallationInfo
await testBin("kcov", ["--version"], binDir)
await cleanupTmpDir("kcov-v39")
})

// it("should find Kcov in the cache", async () => {
Expand All @@ -44,8 +48,4 @@ describe("setup-Kcov", () => {
console.warn(err)
}
})

afterAll(async () => {
await cleanupTmpDir("kcov-v38")
})
})
8 changes: 5 additions & 3 deletions src/llvm/__tests__/llvm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import execa from "execa"
import path from "path"
import { addBinExtension } from "../../utils/extension/extension"
import { chmodSync } from "fs"
import { getVersion } from "../../default_versions"

jest.setTimeout(400000)
async function testUrl(version: string) {
Expand All @@ -26,6 +27,7 @@ describe("setup-llvm", () => {
it("Finds valid LLVM URLs", async () => {
await Promise.all(
[
// "14.0.1", fails on ubuntu
"14.0.0",
"13.0.0",
"12.0.0",
Expand All @@ -49,7 +51,7 @@ describe("setup-llvm", () => {
})

it("should setup LLVM", async () => {
const { binDir } = await setupLLVM("13.0.0", directory, process.arch)
const { binDir } = await setupLLVM(getVersion("llvm", "true"), directory, process.arch)
await testBin("clang++", ["--version"], binDir)

expect(process.env.CC?.includes("clang")).toBeTruthy()
Expand All @@ -66,7 +68,7 @@ describe("setup-llvm", () => {
})

it("should find llvm in the cache", async () => {
const { binDir } = await setupLLVM("13.0.0", directory, process.arch)
const { binDir } = await setupLLVM(getVersion("llvm", "true"), directory, process.arch)
await testBin("clang++", ["--version"], binDir)

if (isGitHubCI()) {
Expand All @@ -83,7 +85,7 @@ describe("setup-llvm", () => {
})

it("should setup clang-tidy and clang-format", async () => {
const { binDir } = await setupClangTools("13.0.0", directory, process.arch)
const { binDir } = await setupClangTools(getVersion("llvm", "true"), directory, process.arch)
await testBin("clang-tidy", ["--version"], binDir)
await testBin("clang-format", ["--version"], binDir)
})
Expand Down
8 changes: 7 additions & 1 deletion src/llvm/llvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const VERSIONS: Set<string> = getVersions([
"13.0.0",
"13.0.1",
"14.0.0",
"14.0.1",
])

//================================================
Expand Down Expand Up @@ -116,7 +117,11 @@ function getDarwinUrl(version: string): string | null {
*/
const UBUNTU_RC: Map<string, string> = new Map()

/** The (latest) Ubuntu versions for each LLVM version. */
/**
* The (latest) Ubuntu versions for each LLVM version.
*
* https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.1 or https://releases.llvm.org/14.0.1
*/
const UBUNTU: { [key: string]: string } = {
"3.5.0": "-ubuntu-14.04",
"3.5.1": "",
Expand Down Expand Up @@ -152,6 +157,7 @@ const UBUNTU: { [key: string]: string } = {
"13.0.0": "-ubuntu-20.04",
"13.0.1": "-ubuntu-18.04",
"14.0.0": "-ubuntu-18.04",
// "14.0.1": "-ubuntu-18.04",
}

/** The latest supported LLVM version for the Linux (Ubuntu) platform. */
Expand Down
3 changes: 2 additions & 1 deletion src/meson/__tests__/meson.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { setupMeson } from "../meson"
import { testBin } from "../../utils/tests/test-helpers"
import { getVersion } from "../../default_versions"

jest.setTimeout(300000)
describe("setup-meson", () => {
it("should setup meson", async () => {
const installInfo = await setupMeson("", "", process.arch)
const installInfo = await setupMeson(getVersion("meson", "true"), "", process.arch)

await testBin("meson", ["--version"], installInfo.binDir)
})
Expand Down
3 changes: 2 additions & 1 deletion src/ninja/__tests__/ninja.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { setupNinja } from "../ninja"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { isGitHubCI } from "../../utils/env/isci"
import { getVersion } from "../../default_versions"

jest.setTimeout(300000)
async function testNinja(directory: string) {
const { binDir } = await setupNinja("1.10.2", directory, process.arch)
const { binDir } = await setupNinja(getVersion("ninja", "true"), directory, process.arch)
await testBin("ninja", ["--version"], binDir)
return binDir
}
Expand Down
5 changes: 3 additions & 2 deletions src/task/__tests__/task.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { setupTask } from "../task"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { isGitHubCI } from "../../utils/env/isci"
import { getVersion } from "../../default_versions"

jest.setTimeout(300000)
describe("setup-task", () => {
Expand All @@ -10,13 +11,13 @@ describe("setup-task", () => {
})

it("should setup task", async () => {
const { binDir } = await setupTask("3.10.0", directory, process.arch)
const { binDir } = await setupTask(getVersion("task", "true"), directory, process.arch)

await testBin("task", ["--version"], binDir)
})

it("should find task in the cache", async () => {
const { binDir } = await setupTask("3.10.0", directory, process.arch)
const { binDir } = await setupTask(getVersion("task", "true"), directory, process.arch)
if (isGitHubCI()) {
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
}
Expand Down

0 comments on commit fd6d2a6

Please sign in to comment.