mirror of https://github.com/aminya/setup-cpp
fix: add biome linter + fix the issues
This commit is contained in:
parent
34bb783813
commit
4ab758d47f
|
@ -1,3 +1,8 @@
|
||||||
{
|
{
|
||||||
"recommendations": ["orta.vscode-jest", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
|
"recommendations": [
|
||||||
|
"orta.vscode-jest",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"biomejs.biome"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
||||||
|
"files": {
|
||||||
|
"ignore": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/.pnpm-store/**",
|
||||||
|
"**/dist/**",
|
||||||
|
"dev/cpp_vcpkg_project/**/*",
|
||||||
|
"**/.venv/",
|
||||||
|
"**/.*cache/"
|
||||||
|
],
|
||||||
|
"ignoreUnknown": true
|
||||||
|
},
|
||||||
|
"organizeImports": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"linter": {
|
||||||
|
"enabled": true,
|
||||||
|
"rules": {
|
||||||
|
"recommended": true,
|
||||||
|
"style": {
|
||||||
|
"noInferrableTypes": "off",
|
||||||
|
"noUselessElse": "off",
|
||||||
|
"noNonNullAssertion": "off",
|
||||||
|
"useNodejsImportProtocol": "off"
|
||||||
|
},
|
||||||
|
"complexity": {
|
||||||
|
"useLiteralKeys": "off"
|
||||||
|
},
|
||||||
|
"suspicious": {
|
||||||
|
"noConfusingVoidType": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"formatter": {
|
||||||
|
"enabled": false,
|
||||||
|
"indentWidth": 4,
|
||||||
|
"indentStyle": "space"
|
||||||
|
},
|
||||||
|
"json": {
|
||||||
|
"formatter": {
|
||||||
|
"enabled": false,
|
||||||
|
"trailingCommas": "none"
|
||||||
|
},
|
||||||
|
"parser": {
|
||||||
|
"allowComments": true,
|
||||||
|
"allowTrailingCommas": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,8 @@ words:
|
||||||
- hadolint
|
- hadolint
|
||||||
- aminya
|
- aminya
|
||||||
- applellvm
|
- applellvm
|
||||||
|
- biome
|
||||||
|
- biomejs
|
||||||
- bazel
|
- bazel
|
||||||
- bazelisk
|
- bazelisk
|
||||||
- buildtools
|
- buildtools
|
||||||
|
|
|
@ -34,7 +34,7 @@ function main() {
|
||||||
`./exe/setup-cpp-${process.arch}-${getPlatformName()}${exe}`,
|
`./exe/setup-cpp-${process.arch}-${getPlatformName()}${exe}`,
|
||||||
"--",
|
"--",
|
||||||
`{{caxa}}/node_modules/.bin/node${exe}`,
|
`{{caxa}}/node_modules/.bin/node${exe}`,
|
||||||
`{{caxa}}/setup-cpp.js`,
|
"{{caxa}}/setup-cpp.js",
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
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
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
|
@ -7,7 +7,9 @@
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"semiColons": "asi",
|
"semiColons": "asi",
|
||||||
"quoteProps": "asNeeded",
|
"quoteProps": "asNeeded",
|
||||||
"useBraces": "always"
|
"useBraces": "always",
|
||||||
|
"module.sortImportDeclarations": "maintain",
|
||||||
|
"importDeclaration.sortNamedImports": "maintain"
|
||||||
},
|
},
|
||||||
"json": {},
|
"json": {},
|
||||||
"markdown": {},
|
"markdown": {},
|
||||||
|
|
|
@ -39,15 +39,17 @@
|
||||||
"dev": "cross-env NODE_ENV=development parcel watch",
|
"dev": "cross-env NODE_ENV=development parcel watch",
|
||||||
"docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
|
"docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
|
||||||
"format": "run-s lint.dprint",
|
"format": "run-s lint.dprint",
|
||||||
"lint": "run-p --aggregate-output --continue-on-error lint.cspell lint.eslint lint.dprint lint.tsc",
|
"lint": "run-p --aggregate-output --continue-on-error lint.cspell lint.eslint lint.dprint lint.tsc lint.biome",
|
||||||
"lint.cspell": "cspell lint --no-progress --show-suggestions --cache --cache-location ./.cache/cspell/.cspellcache",
|
"lint.cspell": "cspell lint --no-progress --show-suggestions --cache --cache-location ./.cache/cspell/.cspellcache",
|
||||||
"lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
"lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||||
|
"lint.biome": "biome check --write --unsafe",
|
||||||
"lint.dprint": "dprint fmt",
|
"lint.dprint": "dprint fmt",
|
||||||
"lint.tsc": "tsc --noEmit",
|
"lint.tsc": "tsc --noEmit --pretty",
|
||||||
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.mjs",
|
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.mjs",
|
||||||
"prepublishOnly": "rm ./dist/tsconfig.tsbuildinfo",
|
"prepublishOnly": "rm ./dist/tsconfig.tsbuildinfo",
|
||||||
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.dprint lint.tsc",
|
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.dprint lint.tsc test.lint.biome",
|
||||||
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
||||||
|
"test.lint.biome": "biome check",
|
||||||
"test.lint.dprint": "dprint check",
|
"test.lint.dprint": "dprint check",
|
||||||
"test": "jest --runInBand --forceExit --coverage",
|
"test": "jest --runInBand --forceExit --coverage",
|
||||||
"build.docker-ci": "node ./dev/docker/ci/docker-ci.mjs"
|
"build.docker-ci": "node ./dev/docker/ci/docker-ci.mjs"
|
||||||
|
@ -58,6 +60,7 @@
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/io": "^1.1.3",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"@babel/cli": "^7.24.1",
|
"@babel/cli": "^7.24.1",
|
||||||
|
"@biomejs/biome": "^1.8.3",
|
||||||
"@shockpkg/archive-files": "github:aminya/archive-files#54ec59fad46aca736ac6feb6c7bb526528141b9d",
|
"@shockpkg/archive-files": "github:aminya/archive-files#54ec59fad46aca736ac6feb6c7bb526528141b9d",
|
||||||
"@swc/jest": "^0.2.36",
|
"@swc/jest": "^0.2.36",
|
||||||
"@types/cross-spawn": "^6.0.6",
|
"@types/cross-spawn": "^6.0.6",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { isSudo } from "admina"
|
|
||||||
import { homedir } from "os"
|
import { homedir } from "os"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
|
import { isSudo } from "admina"
|
||||||
|
|
||||||
export function userHomeDir() {
|
export function userHomeDir() {
|
||||||
if (isSudo() && typeof process.env.SUDO_USER === "string" && process.env.SUDO_USER !== "") {
|
if (isSudo() && typeof process.env.SUDO_USER === "string" && process.env.SUDO_USER !== "") {
|
||||||
|
|
13352
pnpm-lock.yaml
13352
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
import { parseArgs } from "../cli-options"
|
import { parseArgs } from "../cli-options"
|
||||||
import { getCompilerInfo } from "../compilers"
|
import { getCompilerInfo } from "../compilers"
|
||||||
import { Inputs } from "../tool"
|
import type { Inputs } from "../tool"
|
||||||
import { DefaultLinuxVersion } from "../versions/default_versions"
|
import { DefaultLinuxVersion } from "../versions/default_versions"
|
||||||
import { getVersion, syncVersions } from "../versions/versions"
|
import { getVersion, syncVersions } from "../versions/versions"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupBazel } from "../bazel"
|
import { setupBazel } from "../bazel"
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@ export async function setupBazel(version: string, _setupDir: string, _arch: stri
|
||||||
])
|
])
|
||||||
return setupAptPack([{ name: "bazel", version }], true)
|
return setupAptPack([{ name: "bazel", version }], true)
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { tmpdir } from "os"
|
||||||
|
import path, { join } from "path"
|
||||||
import { mkdirP } from "@actions/io"
|
import { mkdirP } from "@actions/io"
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import { readFile } from "fs/promises"
|
import { readFile } from "fs/promises"
|
||||||
import { tmpdir } from "os"
|
|
||||||
import path, { join } from "path"
|
|
||||||
import { dirname } from "patha"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupCcache } from "../ccache"
|
import { setupCcache } from "../ccache"
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ export function setupCcache(version: string, _setupDir: string, _arch: string) {
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
return setupAptPack([{ name: "ccache", version }])
|
return setupAptPack([{ name: "ccache", version }])
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupChocolatey } from "../chocolatey"
|
import { setupChocolatey } from "../chocolatey"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { pathExists } from "path-exists"
|
||||||
import { dirname } from "patha"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import type { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
let binDir: string | undefined
|
let binDir: string | undefined
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getInput } from "@actions/core"
|
import { getInput } from "@actions/core"
|
||||||
import { info } from "ci-log"
|
import { info } from "ci-log"
|
||||||
import mri from "mri"
|
import mri from "mri"
|
||||||
import { Inputs, inputs } from "./tool"
|
import { type Inputs, inputs } from "./tool"
|
||||||
import { InstallationInfo } from "./utils/setup/setupBin"
|
import type { InstallationInfo } from "./utils/setup/setupBin"
|
||||||
|
|
||||||
export function parseArgs(args: string[]): Opts {
|
export function parseArgs(args: string[]): Opts {
|
||||||
return mri<Record<Inputs, string | undefined> & { help: boolean }>(args, {
|
return mri<Record<Inputs, string | undefined> & { help: boolean }>(args, {
|
||||||
|
@ -31,13 +31,13 @@ All the available tools:
|
||||||
|
|
||||||
console.table(
|
console.table(
|
||||||
{
|
{
|
||||||
"compiler and analyzer": { tools: `--llvm, --gcc, --msvc, --vcvarsall, --cppcheck, --clangtidy, --clangformat` },
|
"compiler and analyzer": { tools: "--llvm, --gcc, --msvc, --vcvarsall, --cppcheck, --clangtidy, --clangformat" },
|
||||||
"build system": { tools: `--cmake, --ninja, --meson, --make, --task, --bazel` },
|
"build system": { tools: "--cmake, --ninja, --meson, --make, --task, --bazel" },
|
||||||
"package manager": { tools: `--vcpkg, --conan, --choco, --brew, --nala` },
|
"package manager": { tools: "--vcpkg, --conan, --choco, --brew, --nala" },
|
||||||
cache: { tools: `--cppcache, --sccache` },
|
cache: { tools: "--cppcache, --sccache" },
|
||||||
documentation: { tools: `--doxygen, --graphviz` },
|
documentation: { tools: "--doxygen, --graphviz" },
|
||||||
coverage: { tools: `--gcovr, --opencppcoverage, --kcov` },
|
coverage: { tools: "--gcovr, --opencppcoverage, --kcov" },
|
||||||
other: { tools: `--python, --powershell, --sevenzip` },
|
other: { tools: "--python, --powershell, --sevenzip" },
|
||||||
},
|
},
|
||||||
["tools"],
|
["tools"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { addExeExt } from "patha"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
import semverLte from "semver/functions/lte"
|
import semverLte from "semver/functions/lte"
|
||||||
import { extractZip } from "../utils/setup/extract"
|
import { extractZip } from "../utils/setup/extract"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
/** Get the platform data for cmake */
|
/** Get the platform data for cmake */
|
||||||
function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {
|
function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { join } from "path"
|
||||||
import { endGroup, notice, startGroup } from "@actions/core"
|
import { endGroup, notice, startGroup } from "@actions/core"
|
||||||
import { error, info } from "ci-log"
|
import { error, info } from "ci-log"
|
||||||
import { join } from "path"
|
|
||||||
import semverValid from "semver/functions/valid"
|
import semverValid from "semver/functions/valid"
|
||||||
import { getSuccessMessage } from "./cli-options"
|
import { getSuccessMessage } from "./cli-options"
|
||||||
import { setupGcc, setupMingw } from "./gcc/gcc"
|
import { setupGcc, setupMingw } from "./gcc/gcc"
|
||||||
|
|
|
@ -27,10 +27,10 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
return setupAptPack([{ name: "cppcheck", version }])
|
return setupAptPack([{ name: "cppcheck", version }])
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { macosVersion } from "../../utils/env/macos_version"
|
import { macosVersion } from "../../utils/env/macos_version"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
import { setupDoxygen } from "../doxygen"
|
import { setupDoxygen } from "../doxygen"
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { setupGraphviz } from "../graphviz/graphviz"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { extractTar, extractZip } from "../utils/setup/extract"
|
import { extractTar, extractZip } from "../utils/setup/extract"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
|
@ -98,7 +98,7 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
installationInfo = await setupAptPack([{ name: "doxygen", version }])
|
installationInfo = await setupAptPack([{ name: "doxygen", version }])
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unsupported linux distributions`)
|
throw new Error("Unsupported linux distributions")
|
||||||
}
|
}
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
try {
|
try {
|
||||||
|
@ -114,13 +114,13 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
||||||
installationInfo = await setupAptPack([{ name: "doxygen" }])
|
installationInfo = await setupAptPack([{ name: "doxygen" }])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unsupported linux distributions`)
|
throw new Error("Unsupported linux distributions")
|
||||||
}
|
}
|
||||||
await setupGraphviz(getVersion("graphviz", undefined, await ubuntuVersion()), "", arch)
|
await setupGraphviz(getVersion("graphviz", undefined, await ubuntuVersion()), "", arch)
|
||||||
return installationInfo
|
return installationInfo
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ async function activateWinDoxygen() {
|
||||||
throw new Error("Failed to find doxygen binary")
|
throw new Error("Failed to find doxygen binary")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { addEnv, addPath } from "../utils/env/addEnv"
|
||||||
|
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { ExecaReturnValue } from "execa"
|
import type { ExecaReturnValue } from "execa"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { addExeExt, join } from "patha"
|
import { addExeExt, join } from "patha"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
|
@ -13,7 +13,7 @@ import { isArch } from "../utils/env/isArch"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { extract7Zip } from "../utils/setup/extract"
|
import { extract7Zip } from "../utils/setup/extract"
|
||||||
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { macosVersion } from "../../utils/env/macos_version"
|
import { macosVersion } from "../../utils/env/macos_version"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
import { setupGraphviz } from "../graphviz"
|
import { setupGraphviz } from "../graphviz"
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import type { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
|
@ -27,10 +27,10 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
return setupAptPack([{ name: "graphviz", version }])
|
return setupAptPack([{ name: "graphviz", version }])
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ async function activateGraphviz(): Promise<InstallationInfo> {
|
||||||
return { binDir }
|
return { binDir }
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ import { error } from "ci-log"
|
||||||
import pTimeout from "p-timeout"
|
import pTimeout from "p-timeout"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
import { getSuccessMessage } from "./cli-options"
|
import { getSuccessMessage } from "./cli-options"
|
||||||
import { setups, ToolName } from "./tool"
|
import { type ToolName, setups } from "./tool"
|
||||||
import { InstallationInfo } from "./utils/setup/setupBin"
|
import type { InstallationInfo } from "./utils/setup/setupBin"
|
||||||
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
|
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
|
||||||
import { getVersion } from "./versions/versions"
|
import { getVersion } from "./versions/versions"
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export async function installTool(
|
||||||
startGroup(`Installing ${tool} ${version}`)
|
startGroup(`Installing ${tool} ${version}`)
|
||||||
let hasLLVM = false
|
let hasLLVM = false
|
||||||
try {
|
try {
|
||||||
hasLLVM = await pTimeout(installToolImpl(tool, version, osVersion, arch, hasLLVM, setupCppDir, successMessages), {
|
hasLLVM = await pTimeout(installToolImpl(tool, version, osVersion, arch, setupCppDir, successMessages), {
|
||||||
milliseconds: timeout,
|
milliseconds: timeout,
|
||||||
message: `Timeout while installing ${tool} ${version}. You can increase the timeout from options`,
|
message: `Timeout while installing ${tool} ${version}. You can increase the timeout from options`,
|
||||||
})
|
})
|
||||||
|
@ -41,10 +41,12 @@ async function installToolImpl(
|
||||||
version: string,
|
version: string,
|
||||||
osVersion: number[] | null,
|
osVersion: number[] | null,
|
||||||
arch: string,
|
arch: string,
|
||||||
hasLLVM: boolean,
|
|
||||||
setupCppDir: string,
|
setupCppDir: string,
|
||||||
successMessages: string[],
|
successMessages: string[],
|
||||||
) {
|
) {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
const hasLLVM = ["llvm", "clangformat", "clangtidy"].includes(tool)
|
||||||
|
|
||||||
let installationInfo: InstallationInfo | undefined | void
|
let installationInfo: InstallationInfo | undefined | void
|
||||||
if (tool === "vcvarsall") {
|
if (tool === "vcvarsall") {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
@ -53,9 +55,6 @@ async function installToolImpl(
|
||||||
// get the setup function
|
// get the setup function
|
||||||
const setupFunction = setups[tool]
|
const setupFunction = setups[tool]
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
hasLLVM = ["llvm", "clangformat", "clangtidy"].includes(tool)
|
|
||||||
|
|
||||||
// the tool installation directory (for the functions that ue it)
|
// the tool installation directory (for the functions that ue it)
|
||||||
const setupDir = join(setupCppDir, hasLLVM ? "llvm" : tool)
|
const setupDir = join(setupCppDir, hasLLVM ? "llvm" : tool)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupKcov } from "../kcov"
|
import { setupKcov } from "../kcov"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
||||||
import { extractTarByExe } from "../utils/setup/extract"
|
import { extractTarByExe } from "../utils/setup/extract"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
import { addVPrefix, removeVPrefix } from "../utils/setup/version"
|
import { addVPrefix, removeVPrefix } from "../utils/setup/version"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||||
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
import { setupClangFormat, setupClangTools, setupLLVM } from "../llvm"
|
import { setupClangFormat, setupClangTools, setupLLVM } from "../llvm"
|
||||||
import { getLinuxUrl, getUrl, VERSIONS } from "../llvm_url"
|
import { VERSIONS, getLinuxUrl, getUrl } from "../llvm_url"
|
||||||
|
|
||||||
jest.setTimeout(400000)
|
jest.setTimeout(400000)
|
||||||
async function testUrl(version: string) {
|
async function testUrl(version: string) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
import { delimiter } from "path"
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import memoize from "micro-memoize"
|
import memoize from "micro-memoize"
|
||||||
import { delimiter } from "path"
|
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { addExeExt, join } from "patha"
|
import { addExeExt, join } from "patha"
|
||||||
import { setupGcc } from "../gcc/gcc"
|
import { setupGcc } from "../gcc/gcc"
|
||||||
|
@ -10,7 +10,7 @@ import { addEnv } from "../utils/env/addEnv"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
||||||
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { semverCoerceIfInvalid } from "../utils/setup/version"
|
import { semverCoerceIfInvalid } from "../utils/setup/version"
|
||||||
import { getVersion } from "../versions/versions"
|
import { getVersion } from "../versions/versions"
|
||||||
import { LLVMPackages, setupLLVMApt } from "./llvm_installer"
|
import { LLVMPackages, setupLLVMApt } from "./llvm_installer"
|
||||||
|
@ -55,7 +55,7 @@ async function setupLLVMOnly(
|
||||||
packages: LLVMPackages = LLVMPackages.All,
|
packages: LLVMPackages = LLVMPackages.All,
|
||||||
) {
|
) {
|
||||||
const coeredVersion = semverCoerceIfInvalid(version)
|
const coeredVersion = semverCoerceIfInvalid(version)
|
||||||
const majorVersion = parseInt(coeredVersion.split(".")[0], 10)
|
const majorVersion = Number.parseInt(coeredVersion.split(".")[0], 10)
|
||||||
try {
|
try {
|
||||||
if (isUbuntu()) {
|
if (isUbuntu()) {
|
||||||
return await setupLLVMApt(majorVersion, packages)
|
return await setupLLVMApt(majorVersion, packages)
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { execRoot } from "admina"
|
|
||||||
import { info } from "console"
|
import { info } from "console"
|
||||||
|
import { execRoot } from "admina"
|
||||||
import { execa } from "execa"
|
import { execa } from "execa"
|
||||||
import { chmod, readFile, writeFile } from "fs/promises"
|
import { chmod, readFile, writeFile } from "fs/promises"
|
||||||
import { DEFAULT_TIMEOUT } from "../installTool"
|
import { DEFAULT_TIMEOUT } from "../installTool"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { hasNala, isPackageInstalled, setupAptPack } from "../utils/setup/setupAptPack"
|
import { hasNala, isPackageInstalled, setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import type { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
export enum LLVMPackages {
|
export enum LLVMPackages {
|
||||||
All,
|
All = 0,
|
||||||
ClangFormat,
|
ClangFormat = 1,
|
||||||
Core,
|
Core = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setupLLVMApt(
|
export async function setupLLVMApt(
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { isUrlOnline } from "is-url-online"
|
||||||
import { addExeExt } from "patha"
|
import { addExeExt } from "patha"
|
||||||
import semverLte from "semver/functions/lte"
|
import semverLte from "semver/functions/lte"
|
||||||
import { extractExe, extractTarByExe } from "../utils/setup/extract"
|
import { extractExe, extractTarByExe } from "../utils/setup/extract"
|
||||||
import { PackageInfo } from "../utils/setup/setupBin"
|
import type { PackageInfo } from "../utils/setup/setupBin"
|
||||||
import { getSpecificVersionAndUrl, getSpecificVersions, getVersions } from "../utils/setup/version"
|
import { getSpecificVersionAndUrl, getSpecificVersions, getVersions } from "../utils/setup/version"
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -10,7 +10,7 @@ export async function setupMacOSSDK() {
|
||||||
if (sdkroot) {
|
if (sdkroot) {
|
||||||
await addEnv("SDKROOT", sdkroot.trim())
|
await addEnv("SDKROOT", sdkroot.trim())
|
||||||
} else {
|
} else {
|
||||||
error(`SDKROOT not set`)
|
error("SDKROOT not set")
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error(e as Error | string)
|
error(e as Error | string)
|
||||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -97,7 +97,7 @@ async function main(args: string[]): Promise<number> {
|
||||||
setupCppDir,
|
setupCppDir,
|
||||||
successMessages,
|
successMessages,
|
||||||
errorMessages,
|
errorMessages,
|
||||||
parseFloat(opts.timeout ?? "20") * 60 * 1000,
|
Number.parseFloat(opts.timeout ?? "20") * 60 * 1000,
|
||||||
)
|
)
|
||||||
time2 = Date.now()
|
time2 = Date.now()
|
||||||
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
|
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
|
||||||
|
@ -123,8 +123,12 @@ async function main(args: string[]): Promise<number> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// report the messages in the end
|
// report the messages in the end
|
||||||
successMessages.forEach((tool) => success(tool))
|
for (const tool of successMessages) {
|
||||||
errorMessages.forEach((tool) => error(tool))
|
success(tool)
|
||||||
|
}
|
||||||
|
for (const tool of errorMessages) {
|
||||||
|
error(tool)
|
||||||
|
}
|
||||||
|
|
||||||
info("setup-cpp finished")
|
info("setup-cpp finished")
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupMake } from "../make"
|
import { setupMake } from "../make"
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
return setupAptPack([{ name: "make", version }])
|
return setupAptPack([{ name: "make", version }])
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
|
||||||
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { findVcvarsall, vsversion_to_versionnumber } from "msvc-dev-cmd/lib.js"
|
import { findVcvarsall, vsversion_to_versionnumber } from "msvc-dev-cmd/lib.js"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
|
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
||||||
|
|
||||||
import { error, info, warning } from "ci-log"
|
import { error, info, warning } from "ci-log"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { addExeExt } from "patha"
|
import { addExeExt } from "patha"
|
||||||
import { extractZip } from "../utils/setup/extract"
|
import { extractZip } from "../utils/setup/extract"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
/** Get the platform name Ninja uses in their download links */
|
/** Get the platform name Ninja uses in their download links */
|
||||||
function getNinjaPlatform(platform: NodeJS.Platform) {
|
function getNinjaPlatform(platform: NodeJS.Platform) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ export async function setupPowershell(version: string | undefined, _setupDir: st
|
||||||
await setupDnfPack([{ name: "curl" }])
|
await setupDnfPack([{ name: "curl" }])
|
||||||
execRootSync("/bin/bash", [
|
execRootSync("/bin/bash", [
|
||||||
"-c",
|
"-c",
|
||||||
`curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo`,
|
"curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo",
|
||||||
])
|
])
|
||||||
return setupDnfPack([{ name: "powershell", version }])
|
return setupDnfPack([{ name: "powershell", version }])
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
|
@ -55,10 +55,10 @@ export async function setupPowershell(version: string | undefined, _setupDir: st
|
||||||
|
|
||||||
return setupAptPack([{ name: "powershell", version }], true)
|
return setupAptPack([{ name: "powershell", version }], true)
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import assert from "assert"
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
import { getExecOutput } from "@actions/exec"
|
import { getExecOutput } from "@actions/exec"
|
||||||
import assert from "assert"
|
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { execa } from "execa"
|
import { execa } from "execa"
|
||||||
|
@ -13,7 +13,7 @@ import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import type { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupSccache } from "../sccache"
|
import { setupSccache } from "../sccache"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export function setupSccache(version: string, _setupDir: string, _arch: string)
|
||||||
return setupBrewPack("sccache", version)
|
return setupBrewPack("sccache", version)
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import type { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupSevenZip } from "../sevenzip"
|
import { setupSevenZip } from "../sevenzip"
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ export function setupSevenZip(version: string, _setupDir: string, _arch: string)
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
return setupAptPack([{ name: "p7zip-full", version }])
|
return setupAptPack([{ name: "p7zip-full", version }])
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error("Unsupported linux distribution")
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { addExeExt } from "patha"
|
import { addExeExt } from "patha"
|
||||||
import { extractTarByExe, extractZip } from "../utils/setup/extract"
|
import { extractTarByExe, extractZip } from "../utils/setup/extract"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
/** Get the platform name task uses in their download links */
|
/** Get the platform name task uses in their download links */
|
||||||
function getTaskPlatform(platform: NodeJS.Platform) {
|
function getTaskPlatform(platform: NodeJS.Platform) {
|
||||||
|
|
|
@ -4,10 +4,14 @@
|
||||||
import * as stream from "stream"
|
import * as stream from "stream"
|
||||||
import { promisify } from "util"
|
import { promisify } from "util"
|
||||||
|
|
||||||
|
// biome-ignore lint: lint/complexity/noBannedTypes
|
||||||
export const pipeline = "promises" in stream && "pipeline" in (stream as any).promises
|
export const pipeline = "promises" in stream && "pipeline" in (stream as any).promises
|
||||||
|
// biome-ignore lint: lint/complexity/noBannedTypes
|
||||||
? ((stream.promises as any).pipeline as Function)
|
? ((stream.promises as any).pipeline as Function)
|
||||||
: promisify(stream.pipeline)
|
: promisify(stream.pipeline)
|
||||||
|
|
||||||
|
// biome-ignore lint: lint/complexity/noBannedTypes
|
||||||
export const finished = "promises" in stream && "finished" in (stream as any).promises
|
export const finished = "promises" in stream && "finished" in (stream as any).promises
|
||||||
|
// biome-ignore lint: lint/complexity/noBannedTypes
|
||||||
? ((stream.promises as any).finished as Function)
|
? ((stream.promises as any).finished as Function)
|
||||||
: promisify(stream.finished)
|
: promisify(stream.finished)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { addPath as ghAddPath, exportVariable, info, setFailed } from "@actions/core"
|
import { delimiter } from "path"
|
||||||
|
import { exportVariable, addPath as ghAddPath, info, setFailed } from "@actions/core"
|
||||||
import { grantUserWriteAccess } from "admina"
|
import { grantUserWriteAccess } from "admina"
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { error, warning } from "ci-log"
|
import { error, warning } from "ci-log"
|
||||||
|
@ -6,7 +7,6 @@ import escapeSpace from "escape-path-with-spaces"
|
||||||
import escapeQuote from "escape-quotes"
|
import escapeQuote from "escape-quotes"
|
||||||
import { execPowershell } from "exec-powershell"
|
import { execPowershell } from "exec-powershell"
|
||||||
import { appendFile, readFile, writeFile } from "fs/promises"
|
import { appendFile, readFile, writeFile } from "fs/promises"
|
||||||
import { delimiter } from "path"
|
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { untildifyUser } from "untildify-user"
|
import { untildifyUser } from "untildify-user"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@ function macosVersion_raw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { version } = macosRelease()
|
const { version } = macosRelease()
|
||||||
return version.split(".").map((v) => parseInt(v, 10))
|
return version.split(".").map((v) => Number.parseInt(v, 10))
|
||||||
}
|
}
|
||||||
export const macosVersion = memoize(macosVersion_raw)
|
export const macosVersion = memoize(macosVersion_raw)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import os from "os"
|
||||||
import { warning } from "ci-log"
|
import { warning } from "ci-log"
|
||||||
import memoize from "micro-memoize"
|
import memoize from "micro-memoize"
|
||||||
import os from "os"
|
|
||||||
import { getUbuntuVersion } from "ubuntu-version"
|
import { getUbuntuVersion } from "ubuntu-version"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupAptPack } from "../setup/setupAptPack"
|
import { setupAptPack } from "../setup/setupAptPack"
|
||||||
|
@ -45,9 +45,9 @@ function detectUsingOsVersion() {
|
||||||
// #46~22.04.1-Ubuntu SMP ...
|
// #46~22.04.1-Ubuntu SMP ...
|
||||||
const osVersion: string = os.version()
|
const osVersion: string = os.version()
|
||||||
const versionSplitted = osVersion.split(".")
|
const versionSplitted = osVersion.split(".")
|
||||||
const majorVersion = parseInt(versionSplitted[0].replace("#", ""), 10)
|
const majorVersion = Number.parseInt(versionSplitted[0].replace("#", ""), 10)
|
||||||
const minorVersion = parseInt(versionSplitted[1].replace("~", ""), 10)
|
const minorVersion = Number.parseInt(versionSplitted[1].replace("~", ""), 10)
|
||||||
const patchVersion = parseInt(versionSplitted[2].split("-")[0], 10)
|
const patchVersion = Number.parseInt(versionSplitted[2].split("-")[0], 10)
|
||||||
|
|
||||||
return [majorVersion, minorVersion, patchVersion]
|
return [majorVersion, minorVersion, patchVersion]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ import { execRoot, execRootSync } from "admina"
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import escapeRegex from "escape-string-regexp"
|
import escapeRegex from "escape-string-regexp"
|
||||||
import { execa, ExecaError } from "execa"
|
import { type ExecaError, execa } from "execa"
|
||||||
import { appendFile } from "fs/promises"
|
import { appendFile } from "fs/promises"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addEnv, cpprc_path, sourceCpprc } from "../env/addEnv"
|
import { addEnv, cpprc_path, sourceCpprc } from "../env/addEnv"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import type { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
|
@ -75,10 +75,10 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AptPackageType {
|
export enum AptPackageType {
|
||||||
NameDashVersion,
|
NameDashVersion = 0,
|
||||||
NameEqualsVersion,
|
NameEqualsVersion = 1,
|
||||||
Name,
|
Name = 2,
|
||||||
None,
|
None = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function aptPackageType(name: string, version: string | undefined): Promise<AptPackageType> {
|
export async function aptPackageType(name: string, version: string | undefined): Promise<AptPackageType> {
|
||||||
|
@ -125,7 +125,6 @@ async function getAptArg(name: string, version: string | undefined) {
|
||||||
return `${name}=${version}`
|
return `${name}=${version}`
|
||||||
case AptPackageType.Name:
|
case AptPackageType.Name:
|
||||||
return name
|
return name
|
||||||
case AptPackageType.None:
|
|
||||||
default:
|
default:
|
||||||
throw new Error(`Could not find package ${name} ${version ?? ""}`)
|
throw new Error(`Could not find package ${name} ${version ?? ""}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ import { info } from "ci-log"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
import { addPath } from "../env/addEnv"
|
import { addPath } from "../env/addEnv"
|
||||||
|
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
|
||||||
import { tmpdir } from "os"
|
import { tmpdir } from "os"
|
||||||
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import retry from "retry-as-promised"
|
import retry from "retry-as-promised"
|
||||||
import { hasDnf } from "../env/hasDnf"
|
import { hasDnf } from "../env/hasDnf"
|
||||||
|
@ -25,9 +25,7 @@ export type PackageInfo = {
|
||||||
/** The main binary file. */
|
/** The main binary file. */
|
||||||
binFileName: string
|
binFileName: string
|
||||||
/** The function to extract the downloaded archive. It can be `undefined`, if the binary itself is downloaded directly. */
|
/** The function to extract the downloaded archive. It can be `undefined`, if the binary itself is downloaded directly. */
|
||||||
extractFunction?: {
|
extractFunction?: (file: string, dest: string) => Promise<unknown>
|
||||||
(file: string, dest: string): Promise<unknown>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type InstallationInfo = {
|
export type InstallationInfo = {
|
||||||
|
@ -102,7 +100,7 @@ export async function setupBin(
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!didInit) {
|
if (!didInit) {
|
||||||
info(`Installing extraction dependencies`)
|
info("Installing extraction dependencies")
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
await Promise.all([setupPacmanPack("unzip"), setupPacmanPack("tar"), setupPacmanPack("xz")])
|
await Promise.all([setupPacmanPack("unzip"), setupPacmanPack("tar"), setupPacmanPack("xz")])
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { execaSync } from "execa"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { getBrewPath, setupBrew } from "../../brew/brew"
|
import { getBrewPath, setupBrew } from "../../brew/brew"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import type { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
let hasBrew = false
|
let hasBrew = false
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { execaSync } from "execa"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
||||||
import { addPath } from "../env/addEnv"
|
import { addPath } from "../env/addEnv"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import type { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
let hasChoco = false
|
let hasChoco = false
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ export async function setupChocoPack(name: string, version?: string, args: strin
|
||||||
// https://github.com/jberezanski/ChocolateyPackages/issues/97#issuecomment-986825694
|
// https://github.com/jberezanski/ChocolateyPackages/issues/97#issuecomment-986825694
|
||||||
const PATH = process.env.PATH
|
const PATH = process.env.PATH
|
||||||
const env = { ...process.env }
|
const env = { ...process.env }
|
||||||
delete env.TMP
|
env.TMP = undefined
|
||||||
delete env.TEMP
|
env.TEMP = undefined
|
||||||
delete env.Path
|
env.Path = undefined
|
||||||
env.PATH = PATH
|
env.PATH = PATH
|
||||||
|
|
||||||
if (version !== undefined && version !== "") {
|
if (version !== undefined && version !== "") {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { execRootSync } from "admina"
|
import { execRootSync } from "admina"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { execa } from "execa"
|
import { execa } from "execa"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import type { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
type DnfPackage = {
|
type DnfPackage = {
|
||||||
name: string
|
name: string
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { execRootSync } from "admina"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { execa, execaSync } from "execa"
|
import { execa, execaSync } from "execa"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import type { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { isArch } from "../env/isArch"
|
||||||
import { isUbuntu } from "../env/isUbuntu"
|
import { isUbuntu } from "../env/isUbuntu"
|
||||||
import { ubuntuVersion } from "../env/ubuntu_version"
|
import { ubuntuVersion } from "../env/ubuntu_version"
|
||||||
import { setupAptPack } from "./setupAptPack"
|
import { setupAptPack } from "./setupAptPack"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import type { InstallationInfo } from "./setupBin"
|
||||||
import { setupDnfPack } from "./setupDnfPack"
|
import { setupDnfPack } from "./setupDnfPack"
|
||||||
import { setupPacmanPack } from "./setupPacmanPack"
|
import { setupPacmanPack } from "./setupPacmanPack"
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ export function semverCoerceIfInvalid(version: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeVPrefix(version: string) {
|
export function removeVPrefix(version: string) {
|
||||||
return parseInt(version.replace(/^v/, ""), 10)
|
return Number.parseInt(version.replace(/^v/, ""), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addVPrefix(version: string) {
|
export function addVPrefix(version: string) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { tmpdir } from "os"
|
||||||
import * as io from "@actions/io"
|
import * as io from "@actions/io"
|
||||||
import spawn from "cross-spawn"
|
import spawn from "cross-spawn"
|
||||||
import { tmpdir } from "os"
|
|
||||||
import * as path from "patha"
|
import * as path from "patha"
|
||||||
import { addExeExt, join } from "patha"
|
import { addExeExt, join } from "patha"
|
||||||
|
|
||||||
|
@ -66,5 +66,5 @@ export function runnerWindowsVersion() {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseInt(maybeVersionString, 10)
|
return Number.parseInt(maybeVersionString, 10)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import type { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Opts } from "../cli-options"
|
import type { Opts } from "../cli-options"
|
||||||
import { Inputs } from "../tool"
|
import type { Inputs } from "../tool"
|
||||||
import { DefaultLinuxVersion, DefaultVersions } from "./default_versions"
|
import { DefaultLinuxVersion, DefaultVersions } from "./default_versions"
|
||||||
|
|
||||||
/** Get the default version if passed true or undefined, otherwise return the version itself */
|
/** Get the default version if passed true or undefined, otherwise return the version itself */
|
||||||
|
@ -24,7 +24,7 @@ function getDefaultLinuxVersion(osVersion: number[], toolLinuxVersions: Record<n
|
||||||
|
|
||||||
// find which version block the os version is in
|
// find which version block the os version is in
|
||||||
const satisfyingVersion = Object.keys(toolLinuxVersions)
|
const satisfyingVersion = Object.keys(toolLinuxVersions)
|
||||||
.map((v) => parseInt(v, 10))
|
.map((v) => Number.parseInt(v, 10))
|
||||||
.sort((a, b) => b - a) // sort in descending order
|
.sort((a, b) => b - a) // sort in descending order
|
||||||
.find((v) => osVersionMaj >= v)
|
.find((v) => osVersionMaj >= v)
|
||||||
|
|
||||||
|
@ -47,9 +47,9 @@ export function syncVersions(opts: Opts, tools: Inputs[]): boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
toolsInUse.forEach((tool) => {
|
for (const tool of toolsInUse) {
|
||||||
opts[tool] = targetVersion
|
opts[tool] = targetVersion
|
||||||
})
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue