Merge pull request #153 from aminya/update [skip ci]

This commit is contained in:
Amin Yahyaabadi 2022-12-06 23:34:51 -08:00 committed by GitHub
commit 0c6518425e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 74 additions and 72 deletions

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

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

@ -48,9 +48,9 @@ describe("getVersion", () => {
it("llvm", () => {
expect(getVersion("llvm", "13.0.0")).toBe("13.0.0")
if (process.platform === "linux") {
expect(getVersion("llvm", "true", [20, 4])).toBe("13.0.0-ubuntu-20.04")
expect(getVersion("llvm", "true", [18, 4])).toBe("13.0.1-ubuntu-18.04")
expect(getVersion("llvm", "true", [16, 4])).toBe("13.0.0-ubuntu-16.04")
expect(getVersion("llvm", "true", [20, 4])).toBe("15.0.6-ubuntu-18.04")
expect(getVersion("llvm", "true", [18, 4])).toBe("15.0.6-ubuntu-18.04")
expect(getVersion("llvm", "true", [16, 4])).toBe("15.0.6-ubuntu-18.04")
}
})
})

View File

@ -124,26 +124,6 @@ describe("setup-llvm", () => {
await testBin("clang-format", ["--version"], binDir)
})
it("should setup LLVM 15.0.2", async () => {
await io.rmRF(directory)
await io.rmRF("/Users/runner/hostedtoolcache/llvm")
const { binDir } = await setupLLVM("15.0.2", directory, process.arch)
await testBin("clang++", ["--version"], binDir)
expect(process.env.CC?.includes("clang")).toBeTruthy()
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
// test compilation
const file = path.join(__dirname, "main.cpp")
const main_exe = path.join(__dirname, addExeExt("main"))
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
if (process.platform !== "win32") {
chmodSync(main_exe, "755")
}
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
})
afterAll(async () => {
await io.rmRF(directory)
}, 100000)

View File

@ -57,10 +57,17 @@ export const VERSIONS: Set<string> = getVersions([
"15.0.0",
"15.0.1",
"15.0.2",
"15.0.3",
"15.0.4",
"15.0.5",
"15.0.6",
])
/** The LLVM versions that were never released for the Windows platform. */
const WIN32_MISSING: Set<string> = new Set(["10.0.1", "15.0.5", "15.0.6"])
/** The LLVM versions that were never released for the Darwin platform. */
const DARWIN_MISSING: Set<string> = new Set([
const DARWIN_MISSING = new Set([
"3.5.1",
"3.6.1",
"3.6.2",
@ -74,6 +81,9 @@ const DARWIN_MISSING: Set<string> = new Set([
"11.0.1",
"11.1.0",
"12.0.1",
"15.0.4",
"15.0.5",
"15.0.6",
])
/**
@ -129,10 +139,12 @@ const UBUNTU_SUFFIX_MAP: { [key: string]: string } = {
"14.0.0": "-ubuntu-18.04",
// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
"15.0.2": "-rhel86",
"15.0.5": "-ubuntu-18.04",
"15.0.6": "-ubuntu-18.04",
}
/** The latest supported LLVM version for the Linux (Ubuntu) platform. */
const MAX_UBUNTU: string = "15.0.2"
const MAX_UBUNTU: string = "15.0.6"
//================================================
// URL
@ -210,9 +222,6 @@ export function getLinuxUrl(versionGiven: string): string {
}
}
/** The LLVM versions that were never released for the Windows platform. */
const WIN32_MISSING: Set<string> = new Set(["10.0.1"])
/** Gets an LLVM download URL for the Windows platform. */
async function getWin32Url(version: string): Promise<string | null> {
if (WIN32_MISSING.has(version)) {

View File

@ -1,7 +1,7 @@
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
import { info } from "@actions/core"
import { addPath } from "../env/addEnv"
import { join } from "patha"
import { info } from "ci-log"
import { tmpdir } from "os"
import ciDetect from "@npmcli/ci-detect"
@ -89,11 +89,13 @@ export async function setupBin(
// download ane extract the package into the installation directory.
if ((await Promise.all([pathExists(binDir), pathExists(binFile)])).includes(false)) {
info(`Download and extract ${name} ${version}`)
try {
info(`Download ${name} ${version}`)
const downloaded = await downloadTool(url)
if (!didInit) {
info(`Installing extraction dependencies`)
if (process.platform === "linux") {
// extraction dependencies
if (isArch()) {
setupPacmanPack("unzip")
setupPacmanPack("tar")
@ -110,8 +112,7 @@ export async function setupBin(
didInit = true
}
try {
const downloaded = await downloadTool(url)
info(`Extracting ${downloaded} to ${setupDir}`)
await extractFunction?.(downloaded, setupDir)
// if (typeof extractedBinDir === "string") {
// binDir = extractedBinDir

View File

@ -3,10 +3,22 @@ import { isArch } from "../utils/env/isArch"
// passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager.
// the directly downloaded tools require a given version ("" doesn't work).
function getLLVMDefault() {
switch (process.platform) {
case "linux":
// used for non-ubuntu (Fedora, Arch)
return "15.0.6-ubuntu-18.04"
case "darwin":
return "15.0.3"
default:
return "15.0.4"
}
}
export 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: getLLVMDefault(), // https://github.com/llvm/llvm-project/releases
clangtidy: getLLVMDefault(),
clangformat: getLLVMDefault(),
ninja: "1.11.1", // https://github.com/ninja-build/ninja/releases
cmake: "3.25.0", // https://github.com/Kitware/CMake/releases
gcovr: "5.2", // https://pypi.org/project/gcovr/
@ -30,24 +42,24 @@ export const DefaultLinuxVersion: Record<string, Record<number, string>> = {
14: "11",
},
llvm: {
22: "13.0.0-ubuntu-20.04",
20: "13.0.0-ubuntu-20.04",
18: "13.0.1-ubuntu-18.04",
16: "13.0.0-ubuntu-16.04",
22: "15.0.6-ubuntu-18.04",
20: "15.0.6-ubuntu-18.04",
18: "15.0.6-ubuntu-18.04",
16: "15.0.6-ubuntu-18.04",
14: "13.0.0-ubuntu-16.04",
},
clangtidy: {
22: "13.0.0-ubuntu-20.04",
20: "13.0.0-ubuntu-20.04",
18: "13.0.1-ubuntu-18.04",
16: "13.0.0-ubuntu-16.04",
22: "15.0.6-ubuntu-18.04",
20: "15.0.6-ubuntu-18.04",
18: "15.0.6-ubuntu-18.04",
16: "15.0.6-ubuntu-18.04",
14: "13.0.0-ubuntu-16.04",
},
clangformat: {
22: "13.0.0-ubuntu-20.04",
20: "13.0.0-ubuntu-20.04",
18: "13.0.1-ubuntu-18.04",
16: "13.0.0-ubuntu-16.04",
22: "15.0.6-ubuntu-18.04",
20: "15.0.6-ubuntu-18.04",
18: "15.0.6-ubuntu-18.04",
16: "15.0.6-ubuntu-18.04",
14: "13.0.0-ubuntu-16.04",
},
gcovr: {