mirror of https://github.com/aminya/setup-cpp
Merge pull request #186 from aminya/test-timeout [skip ci]
This commit is contained in:
commit
e52c868d65
|
@ -10,9 +10,133 @@ on:
|
|||
- "*"
|
||||
|
||||
jobs:
|
||||
Test:
|
||||
name: ${{ matrix.os }}
|
||||
Build:
|
||||
runs-on: ubuntu-22.04
|
||||
name: Build
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-22.04
|
||||
node:
|
||||
- 20
|
||||
pnpm:
|
||||
- 8
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
./node_modules
|
||||
./.parcel-cache
|
||||
key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-cache-OS:${{ matrix.os }}-"
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Setup Pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: ${{ matrix.pnpm }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
pnpm install
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm build
|
||||
pnpm build.docker_tests
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
pnpm run test.lint
|
||||
|
||||
- name: Upload Dist
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: |
|
||||
./dist
|
||||
./packages/*/dist
|
||||
./dev/docker/__tests__/
|
||||
retention-days: 1
|
||||
|
||||
BuildExecutable:
|
||||
name: Build-Executable-${{ matrix.os }}
|
||||
needs: [Build]
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2022
|
||||
- ubuntu-22.04
|
||||
- macos-12
|
||||
node:
|
||||
- 20
|
||||
pnpm:
|
||||
- 8
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Setup Pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: ${{ matrix.pnpm }}
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
./node_modules
|
||||
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
pnpm install
|
||||
|
||||
# Create self-contained executable that bundles Nodejs
|
||||
- name: Create Executable
|
||||
run: |
|
||||
pnpm run pack.exe
|
||||
|
||||
- name: Upload Executables
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: exe
|
||||
path: |
|
||||
./exe
|
||||
retention-days: 1
|
||||
|
||||
Test:
|
||||
name: Test-${{ matrix.os }}
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') || !contains(github.event.head_commit.message, '[skip test]') }}
|
||||
needs: [Build]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -33,16 +157,10 @@ jobs:
|
|||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
- name: Download Dist
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
./node_modules
|
||||
key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-cache-OS:${{ matrix.os }}-"
|
||||
name: dist
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -54,33 +172,28 @@ jobs:
|
|||
with:
|
||||
version: ${{ matrix.pnpm }}
|
||||
|
||||
- name: Install and build
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
./node_modules
|
||||
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
pnpm install
|
||||
|
||||
# - name: Setup SSH debugging session
|
||||
# uses: mxschmitt/action-tmate@v3
|
||||
|
||||
- name: Test
|
||||
if: "${{ !contains(github.event.head_commit.message, '[skip test]') }}"
|
||||
- name: Tests
|
||||
run: |
|
||||
pnpm run test
|
||||
|
||||
# Create self-contained executable that bundles Nodejs
|
||||
- name: Create Executable
|
||||
if: "${{ contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}"
|
||||
run: |
|
||||
pnpm run pack.exe
|
||||
|
||||
- name: Upload Artifacts
|
||||
if: ${{ (startsWith(github.ref, 'refs/tags/')) && contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: |
|
||||
./exe
|
||||
./dist
|
||||
retention-days: 1
|
||||
|
||||
- name: Setup Node 12
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
|
@ -97,38 +210,10 @@ jobs:
|
|||
run: |
|
||||
node ./dist/actions/setup-cpp.js --help
|
||||
|
||||
Release:
|
||||
needs: Test
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Place Artifacts
|
||||
run: |
|
||||
mv -v artifact/* ./
|
||||
chmod +x -R ./exe/
|
||||
|
||||
- name: Draft the release
|
||||
uses: meeDamian/github-release@2.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
gzip: folders
|
||||
draft: true
|
||||
files: >
|
||||
./exe/setup-cpp-x64-windows.exe
|
||||
./exe/setup-cpp-x64-linux
|
||||
./exe/setup-cpp-x64-macos
|
||||
./dist/legacy/setup-cpp.js
|
||||
./dist/legacy/setup-cpp.js.map
|
||||
./dist/legacy/
|
||||
./dist/actions/
|
||||
./dist/modern/
|
||||
|
||||
Docker:
|
||||
name: ${{ matrix.container }}
|
||||
name: Test-${{ matrix.container }}
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
|
||||
needs: [Build]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -151,33 +236,43 @@ jobs:
|
|||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
- name: Download Dist
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
./node_modules
|
||||
key: "setupcpp-docker-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-docker-cache-OS:${{ matrix.os }}"
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Setup Pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: ${{ matrix.pnpm }}
|
||||
|
||||
- name: Install and build
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm build.docker_tests
|
||||
name: dist
|
||||
|
||||
- name: Build
|
||||
id: docker_build
|
||||
run: |
|
||||
docker build -f ./dev/docker/__tests__/${{ matrix.container }} -t setup-cpp .
|
||||
|
||||
Release:
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: [Build, BuildExecutable, Test, Docker]
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Download All Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Place Artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
mv -v ./dist/* ./
|
||||
mv -v ./exe/* ./
|
||||
chmod +x -R ./exe/
|
||||
|
||||
- name: Draft the release
|
||||
uses: meeDamian/github-release@2.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
gzip: folders
|
||||
draft: true
|
||||
files: >
|
||||
./exe/setup-cpp-x64-windows.exe
|
||||
./exe/setup-cpp-x64-linux
|
||||
./exe/setup-cpp-x64-macos
|
||||
./dist/legacy/setup-cpp.js
|
||||
./dist/legacy/setup-cpp.js.map
|
||||
./dist/legacy/
|
||||
./dist/actions/
|
||||
./dist/modern/
|
||||
|
|
|
@ -6,6 +6,8 @@ You will need [`pnpm`](https://pnpm.io/installation) to build and test `setup-cp
|
|||
pnpm install
|
||||
```
|
||||
|
||||
To avoid permenant changes to your system, you can use the test docker images under `./dev/docker/__tests__`.
|
||||
|
||||
Before running the tests locally, backup your environment variables because faulty code might corrupt the environment.
|
||||
|
||||
<https://stackoverflow.com/a/5147185/7910299>
|
||||
|
|
|
@ -19,7 +19,7 @@ async function main() {
|
|||
|
||||
// write the new file in dev/docker/__tests__
|
||||
await writeFile(`./dev/docker/__tests__/${dockerFile}.dockerfile`, newDockerFileContent)
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ function main() {
|
|||
"--",
|
||||
`{{caxa}}/node_modules/.bin/node${exe}`,
|
||||
`{{caxa}}/setup-cpp.js`,
|
||||
])
|
||||
)
|
||||
]),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
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
|
@ -1,26 +0,0 @@
|
|||
/** @typedef {import("jest")} jestConfig */
|
||||
const jestConfig = {
|
||||
preset: "ts-jest/presets/js-with-ts-esm",
|
||||
extensionsToTreatAsEsm: [".ts"],
|
||||
transformIgnorePatterns: [], // transform everything
|
||||
testEnvironment: "node",
|
||||
testMatch: ["**/*.test.ts"],
|
||||
testPathIgnorePatterns: ["<rootDir>/src/python/setup-python/"],
|
||||
// tsconfig
|
||||
transform: {
|
||||
"^.+\\.tsx?$": [
|
||||
"ts-jest",
|
||||
/** @type {import("ts-jest")} */
|
||||
{
|
||||
importHelpers: true,
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
// coverage
|
||||
collectCoverageFrom: ["src/**/*.{ts,tsx}"],
|
||||
coveragePathIgnorePatterns: ["assets", ".css.d.ts"],
|
||||
verbose: true,
|
||||
}
|
||||
|
||||
export default jestConfig
|
|
@ -0,0 +1,17 @@
|
|||
import type { Config } from "jest"
|
||||
|
||||
const jestConfig: Config = {
|
||||
testMatch: ["**/*.test.ts"],
|
||||
testEnvironment: "node",
|
||||
extensionsToTreatAsEsm: [".ts", ".tsx", ".jsx"],
|
||||
transformIgnorePatterns: [], // transform node_modules
|
||||
transform: {
|
||||
"^.+\\.(t|j)sx?$": "@swc/jest",
|
||||
},
|
||||
// coverage
|
||||
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
|
||||
coveragePathIgnorePatterns: ["assets", ".css.d.ts"],
|
||||
verbose: true,
|
||||
}
|
||||
|
||||
export default jestConfig
|
27
package.json
27
package.json
|
@ -28,10 +28,11 @@
|
|||
"tsconfig.json"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "shx rm -rf dist/ && shx mkdir -p ./dist/legacy ./dist/actions ./dist/modern && 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.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",
|
||||
"bump": "ncu -u -x numerous && pnpm update",
|
||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||
"clean": "shx rm -rf ./dist ./exe ./packages/*/dist/ && shx mkdir -p ./dist/legacy ./dist/actions ./dist/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.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/",
|
||||
|
@ -45,17 +46,16 @@
|
|||
"lint.prettier": "prettier --list-different --write .",
|
||||
"lint.tsc": "tsc --noEmit",
|
||||
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.mjs",
|
||||
"prepare": "pnpm run -r build && pnpm run -w build && rm ./dist/tsconfig.tsbuildinfo",
|
||||
"prepublishOnly": "rm ./dist/tsconfig.tsbuildinfo",
|
||||
"start.docker": "docker run -t setup-cpp .",
|
||||
"start.docker.arch": "docker run -t setup-cpp:arch .",
|
||||
"start.docker.fedora": "docker run -t setup-cpp:fedora .",
|
||||
"start.docker.ubuntu": "docker run -t setup-cpp:ubuntu .",
|
||||
"test": "run-p --continue-on-error test.lint test.unit",
|
||||
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.prettier lint.tsc",
|
||||
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
||||
"test.lint.prettier": "prettier . --check",
|
||||
"test.unit": "jest --runInBand",
|
||||
"build.docker_tests": "pnpm build && node ./dev/docker/__tests__/generate-docker-tests.mjs",
|
||||
"test": "jest",
|
||||
"build.docker_tests": "node ./dev/docker/__tests__/generate-docker-tests.mjs",
|
||||
"build.docker.arch": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch.dockerfile -t setup-cpp:arch .",
|
||||
"build.docker.fedora": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora.dockerfile -t setup-cpp:fedora .",
|
||||
"build.docker.ubuntu": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu.dockerfile -t setup-cpp:ubuntu .",
|
||||
|
@ -76,11 +76,12 @@
|
|||
"@actions/io": "^1.1.3",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@babel/cli": "^7.22.9",
|
||||
"@swc/jest": "^0.2.27",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/eslint": "^8.44.0",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/mri": "^1.1.1",
|
||||
"@types/node": "^20.4.2",
|
||||
"@types/node": "^20.4.4",
|
||||
"@types/npmcli__ci-detect": "^2.0.0",
|
||||
"@types/prettier": "2.7.3",
|
||||
"@types/semver": "^7.5.0",
|
||||
|
@ -92,7 +93,7 @@
|
|||
"ci-log": "workspace:*",
|
||||
"cross-env": "7.0.3",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"cspell": "^6.31.1",
|
||||
"cspell": "^6.31.2",
|
||||
"escape-path-with-spaces": "^1.0.2",
|
||||
"escape-quotes": "^1.0.2",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
|
@ -100,7 +101,7 @@
|
|||
"eslint-config-atomic": "^1.19.3",
|
||||
"exec-powershell": "workspace:*",
|
||||
"execa": "^7.1.1",
|
||||
"fast-glob": "^3.3.0",
|
||||
"fast-glob": "^3.3.1",
|
||||
"find-up": "^6.3.0",
|
||||
"gen-readme": "^1.6.0",
|
||||
"is-url-online": "^1.5.0",
|
||||
|
@ -108,19 +109,19 @@
|
|||
"micro-memoize": "^4.1.2",
|
||||
"mri": "^1.2.0",
|
||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||
"npm-check-updates": "^16.10.15",
|
||||
"npm-check-updates": "^16.10.16",
|
||||
"npm-run-all2": "^6.0.6",
|
||||
"numerous": "1.0.3",
|
||||
"parcel": "2.9.3",
|
||||
"path-exists": "^5.0.0",
|
||||
"patha": "^0.4.1",
|
||||
"prettier": "2.8.8",
|
||||
"prettier": "3.0.0",
|
||||
"prettier-config-atomic": "^3.1.0",
|
||||
"quote-unquote": "^1.0.0",
|
||||
"readme-md-generator": "^1.0.0",
|
||||
"retry-as-promised": "^7.0.4",
|
||||
"semver": "7.5.3",
|
||||
"setup-python": "github:actions/setup-python#v4.6.1",
|
||||
"semver": "7.5.4",
|
||||
"setup-python": "github:actions/setup-python#v4.7.0",
|
||||
"shx": "0.3.4",
|
||||
"simple-update-notifier": "^2.0.0",
|
||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||
|
|
|
@ -17,7 +17,7 @@ let powershell: string | undefined
|
|||
export function execPowershell(
|
||||
command: string,
|
||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||
execOptions: execa.Options = { stdio: "inherit" }
|
||||
execOptions: execa.Options = { stdio: "inherit" },
|
||||
): execa.ExecaChildProcess<string> {
|
||||
return execa.execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export function execPowershell(
|
|||
export function execPowershellSync(
|
||||
command: string,
|
||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||
execOptions: execa.SyncOptions = { stdio: "inherit" }
|
||||
execOptions: execa.SyncOptions = { stdio: "inherit" },
|
||||
): execa.ExecaSyncReturnValue<string> {
|
||||
return execa.execaSync(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||
}
|
||||
|
|
593
pnpm-lock.yaml
593
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,7 @@ export async function setupBazel(version: string, _setupDir: string, _arch: stri
|
|||
// https://bazel.build/install/ubuntu
|
||||
const keyFileName = await addAptKeyViaDownload(
|
||||
"bazel-archive-keyring.gpg",
|
||||
"https://bazel.build/bazel-release.pub.gpg"
|
||||
"https://bazel.build/bazel-release.pub.gpg",
|
||||
)
|
||||
execRootSync("bash", [
|
||||
"-c",
|
||||
|
|
|
@ -14,7 +14,7 @@ export async function setupChocolatey(
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_setupDir: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_arch: string
|
||||
_arch: string,
|
||||
): Promise<InstallationInfo | undefined> {
|
||||
if (process.platform !== "win32") {
|
||||
return undefined
|
||||
|
@ -50,7 +50,7 @@ export async function setupChocolatey(
|
|||
"-Command",
|
||||
"[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))",
|
||||
],
|
||||
{ stdio: "inherit" }
|
||||
{ stdio: "inherit" },
|
||||
)
|
||||
|
||||
const chocoPath = `${process.env.ALLUSERSPROFILE}\\chocolatey\\bin`
|
||||
|
|
|
@ -39,7 +39,7 @@ All the available tools:
|
|||
coverage: { tools: `--gcovr, --opencppcoverage, --kcov` },
|
||||
other: { tools: `--python, --powershell, --sevenzip` },
|
||||
},
|
||||
["tools"]
|
||||
["tools"],
|
||||
)
|
||||
}
|
||||
/** Get an object from github actions */
|
||||
|
|
|
@ -34,7 +34,7 @@ export async function installCompiler(
|
|||
arch: string,
|
||||
successMessages: string[],
|
||||
hasLLVM: boolean,
|
||||
errorMessages: string[]
|
||||
errorMessages: string[],
|
||||
) {
|
||||
try {
|
||||
const { compiler, version } = getCompilerInfo(compilerAndVersion)
|
||||
|
@ -48,7 +48,7 @@ export async function installCompiler(
|
|||
const installationInfo = await setupLLVM(
|
||||
getVersion("llvm", version, osVersion),
|
||||
join(setupCppDir, "llvm"),
|
||||
arch
|
||||
arch,
|
||||
)
|
||||
|
||||
await activateGcovLLVM()
|
||||
|
@ -87,7 +87,7 @@ export async function installCompiler(
|
|||
const installationInfo = await setupMSVC(
|
||||
getVersion("msvc", version, osVersion),
|
||||
join(setupCppDir, "msvc"),
|
||||
arch
|
||||
arch,
|
||||
)
|
||||
|
||||
if (hasLLVM) {
|
||||
|
|
|
@ -16,7 +16,7 @@ describe("setup-doxygen", () => {
|
|||
const installInfo = await setupDoxygen(
|
||||
getVersion("doxygen", undefined, await ubuntuVersion()),
|
||||
directory,
|
||||
process.arch
|
||||
process.arch,
|
||||
)
|
||||
|
||||
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
|
|
|
@ -55,7 +55,7 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
|||
() => {
|
||||
return setupChocoPack("doxygen.install", version)
|
||||
},
|
||||
{ name: "doxygen.install", max: 4, backoffBase: 2000, report: (err) => info(err) }
|
||||
{ name: "doxygen.install", max: 4, backoffBase: 2000, report: (err) => info(err) },
|
||||
)
|
||||
const binDir = await activateWinDoxygen()
|
||||
const installationInfo = { binDir }
|
||||
|
|
|
@ -222,7 +222,7 @@ async function activateGcc(version: string, binDir: string) {
|
|||
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`),
|
||||
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`),
|
||||
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`),
|
||||
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`)
|
||||
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
@ -233,7 +233,7 @@ async function activateGcc(version: string, binDir: string) {
|
|||
updateAptAlternatives("cc", `${binDir}/gcc-${version}`),
|
||||
updateAptAlternatives("cxx", `${binDir}/g++-${version}`),
|
||||
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`),
|
||||
updateAptAlternatives("g++", `${binDir}/g++-${version}`)
|
||||
updateAptAlternatives("g++", `${binDir}/g++-${version}`),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ describe("setup-graphviz", () => {
|
|||
const installInfo = await setupGraphviz(
|
||||
getVersion("graphviz", undefined, await ubuntuVersion()),
|
||||
directory,
|
||||
process.arch
|
||||
process.arch,
|
||||
)
|
||||
|
||||
await testBin("dot", ["-V"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
|
|
|
@ -42,21 +42,6 @@ describe("setup-Kcov", () => {
|
|||
await cleanupTmpDir("kcov-v40")
|
||||
})
|
||||
|
||||
it("should build and setup Kcov v39", async () => {
|
||||
const directory = await setupTmpDir("kcov-v39")
|
||||
const { binDir } = (await setupKcov("39", directory, "")) as InstallationInfo
|
||||
await testBin("kcov", ["--version"], binDir)
|
||||
await cleanupTmpDir("kcov-v39")
|
||||
})
|
||||
|
||||
// it("should find Kcov in the cache", async () => {
|
||||
// const binDir = await testKcov("v39", directory)
|
||||
// if (GITHUB_ACTIONS) {
|
||||
// expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||
// }
|
||||
// await cleanupTmpDir("kcov-v39")
|
||||
// })
|
||||
|
||||
it("should build and setup Kcov v38", async () => {
|
||||
try {
|
||||
const directory2 = await setupTmpDir("kcov-v38")
|
||||
|
|
|
@ -82,7 +82,7 @@ async function getCmake() {
|
|||
const { binDir } = await setupCmake(
|
||||
getVersion("cmake", undefined, await ubuntuVersion()),
|
||||
join(untildifyUser(""), "cmake"),
|
||||
""
|
||||
"",
|
||||
)
|
||||
cmake = join(binDir, "cmake")
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import { setupLLVM, setupClangTools } from "../llvm"
|
|||
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||
import { isUrlOnline } from "is-url-online"
|
||||
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||
import { GITHUB_ACTIONS } from "ci-info"
|
||||
import { execaSync } from "execa"
|
||||
import path, { addExeExt } from "patha"
|
||||
import { chmodSync } from "fs"
|
||||
|
@ -29,24 +28,24 @@ describe("setup-llvm", () => {
|
|||
it("Finds URL for ubuntu version", async () => {
|
||||
expect(
|
||||
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.0-ubuntu-16.04", (_plantform, version) =>
|
||||
getLinuxUrl(version)
|
||||
)
|
||||
getLinuxUrl(version),
|
||||
),
|
||||
).toStrictEqual([
|
||||
"13.0.0-ubuntu-16.04",
|
||||
"https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz",
|
||||
])
|
||||
expect(
|
||||
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.1-ubuntu-18.04", (_plantform, version) =>
|
||||
getLinuxUrl(version)
|
||||
)
|
||||
getLinuxUrl(version),
|
||||
),
|
||||
).toStrictEqual([
|
||||
"13.0.1-ubuntu-18.04",
|
||||
"https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz",
|
||||
])
|
||||
expect(
|
||||
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.0-ubuntu-20.04", (_plantform, version) =>
|
||||
getLinuxUrl(version)
|
||||
)
|
||||
getLinuxUrl(version),
|
||||
),
|
||||
).toStrictEqual([
|
||||
"13.0.0-ubuntu-20.04",
|
||||
"https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz",
|
||||
|
@ -77,7 +76,7 @@ describe("setup-llvm", () => {
|
|||
"5",
|
||||
"5.0.0",
|
||||
"4",
|
||||
].map((version) => testUrl(version))
|
||||
].map((version) => testUrl(version)),
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -99,25 +98,6 @@ describe("setup-llvm", () => {
|
|||
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||
})
|
||||
|
||||
it("should find llvm in the cache", async () => {
|
||||
const osVersion = await ubuntuVersion()
|
||||
const { binDir } = await setupLLVM(getVersion("llvm", "true", osVersion), directory, process.arch)
|
||||
await testBin("clang++", ["--version"], binDir)
|
||||
|
||||
if (GITHUB_ACTIONS && process.platform !== "linux") {
|
||||
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||
// TODO returns the install dir on linux
|
||||
}
|
||||
|
||||
expect(process.env.CC?.includes("clang")).toBeTruthy()
|
||||
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
||||
|
||||
if (GITHUB_ACTIONS && process.platform !== "linux") {
|
||||
expect(process.env.CC).toMatch("hostedtoolcache")
|
||||
expect(process.env.CXX).toMatch("hostedtoolcache")
|
||||
}
|
||||
})
|
||||
|
||||
it("should setup clang-tidy and clang-format", async () => {
|
||||
const osVersion = await ubuntuVersion()
|
||||
const { binDir } = await setupClangTools(getVersion("llvm", "true", osVersion), directory, process.arch)
|
||||
|
|
|
@ -22,10 +22,7 @@ export async function setupLLVM(version: string, setupDir: string, arch: string)
|
|||
return installationInfo
|
||||
}
|
||||
|
||||
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
|
||||
export const setupClangTools = setupLLVMWithoutActivation
|
||||
|
||||
async function setupLLVMWithoutActivation(version: string, setupDir: string, arch: string) {
|
||||
async function setupLLVMWithoutActivation_raw(version: string, setupDir: string, arch: string) {
|
||||
// install LLVM and its dependencies in parallel
|
||||
const [installationInfo, _1, _2] = await Promise.all([
|
||||
setupLLVMOnly(version, setupDir, arch),
|
||||
|
@ -35,6 +32,10 @@ async function setupLLVMWithoutActivation(version: string, setupDir: string, arc
|
|||
|
||||
return installationInfo
|
||||
}
|
||||
const setupLLVMWithoutActivation = memoize(setupLLVMWithoutActivation_raw, { isPromise: true })
|
||||
|
||||
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
|
||||
export const setupClangTools = setupLLVMWithoutActivation
|
||||
|
||||
async function setupLLVMOnly(version: string, setupDir: string, arch: string) {
|
||||
const coeredVersion = semverCoerceIfInvalid(version)
|
||||
|
@ -115,7 +116,7 @@ export async function activateLLVM(directory: string) {
|
|||
updateAptAlternatives("clang++", `${directory}/bin/clang++`),
|
||||
updateAptAlternatives("lld", `${directory}/bin/lld`),
|
||||
updateAptAlternatives("ld.lld", `${directory}/bin/ld.lld`),
|
||||
updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`)
|
||||
updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ function nonInteractiveScript(givenScript: string) {
|
|||
return givenScript.replace(
|
||||
/add-apt-repository "\${REPO_NAME}"/g,
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
'add-apt-repository -y "${REPO_NAME}"'
|
||||
'add-apt-repository -y "${REPO_NAME}"',
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ async function removeConflictingPAckages(givenScript: string) {
|
|||
// fix conflicts between libclang-rt and libclang
|
||||
let script = givenScript.replace(
|
||||
/apt-get install -y/g,
|
||||
'apt-get install -o Dpkg::Options::="--force-overwrite" -y --fix-broken'
|
||||
'apt-get install -o Dpkg::Options::="--force-overwrite" -y --fix-broken',
|
||||
)
|
||||
|
||||
// check if these are installed and if so, remove them from the script as they conflict
|
||||
|
@ -67,7 +67,7 @@ async function removeConflictingPAckages(givenScript: string) {
|
|||
info(`Removing conflicting package ${installingPack}`)
|
||||
script = script.replace(pack, "")
|
||||
}
|
||||
})
|
||||
}),
|
||||
)
|
||||
return script
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ export async function getLLVMPackageInfo(
|
|||
version: string,
|
||||
platform: NodeJS.Platform,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_arch: string
|
||||
_arch: string,
|
||||
): Promise<PackageInfo> {
|
||||
const [specificVersion, url] = await getSpecificVersionAndUrl(VERSIONS, platform, version, getUrl)
|
||||
info(`specific llvm version: ${specificVersion}`)
|
||||
|
|
|
@ -17,7 +17,7 @@ export async function setupMSVC(
|
|||
arch: string,
|
||||
sdk?: string,
|
||||
uwp?: boolean,
|
||||
spectre?: boolean
|
||||
spectre?: boolean,
|
||||
) {
|
||||
if (process.platform !== "win32") {
|
||||
return
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function setupNala(version: string, _setupDir: string, _arch: strin
|
|||
// https://github.com/volitank/nala#-installation
|
||||
const keyFileName = await addAptKeyViaDownload(
|
||||
"volian-archive-scar-unstable.gpg",
|
||||
"https://deb.volian.org/volian/scar.key"
|
||||
"https://deb.volian.org/volian/scar.key",
|
||||
)
|
||||
execRootSync("/bin/bash", [
|
||||
"-c",
|
||||
|
|
|
@ -38,7 +38,7 @@ export async function installTool(
|
|||
arch: string,
|
||||
setupCppDir: string,
|
||||
successMessages: string[],
|
||||
errorMessages: string[]
|
||||
errorMessages: string[],
|
||||
) {
|
||||
startGroup(`Installing ${tool} ${version}`)
|
||||
let hasLLVM = false
|
||||
|
|
|
@ -30,7 +30,7 @@ const defaultAddEnvOptions: AddEnvOptions = {
|
|||
export async function addEnv(
|
||||
name: string,
|
||||
valGiven: string | undefined,
|
||||
options: AddEnvOptions = defaultAddEnvOptions
|
||||
options: AddEnvOptions = defaultAddEnvOptions,
|
||||
) {
|
||||
const val = escapeString(valGiven ?? "", options.shouldEscapeSpace)
|
||||
try {
|
||||
|
@ -126,7 +126,7 @@ async function addPathSystem(path: string) {
|
|||
case "win32": {
|
||||
// We do not use `execaSync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
||||
await execPowershell(
|
||||
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
||||
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`,
|
||||
)
|
||||
info(`"${path}" was added to the PATH.`)
|
||||
return
|
||||
|
|
|
@ -169,7 +169,7 @@ async function initApt(apt: string) {
|
|||
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
||||
promises.push(
|
||||
addEnv("LANG", "C.UTF-8", { shouldAddOnlyIfNotDefined: true }),
|
||||
addEnv("LC_ALL", "C.UTF-8", { shouldAddOnlyIfNotDefined: true })
|
||||
addEnv("LC_ALL", "C.UTF-8", { shouldAddOnlyIfNotDefined: true }),
|
||||
)
|
||||
}
|
||||
await Promise.all(promises)
|
||||
|
@ -197,7 +197,7 @@ export async function addAptKeyViaServer(keys: string[], name: string, server =
|
|||
key,
|
||||
])
|
||||
await execRoot("chmod", ["644", fileName])
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
return fileName
|
||||
|
@ -226,7 +226,7 @@ export async function updateAptAlternatives(name: string, path: string) {
|
|||
await setupCppInProfile()
|
||||
return appendFile(
|
||||
cpprc_path,
|
||||
`\nif [ $UID -eq 0 ]; then update-alternatives --install /usr/bin/${name} ${name} ${path} 40; fi\n`
|
||||
`\nif [ $UID -eq 0 ]; then update-alternatives --install /usr/bin/${name} ${name} ${path} 40; fi\n`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export async function setupBin(
|
|||
version: string,
|
||||
getPackageInfo: (version: string, platform: NodeJS.Platform, arch: string) => PackageInfo | Promise<PackageInfo>,
|
||||
setupDir: string,
|
||||
arch: string
|
||||
arch: string,
|
||||
): Promise<InstallationInfo> {
|
||||
info(`Installing ${name} ${version} ${arch} via direct downloading`)
|
||||
|
||||
|
@ -63,7 +63,7 @@ export async function setupBin(
|
|||
const { url, binRelativeDir, binFileName, extractedFolderName, extractFunction } = await getPackageInfo(
|
||||
version,
|
||||
process.platform,
|
||||
arch
|
||||
arch,
|
||||
)
|
||||
|
||||
// Restore from cache (if found).
|
||||
|
@ -98,7 +98,7 @@ export async function setupBin(
|
|||
() => {
|
||||
return downloadTool(url)
|
||||
},
|
||||
{ name: url, max: 4, backoffBase: 2000, report: (err) => info(err) }
|
||||
{ name: url, max: 4, backoffBase: 2000, report: (err) => info(err) },
|
||||
)
|
||||
|
||||
if (!didInit) {
|
||||
|
|
|
@ -12,7 +12,7 @@ let hasBrew = false
|
|||
export async function setupBrewPack(
|
||||
name: string,
|
||||
version?: string,
|
||||
extraArgs: string[] = []
|
||||
extraArgs: string[] = [],
|
||||
): Promise<InstallationInfo> {
|
||||
info(`Installing ${name} ${version ?? ""} via brew`)
|
||||
|
||||
|
@ -29,7 +29,7 @@ export async function setupBrewPack(
|
|||
["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs],
|
||||
{
|
||||
stdio: "inherit",
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
return { binDir }
|
||||
|
|
|
@ -19,7 +19,7 @@ export async function setupPipPackWithPython(
|
|||
givenPython: string,
|
||||
name: string,
|
||||
version?: string,
|
||||
upgrade = false
|
||||
upgrade = false,
|
||||
): Promise<InstallationInfo> {
|
||||
info(`Installing ${name} ${version ?? ""} via pip`)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ export async function getSpecificVersionAndUrl(
|
|||
versions: Set<string>,
|
||||
platform: string,
|
||||
version: string,
|
||||
getUrl: (platform: string, version: string) => string | null | Promise<string | null>
|
||||
getUrl: (platform: string, version: string) => string | null | Promise<string | null>,
|
||||
): Promise<[string, string]> {
|
||||
// specific ubuntu version
|
||||
if (platform === "linux" && version.includes("ubuntu")) {
|
||||
|
@ -57,8 +57,8 @@ export async function getSpecificVersionAndUrl(
|
|||
if (!versions.has(version)) {
|
||||
throw new Error(
|
||||
`Unsupported target! (platform='${platform}', version='${version}'). Try one of the following: ${JSON.stringify(
|
||||
versions
|
||||
)}`
|
||||
versions,
|
||||
)}`,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -80,8 +80,8 @@ export async function getSpecificVersionAndUrl(
|
|||
|
||||
throw new Error(
|
||||
`Unsupported target! (platform='${platform}', version='${version}'). Try one of the following: ${JSON.stringify(
|
||||
versions
|
||||
)}`
|
||||
versions,
|
||||
)}`,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ export async function getBinVersion(file: string, versionRegex: RegExp = default
|
|||
export async function isBinUptoDate(
|
||||
givenFile: string,
|
||||
targetVersion: string,
|
||||
versionRegex: RegExp = defaultVersionRegex
|
||||
versionRegex: RegExp = defaultVersionRegex,
|
||||
) {
|
||||
const givenVersion = await getBinVersion(givenFile, versionRegex)
|
||||
if (givenVersion !== undefined && targetVersion !== "") {
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function cleanupTmpDir(testName: string) {
|
|||
export async function testBin(
|
||||
name: string,
|
||||
args: string[] | null = ["--version"],
|
||||
binDir: string | undefined = undefined
|
||||
binDir: string | undefined = undefined,
|
||||
) {
|
||||
try {
|
||||
let bin = name
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function setupVCVarsall(
|
|||
toolset: string | undefined,
|
||||
sdk?: string,
|
||||
uwp?: boolean,
|
||||
spectre?: boolean
|
||||
spectre?: boolean,
|
||||
) {
|
||||
if (VCTargetsPath !== undefined && (await pathExists(VCTargetsPath))) {
|
||||
info(`Adding ${VCTargetsPath} to PATH`)
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
"./src",
|
||||
"dev/scripts",
|
||||
"packages/untildify-user/untildify.ts",
|
||||
"dev/docker/__tests__/generate-docker-tests.mjs"
|
||||
"dev/docker/__tests__/generate-docker-tests.mjs",
|
||||
"./jest.config.ts"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue