Merge pull request #251 from aminya/biome [skip ci]

This commit is contained in:
Amin Yahyaabadi 2024-08-07 13:54:54 -07:00 committed by GitHub
commit 1257bf3d2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
92 changed files with 8175 additions and 8368 deletions

View File

@ -24,9 +24,9 @@ jobs:
os: os:
- ubuntu-22.04 - ubuntu-22.04
node: node:
- 20 - 22
pnpm: pnpm:
- 8 - 9
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -73,6 +73,7 @@ jobs:
- name: Upload Dist - name: Upload Dist
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: always()
with: with:
name: dist name: dist
path: | path: |
@ -95,9 +96,9 @@ jobs:
- macos-13 - macos-13
- macos-12 - macos-12
node: node:
- 20 - 22
pnpm: pnpm:
- 8 - 9
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -159,11 +160,10 @@ jobs:
- ubuntu-20.04 - ubuntu-20.04
- macos-13 - macos-13
- macos-12 - macos-12
- macos-11
node: node:
- 20 - 22
pnpm: pnpm:
- 8 - 9
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -236,9 +236,9 @@ jobs:
os: os:
- ubuntu-22.04 - ubuntu-22.04
node: node:
- 20 - 22
pnpm: pnpm:
- 8 - 9
container: container:
- { file: "ubuntu-llvm.dockerfile", image: "setup-cpp-ubuntu-llvm", tag: "22.04-0.37.0" } - { file: "ubuntu-llvm.dockerfile", image: "setup-cpp-ubuntu-llvm", tag: "22.04-0.37.0" }
- { file: "fedora-llvm.dockerfile", image: "setup-cpp-fedora-llvm", tag: "40-0.37.0" } - { file: "fedora-llvm.dockerfile", image: "setup-cpp-fedora-llvm", tag: "40-0.37.0" }

1
.nvm
View File

@ -1 +0,0 @@
v18.15.0

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v22.6.0

View File

@ -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"
]
} }

50
biome.jsonc Normal file
View File

@ -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
}
}
}

View File

@ -15,6 +15,8 @@ words:
- hadolint - hadolint
- aminya - aminya
- applellvm - applellvm
- biome
- biomejs
- bazel - bazel
- bazelisk - bazelisk
- buildtools - buildtools

View File

@ -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

2
dist/actions/hdi.c45e802a.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/actions/hdi.c45e802a.js.map vendored Normal file

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

2
dist/legacy/hdi.d0d1f24f.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/legacy/hdi.d0d1f24f.js.map vendored Normal file

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

View File

@ -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": {},

View File

@ -29,9 +29,10 @@
"scripts": { "scripts": {
"build": "run-s clean build.packages && run-p lint.tsc build.parcel copy.matchers", "build": "run-s clean build.packages && run-p lint.tsc build.parcel copy.matchers",
"build.packages": "pnpm run -r build", "build.packages": "pnpm run -r build",
"build.parcel": "cross-env NODE_ENV=production parcel build && babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc --source-maps true", "build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report 10 && run-s build.babel",
"bump": "ncu -u -x numerous,execa,prettier,@types/node && pnpm update", "build.babel": "babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --plugins @babel/plugin-transform-private-methods --compact --no-babelrc --source-maps true",
"clean": "shx rm -rf ./dist ./exe ./packages/*/dist/ && shx mkdir -p ./dist/legacy ./dist/actions ./dist/modern ", "bump": "ncu -u -x numerous,execa,prettier,@types/node,eslint,@types/eslint && pnpm update && pnpx typesync",
"clean": "shx rm -rf ./dist ./exe ./packages/*/dist/ ./.parcel-cache && shx mkdir -p ./dist/legacy ./dist/actions ./dist/modern ",
"copy.matchers": "run-p copy.matchers.legacy copy.matchers.actions copy.matchers.modern", "copy.matchers": "run-p copy.matchers.legacy copy.matchers.actions copy.matchers.modern",
"copy.matchers.legacy": "shx cp ./src/gcc/gcc_matcher.json ./dist/legacy/ && shx cp ./src/msvc/msvc_matcher.json ./dist/legacy/ && shx cp ./src/python/python_matcher.json ./dist/legacy/ && shx cp ./src/llvm/llvm_matcher.json ./dist/legacy/", "copy.matchers.legacy": "shx cp ./src/gcc/gcc_matcher.json ./dist/legacy/ && shx cp ./src/msvc/msvc_matcher.json ./dist/legacy/ && shx cp ./src/python/python_matcher.json ./dist/legacy/ && shx cp ./src/llvm/llvm_matcher.json ./dist/legacy/",
"copy.matchers.actions": "shx cp ./src/gcc/gcc_matcher.json ./dist/actions/ && shx cp ./src/msvc/msvc_matcher.json ./dist/actions/ && shx cp ./src/python/python_matcher.json ./dist/actions/ && shx cp ./src/llvm/llvm_matcher.json ./dist/actions/", "copy.matchers.actions": "shx cp ./src/gcc/gcc_matcher.json ./dist/actions/ && shx cp ./src/msvc/msvc_matcher.json ./dist/actions/ && shx cp ./src/python/python_matcher.json ./dist/actions/ && shx cp ./src/llvm/llvm_matcher.json ./dist/actions/",
@ -39,15 +40,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"
@ -57,15 +60,17 @@
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@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.8",
"@babel/plugin-transform-private-methods": "^7.24.7",
"@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",
"@types/eslint": "^8.56.6", "@types/eslint": "^8.56.11",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^12.20.55", "@types/node": "^12.20.55",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@types/which": "^3.0.3", "@types/which": "^3.0.4",
"@upleveled/babel-plugin-remove-node-prefix": "github:aminya/babel-plugin-remove-node-prefix#95fcbd92405b99a6eece48c493548996f12e6519", "@upleveled/babel-plugin-remove-node-prefix": "github:aminya/babel-plugin-remove-node-prefix#95fcbd92405b99a6eece48c493548996f12e6519",
"admina": "^1.0.1", "admina": "^1.0.1",
"caxa": "^3.0.1", "caxa": "^3.0.1",
@ -73,24 +78,25 @@
"ci-log": "workspace:*", "ci-log": "workspace:*",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"cspell": "^8.6.1", "cspell": "^8.13.1",
"dprint": "^0.45.0", "diagnostics_channel": "^1.1.0",
"dprint": "^0.47.2",
"escape-path-with-spaces": "^1.0.2", "escape-path-with-spaces": "^1.0.2",
"escape-quotes": "^1.0.2", "escape-quotes": "^1.0.2",
"escape-string-regexp": "^5.0.0", "escape-string-regexp": "^5.0.0",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-atomic": "^1.21.2", "eslint-config-atomic": "^1.22.0",
"exec-powershell": "workspace:*", "exec-powershell": "workspace:*",
"execa": "^7.2.0", "execa": "^7.2.0",
"is-url-online": "^1.5.0", "is-url-online": "^1.5.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"macos-release": "^3.2.0", "macos-release": "^3.3.0",
"micro-memoize": "^4.1.2", "micro-memoize": "^4.1.2",
"mkdirp": "^3.0.1", "mkdirp": "^3.0.1",
"mri": "^1.2.0", "mri": "^1.2.0",
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#c01f519bd995460228ed3dec4df51df92dc290fd", "msvc-dev-cmd": "github:aminya/msvc-dev-cmd#c01f519bd995460228ed3dec4df51df92dc290fd",
"npm-check-updates": "^16.14.18", "npm-check-updates": "^17.0.3",
"npm-run-all2": "^6.1.2", "npm-run-all2": "^6.2.2",
"numerous": "1.0.3", "numerous": "1.0.3",
"p-timeout": "^6.1.2", "p-timeout": "^6.1.2",
"parcel": "2.12.0", "parcel": "2.12.0",
@ -100,7 +106,7 @@
"prettier-config-atomic": "^4.0.0", "prettier-config-atomic": "^4.0.0",
"readme-md-generator": "^1.0.0", "readme-md-generator": "^1.0.0",
"retry-as-promised": "^7.0.4", "retry-as-promised": "^7.0.4",
"semver": "7.6.0", "semver": "7.6.3",
"setup-python": "github:aminya/setup-python#a783db655c6e40317e2c0c96f9d162d9c9f4a751", "setup-python": "github:aminya/setup-python#a783db655c6e40317e2c0c96f9d162d9c9f4a751",
"shx": "0.3.4", "shx": "0.3.4",
"simple-update-notifier": "^2.0.0", "simple-update-notifier": "^2.0.0",
@ -108,9 +114,11 @@
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e", "time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"ts-readme": "^1.1.3", "ts-readme": "^1.1.3",
"typescript": "^5.4.3", "typescript": "^5.5.4",
"ubuntu-version": "^2.0.0", "ubuntu-version": "^2.0.0",
"untildify-user": "workspace:*", "untildify-user": "workspace:*",
"util.types": "^0.0.2",
"web-streams-polyfill": "^4.0.0",
"which": "^4.0.0" "which": "^4.0.0"
}, },
"productionDependencies": [ "productionDependencies": [
@ -139,10 +147,14 @@
"simple-update-notifier", "simple-update-notifier",
"time-delta", "time-delta",
"ubuntu-version", "ubuntu-version",
"untildify-user" "untildify-user",
"web-streams-polyfill",
"util.types",
"diagnostics_channel"
], ],
"engines": { "engines": {
"node": ">=12.x" "node": ">=12.x",
"pnpm": "^9"
}, },
"keywords": [ "keywords": [
"github-actions", "github-actions",
@ -168,7 +180,10 @@
"patha": "patha/dist/index.node.mjs", "patha": "patha/dist/index.node.mjs",
"admina": "admina/dist/index.mjs", "admina": "admina/dist/index.mjs",
"fs/promises": "./src/utils/compat/fs/promises.ts", "fs/promises": "./src/utils/compat/fs/promises.ts",
"stream/promises": "./src/utils/compat/stream/promises.ts" "stream/promises": "./src/utils/compat/stream/promises.ts",
"stream/web": "web-streams-polyfill/dist/ponyfill.mjs",
"util/types": "util.types/index.js",
"diagnostics_channel": "diagnostics_channel/index.js"
}, },
"targets": { "targets": {
"main": { "main": {
@ -176,9 +191,7 @@
"engines": { "engines": {
"node": ">=12.x" "node": ">=12.x"
}, },
"includeNodeModules": { "includeNodeModules": true,
"update-notifier": false
},
"optimize": true, "optimize": true,
"outputFormat": "commonjs" "outputFormat": "commonjs"
}, },
@ -187,9 +200,7 @@
"engines": { "engines": {
"node": ">=20.x" "node": ">=20.x"
}, },
"includeNodeModules": { "includeNodeModules": true,
"update-notifier": false
},
"optimize": true, "optimize": true,
"outputFormat": "commonjs" "outputFormat": "commonjs"
}, },

View File

@ -25,5 +25,6 @@
"console", "console",
"info", "info",
"notifications" "notifications"
] ],
"devDependencies": {}
} }

View File

@ -24,5 +24,6 @@
"user", "user",
"shell", "shell",
"bash" "bash"
] ],
"devDependencies": {}
} }

View File

@ -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 !== "") {

File diff suppressed because it is too large Load Diff

View File

@ -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"

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -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

View File

@ -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"],
) )

View File

@ -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 {

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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)

View File

@ -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"

View File

@ -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"

View File

@ -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) {

View File

@ -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)

View File

@ -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(

View File

@ -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"
// ================================================ // ================================================

View File

@ -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)

View File

@ -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")

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -21,14 +21,14 @@ export async function setupNala(version: string, _setupDir: string, _arch: strin
return { binDir } return { binDir }
} }
// https://github.com/volitank/nala#-installation // https://gitlab.com/volian/nala/-/wikis/Installation
const keyFileName = await addAptKeyViaDownload( const keyFileName = await addAptKeyViaDownload(
"volian-archive-scar-unstable.gpg", "volian-archive-nala.gpg",
"https://deb.volian.org/volian/scar.key", "https://deb.volian.org/volian/nala.key",
) )
execRootSync("/bin/bash", [ execRootSync("/bin/bash", [
"-c", "-c",
`echo "deb [signed-by=${keyFileName}] http://deb.volian.org/volian/ scar main" | tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list`, `echo "deb [signed-by=${keyFileName}] http://deb.volian.org/volian/ nala main" | tee /etc/apt/sources.list.d/volian-archive-nala.list`,
]) ])
try { try {

View File

@ -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) {

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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"

View File

@ -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")
} }
} }
} }

View File

@ -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) {

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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]
} }

View File

@ -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 ?? ""}`)
} }

View File

@ -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")])

View File

@ -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

View File

@ -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 !== "") {

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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) {

View File

@ -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)
} }

View File

@ -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"

View File

@ -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
} }