mirror of https://github.com/aminya/setup-cpp
Merge pull request #174 from aminya/gcc-13 [skip ci]
This commit is contained in:
commit
3945890fb7
|
@ -1,4 +1,16 @@
|
||||||
{
|
{
|
||||||
"extends": "eslint-config-atomic",
|
"extends": "eslint-config-atomic",
|
||||||
"ignorePatterns": ["dist/", "node_modules/", "dev/cpp_vcpkg_project"]
|
"ignorePatterns": ["dist/", "node_modules/", "dev/cpp_vcpkg_project"],
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"varsIgnorePattern": "^_",
|
||||||
|
"caughtErrorsIgnorePattern": "^_",
|
||||||
|
"destructuredArrayIgnorePattern": "^_"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ ignorePaths:
|
||||||
words:
|
words:
|
||||||
- aarch
|
- aarch
|
||||||
- clangd
|
- clangd
|
||||||
|
- Trofimovich
|
||||||
|
- cobertura
|
||||||
- aminya
|
- aminya
|
||||||
- applellvm
|
- applellvm
|
||||||
- bazel
|
- bazel
|
||||||
|
|
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
20
package.json
20
package.json
|
@ -64,15 +64,15 @@
|
||||||
"@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.21.0",
|
"@babel/cli": "^7.21.5",
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
"@types/eslint": "^8.37.0",
|
"@types/eslint": "^8.40.0",
|
||||||
"@types/jest": "^29.5.1",
|
"@types/jest": "^29.5.1",
|
||||||
"@types/mri": "^1.1.1",
|
"@types/mri": "^1.1.1",
|
||||||
"@types/node": "^18.16.0",
|
"@types/node": "^20.2.3",
|
||||||
"@types/npmcli__ci-detect": "^2.0.0",
|
"@types/npmcli__ci-detect": "^2.0.0",
|
||||||
"@types/prettier": "2.7.2",
|
"@types/prettier": "2.7.2",
|
||||||
"@types/semver": "^7.3.13",
|
"@types/semver": "^7.5.0",
|
||||||
"@types/which": "^3.0.0",
|
"@types/which": "^3.0.0",
|
||||||
"@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": "^0.1.3",
|
"admina": "^0.1.3",
|
||||||
|
@ -85,8 +85,8 @@
|
||||||
"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.39.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-atomic": "^1.18.3",
|
"eslint-config-atomic": "^1.19.1",
|
||||||
"exec-powershell": "workspace:*",
|
"exec-powershell": "workspace:*",
|
||||||
"execa": "^7.1.1",
|
"execa": "^7.1.1",
|
||||||
"fast-glob": "^3.2.12",
|
"fast-glob": "^3.2.12",
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"mri": "^1.2.0",
|
"mri": "^1.2.0",
|
||||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||||
"npm-check-updates": "^16.10.9",
|
"npm-check-updates": "^16.10.12",
|
||||||
"npm-run-all2": "^6.0.5",
|
"npm-run-all2": "^6.0.5",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
"parcel": "2.8.3",
|
"parcel": "2.8.3",
|
||||||
|
@ -106,8 +106,8 @@
|
||||||
"quote-unquote": "^1.0.0",
|
"quote-unquote": "^1.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.5.0",
|
"semver": "7.5.1",
|
||||||
"setup-python": "github:actions/setup-python#v4.6.0",
|
"setup-python": "github:actions/setup-python#v4.6.1",
|
||||||
"shx": "0.3.4",
|
"shx": "0.3.4",
|
||||||
"terser-config-atomic": "^0.1.1",
|
"terser-config-atomic": "^0.1.1",
|
||||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
"ubuntu-version": "^2.0.0",
|
"ubuntu-version": "^2.0.0",
|
||||||
"untildify-user": "workspace:*",
|
"untildify-user": "workspace:*",
|
||||||
"user-access": "workspace:*",
|
"user-access": "workspace:*",
|
||||||
"which": "^3.0.0"
|
"which": "^3.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.x"
|
"node": ">=12.x"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.9.1",
|
"@actions/core": "^1.9.1",
|
||||||
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d"
|
"ci-info": "^3.8.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"log",
|
"log",
|
||||||
|
|
1491
pnpm-lock.yaml
1491
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -7,6 +7,7 @@ import { mkdirP } from "@actions/io"
|
||||||
import { readFileSync } from "fs"
|
import { readFileSync } from "fs"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
|
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
let binDir: string | undefined
|
let binDir: string | undefined
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
|
|
@ -70,7 +70,7 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
||||||
let installationInfo: InstallationInfo
|
let installationInfo: InstallationInfo
|
||||||
if (version === "" || isArch() || hasDnf()) {
|
if (version === "" || isArch() || hasDnf()) {
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
installationInfo = setupPacmanPack("doxygen", version)
|
installationInfo = await setupPacmanPack("doxygen", version)
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
return setupDnfPack("doxygen", version)
|
return setupDnfPack("doxygen", version)
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
import { ExecaReturnValue } from "execa"
|
||||||
|
|
||||||
interface MingwInfo {
|
interface MingwInfo {
|
||||||
releaseName: string
|
releaseName: string
|
||||||
|
@ -95,7 +96,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
|
||||||
case "linux": {
|
case "linux": {
|
||||||
if (arch === "x64") {
|
if (arch === "x64") {
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
installationInfo = setupPacmanPack("gcc", version)
|
installationInfo = await setupPacmanPack("gcc", version)
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
installationInfo = setupDnfPack("gcc", version)
|
installationInfo = setupDnfPack("gcc", version)
|
||||||
setupDnfPack("gcc-c++", version)
|
setupDnfPack("gcc-c++", version)
|
||||||
|
@ -109,7 +110,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
|
||||||
} else {
|
} else {
|
||||||
info(`Install g++-multilib because gcc for ${arch} was requested`)
|
info(`Install g++-multilib because gcc for ${arch} was requested`)
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
setupPacmanPack("gcc-multilib", version)
|
await setupPacmanPack("gcc-multilib", version)
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
await setupAptPack([{ name: "gcc-multilib", version, repositories: ["ppa:ubuntu-toolchain-r/test"] }])
|
await setupAptPack([{ name: "gcc-multilib", version, repositories: ["ppa:ubuntu-toolchain-r/test"] }])
|
||||||
}
|
}
|
||||||
|
@ -157,7 +158,7 @@ async function setupChocoMingw(version: string, arch: string): Promise<Installat
|
||||||
}
|
}
|
||||||
|
|
||||||
async function activateGcc(version: string, binDir: string) {
|
async function activateGcc(version: string, binDir: string) {
|
||||||
const promises: Promise<any>[] = []
|
const promises: Promise<void | ExecaReturnValue<string>>[] = []
|
||||||
// Setup gcc as the compiler
|
// Setup gcc as the compiler
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -11,6 +11,18 @@ describe("setup-Kcov", () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it("should build and setup kcov-41", async () => {
|
||||||
|
const directory = await setupTmpDir("kcov-v41")
|
||||||
|
const { binDir } = (await setupKcov("41", directory, "")) as InstallationInfo
|
||||||
|
// the prebuild binary only works on ubuntu 20.04
|
||||||
|
try {
|
||||||
|
await testBin("kcov", ["--version"], binDir)
|
||||||
|
} catch (err) {
|
||||||
|
info((err as Error).message)
|
||||||
|
}
|
||||||
|
await cleanupTmpDir("kcov-v41")
|
||||||
|
})
|
||||||
|
|
||||||
it("should setup Kcov v40 via downloading the binaries", async () => {
|
it("should setup Kcov v40 via downloading the binaries", async () => {
|
||||||
const directory = await setupTmpDir("kcov-v40")
|
const directory = await setupTmpDir("kcov-v40")
|
||||||
const { binDir } = (await setupKcov("40-binary", directory, "")) as InstallationInfo
|
const { binDir } = (await setupKcov("40-binary", directory, "")) as InstallationInfo
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
From b63754b53b3a7cf43e13ec56bd0be76cb6175437 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sergei Trofimovich <slyich@gmail.com>
|
||||||
|
Date: Thu, 15 Sep 2022 19:55:21 +0100
|
||||||
|
Subject: [PATCH] Fix build on gcc-13: add missing <stdint.h> include
|
||||||
|
|
||||||
|
[ 15%] Building CXX object src/CMakeFiles/kcov.dir/writers/cobertura-writer.cc.o
|
||||||
|
In file included from kcov/src/writers/cobertura-writer.cc:6:
|
||||||
|
kcov/src/include/reporter.hh:24:90: error: 'uint64_t' has not been declared
|
||||||
|
24 | LineExecutionCount(unsigned int hits, unsigned int possibleHits, uint64_t order) :
|
||||||
|
| ^~~~~~~~
|
||||||
|
---
|
||||||
|
src/include/collector.hh | 2 ++
|
||||||
|
src/include/reporter.hh | 1 +
|
||||||
|
src/include/source-file-cache.hh | 2 ++
|
||||||
|
3 files changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/include/collector.hh b/src/include/collector.hh
|
||||||
|
index 79e5d5f2..1369a416 100644
|
||||||
|
--- a/src/include/collector.hh
|
||||||
|
+++ b/src/include/collector.hh
|
||||||
|
@@ -2,6 +2,8 @@
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
+#include <stdint.h>
|
||||||
|
+
|
||||||
|
namespace kcov
|
||||||
|
{
|
||||||
|
class IFileParser;
|
||||||
|
diff --git a/src/include/reporter.hh b/src/include/reporter.hh
|
||||||
|
index bc058e69..98d8e56b 100644
|
||||||
|
--- a/src/include/reporter.hh
|
||||||
|
+++ b/src/include/reporter.hh
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
|
||||||
|
namespace kcov
|
||||||
|
{
|
||||||
|
diff --git a/src/include/source-file-cache.hh b/src/include/source-file-cache.hh
|
||||||
|
index c0cb00ee..cfc73b81 100644
|
||||||
|
--- a/src/include/source-file-cache.hh
|
||||||
|
+++ b/src/include/source-file-cache.hh
|
||||||
|
@@ -3,6 +3,8 @@
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
+#include <stdint.h>
|
||||||
|
+
|
||||||
|
namespace kcov
|
||||||
|
{
|
||||||
|
/**
|
|
@ -44,8 +44,7 @@ async function buildKcov(file: string, dest: string) {
|
||||||
|
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
setupPacmanPack("libdwarf")
|
await Promise.all([setupPacmanPack("libdwarf"), setupPacmanPack("libcurl-openssl")])
|
||||||
setupPacmanPack("libcurl-openssl")
|
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
setupDnfPack("libdwarf-devel")
|
setupDnfPack("libdwarf-devel")
|
||||||
setupDnfPack("libcurl-devel")
|
setupDnfPack("libcurl-devel")
|
||||||
|
@ -53,6 +52,19 @@ async function buildKcov(file: string, dest: string) {
|
||||||
await setupAptPack([{ name: "libdw-dev" }, { name: "libcurl4-openssl-dev" }])
|
await setupAptPack([{ name: "libdw-dev" }, { name: "libcurl4-openssl-dev" }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// apply gcc13.patch
|
||||||
|
try {
|
||||||
|
if (which.sync("patch", { nothrow: true }) !== null) {
|
||||||
|
const patch = join(__dirname, "gcc13.patch")
|
||||||
|
await execa("patch", ["-N", "-p1", "-i", patch], { cwd: out, stdio: "inherit" })
|
||||||
|
} else {
|
||||||
|
info("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13")
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
const buildDir = join(out, "build")
|
const buildDir = join(out, "build")
|
||||||
await execa(cmake, ["-S", out, "-B", buildDir, "-DCMAKE_BUILD_TYPE=Release", "-G", "Ninja"], {
|
await execa(cmake, ["-S", out, "-B", buildDir, "-DCMAKE_BUILD_TYPE=Release", "-G", "Ninja"], {
|
||||||
cwd: out,
|
cwd: out,
|
||||||
|
@ -97,7 +109,7 @@ export async function setupKcov(versionGiven: string, setupDir: string, arch: st
|
||||||
if (installMethod === "binary" && version_number >= 39) {
|
if (installMethod === "binary" && version_number >= 39) {
|
||||||
installationInfo = await setupBin("kcov", version, getDownloadKcovPackageInfo, setupDir, arch)
|
installationInfo = await setupBin("kcov", version, getDownloadKcovPackageInfo, setupDir, arch)
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
setupPacmanPack("binutils")
|
await setupPacmanPack("binutils")
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
setupDnfPack("binutils")
|
setupDnfPack("binutils")
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { join, addExeExt } from "patha"
|
import { join, addExeExt } from "patha"
|
||||||
import { delimiter } from "path"
|
import { delimiter } from "path"
|
||||||
import semverMajor from "semver/functions/major"
|
|
||||||
import { InstallationInfo, setupBin } from "../utils/setup/setupBin"
|
import { InstallationInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { semverCoerceIfInvalid } from "../utils/setup/version"
|
import { semverCoerceIfInvalid } from "../utils/setup/version"
|
||||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
|
@ -59,12 +58,12 @@ async function setupLLVMDeps(arch: string, version: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: install libtinfo on other distros
|
// TODO: install libtinfo on other distros
|
||||||
// setupPacmanPack("ncurses")
|
// await setupPacmanPack("ncurses")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function activateLLVM(directory: string, versionGiven: string) {
|
export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
const version = semverCoerceIfInvalid(versionGiven)
|
const _version = semverCoerceIfInvalid(versionGiven)
|
||||||
|
|
||||||
const lib = join(directory, "lib")
|
const lib = join(directory, "lib")
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ export async function main(args: string[]): Promise<number> {
|
||||||
|
|
||||||
if (isArch() && typeof opts.cppcheck === "string" && typeof opts.gcovr === "string") {
|
if (isArch() && typeof opts.cppcheck === "string" && typeof opts.gcovr === "string") {
|
||||||
info("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux")
|
info("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux")
|
||||||
setupPacmanPack("python-pygments")
|
await setupPacmanPack("python-pygments")
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop over the tools and run their setup function
|
// loop over the tools and run their setup function
|
||||||
|
|
|
@ -63,8 +63,8 @@ export async function setupPythonViaSystem(
|
||||||
case "linux": {
|
case "linux": {
|
||||||
let installInfo: InstallationInfo
|
let installInfo: InstallationInfo
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
installInfo = setupPacmanPack("python", version)
|
installInfo = await setupPacmanPack("python", version)
|
||||||
setupPacmanPack("python-pip")
|
await setupPacmanPack("python-pip")
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
installInfo = setupDnfPack("python3", version)
|
installInfo = setupDnfPack("python3", version)
|
||||||
setupDnfPack("python3-pip")
|
setupDnfPack("python3-pip")
|
||||||
|
@ -113,7 +113,7 @@ export async function setupPythonAndPip(): Promise<string> {
|
||||||
} else if (process.platform === "linux") {
|
} else if (process.platform === "linux") {
|
||||||
// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
setupPacmanPack("python-pip")
|
await setupPacmanPack("python-pip")
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
setupDnfPack("python3-pip")
|
setupDnfPack("python3-pip")
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
|
|
|
@ -111,6 +111,7 @@ async function addPathSystem(path: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
let setupCppInProfile_called = false
|
let setupCppInProfile_called = false
|
||||||
|
|
||||||
/// handles adding conditions to source .cpprc file from .bashrc and .profile
|
/// handles adding conditions to source .cpprc file from .bashrc and .profile
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import { execRoot, execRootSync } from "admina"
|
import { execRoot, execRootSync } from "admina"
|
||||||
import { info } from "@actions/core"
|
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
|
@ -10,7 +8,9 @@ import { promises as fsPromises } from "fs"
|
||||||
const { appendFile } = fsPromises
|
const { appendFile } = fsPromises
|
||||||
import { execa } from "execa"
|
import { execa } from "execa"
|
||||||
import escapeRegex from "escape-string-regexp"
|
import escapeRegex from "escape-string-regexp"
|
||||||
|
import { warning, info } from "ci-log"
|
||||||
|
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
let didInit: boolean = false
|
let didInit: boolean = false
|
||||||
|
|
||||||
|
@ -62,16 +62,24 @@ async function getAptArg(name: string, version: string | undefined) {
|
||||||
const { stdout } = await execa("apt-cache", [
|
const { stdout } = await execa("apt-cache", [
|
||||||
"search",
|
"search",
|
||||||
"--names-only",
|
"--names-only",
|
||||||
`^${escapeRegex(name)}\-${escapeRegex(version)}$`,
|
`^${escapeRegex(name)}-${escapeRegex(version)}$`,
|
||||||
])
|
])
|
||||||
if (stdout.trim() !== "") {
|
if (stdout.trim() !== "") {
|
||||||
return `${name}-${version}`
|
return `${name}-${version}`
|
||||||
} else {
|
} else {
|
||||||
return `${name}=${version}`
|
try {
|
||||||
|
// check if apt-get show can find the version
|
||||||
|
const { stdout: showStdout } = await execa("apt-cache", ["show", `${name}=${version}`])
|
||||||
|
if (showStdout.trim() === "") {
|
||||||
|
return `${name}=${version}`
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
warning(`Failed to install ${name} ${version} via apt, trying without version`)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return name
|
|
||||||
}
|
}
|
||||||
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
function getApt() {
|
function getApt() {
|
||||||
|
@ -99,7 +107,7 @@ async function initApt(apt: string) {
|
||||||
"ca-certificates",
|
"ca-certificates",
|
||||||
"gnupg",
|
"gnupg",
|
||||||
])
|
])
|
||||||
const promises: Promise<any>[] = [
|
const promises: Promise<string | void>[] = [
|
||||||
addAptKeyViaServer(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg"),
|
addAptKeyViaServer(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg"),
|
||||||
addAptKeyViaServer(["1E9377A2BA9EF27F"], "launchpad-toolchain.gpg"),
|
addAptKeyViaServer(["1E9377A2BA9EF27F"], "launchpad-toolchain.gpg"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -104,9 +104,7 @@ export async function setupBin(
|
||||||
info(`Installing extraction dependencies`)
|
info(`Installing extraction dependencies`)
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
setupPacmanPack("unzip")
|
await Promise.all([setupPacmanPack("unzip"), setupPacmanPack("tar"), setupPacmanPack("xz")])
|
||||||
setupPacmanPack("tar")
|
|
||||||
setupPacmanPack("xz")
|
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
setupDnfPack("unzip")
|
setupDnfPack("unzip")
|
||||||
setupDnfPack("tar")
|
setupDnfPack("tar")
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import { execRootSync } from "admina"
|
import { execRootSync } from "admina"
|
||||||
import { info } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
|
import { execa } from "execa"
|
||||||
|
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
let didInit: boolean = false
|
let didInit: boolean = false
|
||||||
|
|
||||||
/** A function that installs a package using pacman */
|
/** A function that installs a package using pacman */
|
||||||
export function setupPacmanPack(name: string, version?: string, aur?: string): InstallationInfo {
|
export async function setupPacmanPack(name: string, version?: string, aur?: string): Promise<InstallationInfo> {
|
||||||
info(`Installing ${name} ${version ?? ""} via pacman`)
|
info(`Installing ${name} ${version ?? ""} via pacman`)
|
||||||
|
|
||||||
const pacman = "pacman"
|
const pacman = "pacman"
|
||||||
|
@ -18,21 +19,52 @@ export function setupPacmanPack(name: string, version?: string, aur?: string): I
|
||||||
didUpdate = true
|
didUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// install base-devel
|
||||||
if (!didInit) {
|
if (!didInit) {
|
||||||
// install base-devel
|
|
||||||
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
|
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
|
||||||
didInit = true
|
didInit = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const runInstall = (arg: string) => {
|
||||||
|
return execRootSync(aur ?? pacman, ["-S", "--noconfirm", arg])
|
||||||
|
}
|
||||||
|
|
||||||
if (version !== undefined && version !== "") {
|
if (version !== undefined && version !== "") {
|
||||||
try {
|
// check if version is available
|
||||||
execRootSync(aur ?? pacman, ["-S", "--noconfirm", `${name}=${version}`])
|
const availableVersions = await availablePacmanVersions(pacman, name)
|
||||||
} catch {
|
if (availableVersions.includes(version)) {
|
||||||
execRootSync(aur ?? pacman, ["-S", "--noconfirm", `${name}${version}`])
|
// try different version formats
|
||||||
|
try {
|
||||||
|
runInstall(`${name}=${version}`)
|
||||||
|
} catch {
|
||||||
|
runInstall(`${name}${version}`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// try without version
|
||||||
|
info(`Failed to install ${name} ${version} via pacman, trying without version`)
|
||||||
|
runInstall(name)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
execRootSync(aur ?? pacman, ["-S", "--noconfirm", name])
|
// version not specified, install latest
|
||||||
|
runInstall(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return { binDir: "/usr/bin/" }
|
return { binDir: "/usr/bin/" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pacmanSiVersionRegex = /Version\s*:\s*(.*)/g
|
||||||
|
|
||||||
|
/** Query pacman for available versions */
|
||||||
|
async function availablePacmanVersions(pacman: string, name: string) {
|
||||||
|
const availableVersions = []
|
||||||
|
try {
|
||||||
|
const { stdout } = await execa(pacman, ["-Si", name])
|
||||||
|
|
||||||
|
for (const match of stdout.matchAll(pacmanSiVersionRegex)) {
|
||||||
|
availableVersions.push(match[1])
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
warning(`Failed to get available versions for ${name}: ${err}`)
|
||||||
|
}
|
||||||
|
return availableVersions
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
@ -8,6 +7,7 @@ import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python"
|
||||||
import { addPath } from "../env/addEnv"
|
import { addPath } from "../env/addEnv"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
let python: string | undefined
|
let python: string | undefined
|
||||||
let binDirs: string[] | undefined
|
let binDirs: string[] | undefined
|
||||||
|
|
||||||
|
@ -37,9 +37,8 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
||||||
async function findBinDir(dirs: string[], name: string) {
|
async function findBinDir(dirs: string[], name: string) {
|
||||||
const exists = await Promise.all(dirs.map((dir) => pathExists(join(dir, addExeExt(name)))))
|
const exists = await Promise.all(dirs.map((dir) => pathExists(join(dir, addExeExt(name)))))
|
||||||
const dirIndex = exists.findIndex((exist) => exist)
|
const dirIndex = exists.findIndex((exist) => exist)
|
||||||
const foundDir = dirs[dirIndex]
|
if (dirIndex !== -1) {
|
||||||
|
const foundDir = dirs[dirIndex]
|
||||||
if (foundDir !== undefined) {
|
|
||||||
return foundDir
|
return foundDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,13 @@ import { info } from "ci-log"
|
||||||
export function getSpecificVersions(versions: Set<string>, semversion: string): string[] {
|
export function getSpecificVersions(versions: Set<string>, semversion: string): string[] {
|
||||||
return Array.from(versions)
|
return Array.from(versions)
|
||||||
.filter((v) => /^\d+\.\d+\.\d+$/.test(v) && v.startsWith(semversion))
|
.filter((v) => /^\d+\.\d+\.\d+$/.test(v) && v.startsWith(semversion))
|
||||||
.sort()
|
.sort((a, b) => {
|
||||||
|
try {
|
||||||
|
return semverCompare(a, b)
|
||||||
|
} catch (err) {
|
||||||
|
return a.localeCompare(b)
|
||||||
|
}
|
||||||
|
})
|
||||||
.reverse()
|
.reverse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,11 +64,12 @@ export async function getSpecificVersionAndUrl(
|
||||||
|
|
||||||
const offlineUrls: string[] = []
|
const offlineUrls: string[] = []
|
||||||
|
|
||||||
|
// TODO use Promise.any
|
||||||
for (const specificVersion of getSpecificVersions(versions, version)) {
|
for (const specificVersion of getSpecificVersions(versions, version)) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const url = await getUrl(platform, specificVersion)
|
const url = await getUrl(platform, specificVersion)
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
if (url !== null) {
|
if (url !== null) {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
if (await isUrlOnline(url)) {
|
if (await isUrlOnline(url)) {
|
||||||
return [specificVersion, url]
|
return [specificVersion, url]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,12 +21,14 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
// vcpkg download and extraction dependencies
|
// vcpkg download and extraction dependencies
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
setupPacmanPack("curl")
|
await Promise.all([
|
||||||
setupPacmanPack("zip")
|
setupPacmanPack("curl"),
|
||||||
setupPacmanPack("unzip")
|
setupPacmanPack("zip"),
|
||||||
setupPacmanPack("tar")
|
setupPacmanPack("unzip"),
|
||||||
setupPacmanPack("git")
|
setupPacmanPack("tar"),
|
||||||
setupPacmanPack("pkg-config")
|
setupPacmanPack("git"),
|
||||||
|
setupPacmanPack("pkg-config"),
|
||||||
|
])
|
||||||
} else if (hasDnf()) {
|
} else if (hasDnf()) {
|
||||||
setupDnfPack("curl")
|
setupDnfPack("curl")
|
||||||
setupDnfPack("zip")
|
setupDnfPack("zip")
|
||||||
|
|
|
@ -24,7 +24,7 @@ export const DefaultVersions: Record<string, string> = {
|
||||||
gcovr: "5.2", // https://pypi.org/project/gcovr/
|
gcovr: "5.2", // https://pypi.org/project/gcovr/
|
||||||
conan: "1.60.0", // https://github.com/conan-io/conan/releases
|
conan: "1.60.0", // https://github.com/conan-io/conan/releases
|
||||||
meson: "1.0.2", // https://github.com/mesonbuild/meson/releases
|
meson: "1.0.2", // https://github.com/mesonbuild/meson/releases
|
||||||
kcov: "40", // https://github.com/SimonKagstrom/kcov/releases
|
kcov: "41", // https://github.com/SimonKagstrom/kcov/releases
|
||||||
task: "3.25.0", // https://github.com/go-task/task/releases
|
task: "3.25.0", // https://github.com/go-task/task/releases
|
||||||
doxygen: isArch() ? "1.9.6-1" : "1.9.7", // https://www.doxygen.nl/download.html // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=doxygen // https://formulae.brew.sh/formula/doxygen // https://archlinux.org/packages/extra/x86_64/doxygen/
|
doxygen: isArch() ? "1.9.6-1" : "1.9.7", // https://www.doxygen.nl/download.html // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=doxygen // https://formulae.brew.sh/formula/doxygen // https://archlinux.org/packages/extra/x86_64/doxygen/
|
||||||
gcc: isArch() ? "13.1.1-1" : "13", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
|
gcc: isArch() ? "13.1.1-1" : "13", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
|
||||||
|
@ -35,7 +35,7 @@ export const DefaultVersions: Record<string, string> = {
|
||||||
// - the older ones use ""
|
// - the older ones use ""
|
||||||
export const DefaultLinuxVersion: Record<string, Record<number, string>> = {
|
export const DefaultLinuxVersion: Record<string, Record<number, string>> = {
|
||||||
gcc: {
|
gcc: {
|
||||||
22: "12",
|
22: "13",
|
||||||
20: "11",
|
20: "11",
|
||||||
18: "11",
|
18: "11",
|
||||||
16: "11",
|
16: "11",
|
||||||
|
|
Loading…
Reference in New Issue