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:
|
jobs:
|
||||||
Test:
|
Build:
|
||||||
name: ${{ matrix.os }}
|
runs-on: ubuntu-22.04
|
||||||
|
name: Build
|
||||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
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 }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -33,16 +157,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Cache
|
- name: Download Dist
|
||||||
uses: actions/cache@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
name: dist
|
||||||
~/.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: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
@ -54,33 +172,28 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.pnpm }}
|
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: |
|
run: |
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
# - name: Setup SSH debugging session
|
# - name: Setup SSH debugging session
|
||||||
# uses: mxschmitt/action-tmate@v3
|
# uses: mxschmitt/action-tmate@v3
|
||||||
|
|
||||||
- name: Test
|
- name: Tests
|
||||||
if: "${{ !contains(github.event.head_commit.message, '[skip test]') }}"
|
|
||||||
run: |
|
run: |
|
||||||
pnpm run test
|
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
|
- name: Setup Node 12
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
@ -97,38 +210,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
node ./dist/actions/setup-cpp.js --help
|
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:
|
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]') }}
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
|
||||||
|
needs: [Build]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -151,33 +236,43 @@ jobs:
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Cache
|
- name: Download Dist
|
||||||
uses: actions/cache@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
name: dist
|
||||||
~/.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: Build
|
- name: Build
|
||||||
id: docker_build
|
id: docker_build
|
||||||
run: |
|
run: |
|
||||||
docker build -f ./dev/docker/__tests__/${{ matrix.container }} -t setup-cpp .
|
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
|
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.
|
Before running the tests locally, backup your environment variables because faulty code might corrupt the environment.
|
||||||
|
|
||||||
<https://stackoverflow.com/a/5147185/7910299>
|
<https://stackoverflow.com/a/5147185/7910299>
|
||||||
|
|
|
@ -19,7 +19,7 @@ async function main() {
|
||||||
|
|
||||||
// write the new file in dev/docker/__tests__
|
// write the new file in dev/docker/__tests__
|
||||||
await writeFile(`./dev/docker/__tests__/${dockerFile}.dockerfile`, newDockerFileContent)
|
await writeFile(`./dev/docker/__tests__/${dockerFile}.dockerfile`, newDockerFileContent)
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ function main() {
|
||||||
"--",
|
"--",
|
||||||
`{{caxa}}/node_modules/.bin/node${exe}`,
|
`{{caxa}}/node_modules/.bin/node${exe}`,
|
||||||
`{{caxa}}/setup-cpp.js`,
|
`{{caxa}}/setup-cpp.js`,
|
||||||
])
|
]),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
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"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"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",
|
"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",
|
"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": "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/",
|
||||||
|
@ -45,17 +46,16 @@
|
||||||
"lint.prettier": "prettier --list-different --write .",
|
"lint.prettier": "prettier --list-different --write .",
|
||||||
"lint.tsc": "tsc --noEmit",
|
"lint.tsc": "tsc --noEmit",
|
||||||
"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",
|
||||||
"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": "docker run -t setup-cpp .",
|
||||||
"start.docker.arch": "docker run -t setup-cpp:arch .",
|
"start.docker.arch": "docker run -t setup-cpp:arch .",
|
||||||
"start.docker.fedora": "docker run -t setup-cpp:fedora .",
|
"start.docker.fedora": "docker run -t setup-cpp:fedora .",
|
||||||
"start.docker.ubuntu": "docker run -t setup-cpp:ubuntu .",
|
"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": "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.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.lint.prettier": "prettier . --check",
|
||||||
"test.unit": "jest --runInBand",
|
"test": "jest",
|
||||||
"build.docker_tests": "pnpm build && node ./dev/docker/__tests__/generate-docker-tests.mjs",
|
"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.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.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 .",
|
"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/io": "^1.1.3",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"@babel/cli": "^7.22.9",
|
"@babel/cli": "^7.22.9",
|
||||||
|
"@swc/jest": "^0.2.27",
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
"@types/eslint": "^8.44.0",
|
"@types/eslint": "^8.44.0",
|
||||||
"@types/jest": "^29.5.3",
|
"@types/jest": "^29.5.3",
|
||||||
"@types/mri": "^1.1.1",
|
"@types/mri": "^1.1.1",
|
||||||
"@types/node": "^20.4.2",
|
"@types/node": "^20.4.4",
|
||||||
"@types/npmcli__ci-detect": "^2.0.0",
|
"@types/npmcli__ci-detect": "^2.0.0",
|
||||||
"@types/prettier": "2.7.3",
|
"@types/prettier": "2.7.3",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
|
@ -92,7 +93,7 @@
|
||||||
"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": "^6.31.1",
|
"cspell": "^6.31.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",
|
||||||
|
@ -100,7 +101,7 @@
|
||||||
"eslint-config-atomic": "^1.19.3",
|
"eslint-config-atomic": "^1.19.3",
|
||||||
"exec-powershell": "workspace:*",
|
"exec-powershell": "workspace:*",
|
||||||
"execa": "^7.1.1",
|
"execa": "^7.1.1",
|
||||||
"fast-glob": "^3.3.0",
|
"fast-glob": "^3.3.1",
|
||||||
"find-up": "^6.3.0",
|
"find-up": "^6.3.0",
|
||||||
"gen-readme": "^1.6.0",
|
"gen-readme": "^1.6.0",
|
||||||
"is-url-online": "^1.5.0",
|
"is-url-online": "^1.5.0",
|
||||||
|
@ -108,19 +109,19 @@
|
||||||
"micro-memoize": "^4.1.2",
|
"micro-memoize": "^4.1.2",
|
||||||
"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.15",
|
"npm-check-updates": "^16.10.16",
|
||||||
"npm-run-all2": "^6.0.6",
|
"npm-run-all2": "^6.0.6",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
"parcel": "2.9.3",
|
"parcel": "2.9.3",
|
||||||
"path-exists": "^5.0.0",
|
"path-exists": "^5.0.0",
|
||||||
"patha": "^0.4.1",
|
"patha": "^0.4.1",
|
||||||
"prettier": "2.8.8",
|
"prettier": "3.0.0",
|
||||||
"prettier-config-atomic": "^3.1.0",
|
"prettier-config-atomic": "^3.1.0",
|
||||||
"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.3",
|
"semver": "7.5.4",
|
||||||
"setup-python": "github:actions/setup-python#v4.6.1",
|
"setup-python": "github:actions/setup-python#v4.7.0",
|
||||||
"shx": "0.3.4",
|
"shx": "0.3.4",
|
||||||
"simple-update-notifier": "^2.0.0",
|
"simple-update-notifier": "^2.0.0",
|
||||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||||
|
|
|
@ -17,7 +17,7 @@ let powershell: string | undefined
|
||||||
export function execPowershell(
|
export function execPowershell(
|
||||||
command: string,
|
command: string,
|
||||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||||
execOptions: execa.Options = { stdio: "inherit" }
|
execOptions: execa.Options = { stdio: "inherit" },
|
||||||
): execa.ExecaChildProcess<string> {
|
): execa.ExecaChildProcess<string> {
|
||||||
return execa.execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
return execa.execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export function execPowershell(
|
||||||
export function execPowershellSync(
|
export function execPowershellSync(
|
||||||
command: string,
|
command: string,
|
||||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||||
execOptions: execa.SyncOptions = { stdio: "inherit" }
|
execOptions: execa.SyncOptions = { stdio: "inherit" },
|
||||||
): execa.ExecaSyncReturnValue<string> {
|
): execa.ExecaSyncReturnValue<string> {
|
||||||
return execa.execaSync(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
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
|
// https://bazel.build/install/ubuntu
|
||||||
const keyFileName = await addAptKeyViaDownload(
|
const keyFileName = await addAptKeyViaDownload(
|
||||||
"bazel-archive-keyring.gpg",
|
"bazel-archive-keyring.gpg",
|
||||||
"https://bazel.build/bazel-release.pub.gpg"
|
"https://bazel.build/bazel-release.pub.gpg",
|
||||||
)
|
)
|
||||||
execRootSync("bash", [
|
execRootSync("bash", [
|
||||||
"-c",
|
"-c",
|
||||||
|
|
|
@ -14,7 +14,7 @@ export async function setupChocolatey(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
_setupDir: string,
|
_setupDir: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
_arch: string
|
_arch: string,
|
||||||
): Promise<InstallationInfo | undefined> {
|
): Promise<InstallationInfo | undefined> {
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -50,7 +50,7 @@ export async function setupChocolatey(
|
||||||
"-Command",
|
"-Command",
|
||||||
"[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))",
|
"[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`
|
const chocoPath = `${process.env.ALLUSERSPROFILE}\\chocolatey\\bin`
|
||||||
|
|
|
@ -39,7 +39,7 @@ All the available tools:
|
||||||
coverage: { tools: `--gcovr, --opencppcoverage, --kcov` },
|
coverage: { tools: `--gcovr, --opencppcoverage, --kcov` },
|
||||||
other: { tools: `--python, --powershell, --sevenzip` },
|
other: { tools: `--python, --powershell, --sevenzip` },
|
||||||
},
|
},
|
||||||
["tools"]
|
["tools"],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/** Get an object from github actions */
|
/** Get an object from github actions */
|
||||||
|
|
|
@ -34,7 +34,7 @@ export async function installCompiler(
|
||||||
arch: string,
|
arch: string,
|
||||||
successMessages: string[],
|
successMessages: string[],
|
||||||
hasLLVM: boolean,
|
hasLLVM: boolean,
|
||||||
errorMessages: string[]
|
errorMessages: string[],
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const { compiler, version } = getCompilerInfo(compilerAndVersion)
|
const { compiler, version } = getCompilerInfo(compilerAndVersion)
|
||||||
|
@ -48,7 +48,7 @@ export async function installCompiler(
|
||||||
const installationInfo = await setupLLVM(
|
const installationInfo = await setupLLVM(
|
||||||
getVersion("llvm", version, osVersion),
|
getVersion("llvm", version, osVersion),
|
||||||
join(setupCppDir, "llvm"),
|
join(setupCppDir, "llvm"),
|
||||||
arch
|
arch,
|
||||||
)
|
)
|
||||||
|
|
||||||
await activateGcovLLVM()
|
await activateGcovLLVM()
|
||||||
|
@ -87,7 +87,7 @@ export async function installCompiler(
|
||||||
const installationInfo = await setupMSVC(
|
const installationInfo = await setupMSVC(
|
||||||
getVersion("msvc", version, osVersion),
|
getVersion("msvc", version, osVersion),
|
||||||
join(setupCppDir, "msvc"),
|
join(setupCppDir, "msvc"),
|
||||||
arch
|
arch,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (hasLLVM) {
|
if (hasLLVM) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe("setup-doxygen", () => {
|
||||||
const installInfo = await setupDoxygen(
|
const installInfo = await setupDoxygen(
|
||||||
getVersion("doxygen", undefined, await ubuntuVersion()),
|
getVersion("doxygen", undefined, await ubuntuVersion()),
|
||||||
directory,
|
directory,
|
||||||
process.arch
|
process.arch,
|
||||||
)
|
)
|
||||||
|
|
||||||
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
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)
|
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 binDir = await activateWinDoxygen()
|
||||||
const installationInfo = { binDir }
|
const installationInfo = { binDir }
|
||||||
|
|
|
@ -222,7 +222,7 @@ async function activateGcc(version: string, binDir: string) {
|
||||||
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`),
|
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`),
|
||||||
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`),
|
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`),
|
||||||
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`),
|
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`),
|
||||||
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`)
|
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,7 +233,7 @@ async function activateGcc(version: string, binDir: string) {
|
||||||
updateAptAlternatives("cc", `${binDir}/gcc-${version}`),
|
updateAptAlternatives("cc", `${binDir}/gcc-${version}`),
|
||||||
updateAptAlternatives("cxx", `${binDir}/g++-${version}`),
|
updateAptAlternatives("cxx", `${binDir}/g++-${version}`),
|
||||||
updateAptAlternatives("gcc", `${binDir}/gcc-${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(
|
const installInfo = await setupGraphviz(
|
||||||
getVersion("graphviz", undefined, await ubuntuVersion()),
|
getVersion("graphviz", undefined, await ubuntuVersion()),
|
||||||
directory,
|
directory,
|
||||||
process.arch
|
process.arch,
|
||||||
)
|
)
|
||||||
|
|
||||||
await testBin("dot", ["-V"], (installInfo as InstallationInfo | undefined)?.binDir)
|
await testBin("dot", ["-V"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||||
|
|
|
@ -42,21 +42,6 @@ describe("setup-Kcov", () => {
|
||||||
await cleanupTmpDir("kcov-v40")
|
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 () => {
|
it("should build and setup Kcov v38", async () => {
|
||||||
try {
|
try {
|
||||||
const directory2 = await setupTmpDir("kcov-v38")
|
const directory2 = await setupTmpDir("kcov-v38")
|
||||||
|
|
|
@ -82,7 +82,7 @@ async function getCmake() {
|
||||||
const { binDir } = await setupCmake(
|
const { binDir } = await setupCmake(
|
||||||
getVersion("cmake", undefined, await ubuntuVersion()),
|
getVersion("cmake", undefined, await ubuntuVersion()),
|
||||||
join(untildifyUser(""), "cmake"),
|
join(untildifyUser(""), "cmake"),
|
||||||
""
|
"",
|
||||||
)
|
)
|
||||||
cmake = join(binDir, "cmake")
|
cmake = join(binDir, "cmake")
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { setupLLVM, setupClangTools } from "../llvm"
|
||||||
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isUrlOnline } from "is-url-online"
|
||||||
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import path, { addExeExt } from "patha"
|
import path, { addExeExt } from "patha"
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
|
@ -29,24 +28,24 @@ describe("setup-llvm", () => {
|
||||||
it("Finds URL for ubuntu version", async () => {
|
it("Finds URL for ubuntu version", async () => {
|
||||||
expect(
|
expect(
|
||||||
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.0-ubuntu-16.04", (_plantform, version) =>
|
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.0-ubuntu-16.04", (_plantform, version) =>
|
||||||
getLinuxUrl(version)
|
getLinuxUrl(version),
|
||||||
)
|
),
|
||||||
).toStrictEqual([
|
).toStrictEqual([
|
||||||
"13.0.0-ubuntu-16.04",
|
"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",
|
"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(
|
expect(
|
||||||
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.1-ubuntu-18.04", (_plantform, version) =>
|
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.1-ubuntu-18.04", (_plantform, version) =>
|
||||||
getLinuxUrl(version)
|
getLinuxUrl(version),
|
||||||
)
|
),
|
||||||
).toStrictEqual([
|
).toStrictEqual([
|
||||||
"13.0.1-ubuntu-18.04",
|
"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",
|
"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(
|
expect(
|
||||||
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.0-ubuntu-20.04", (_plantform, version) =>
|
await getSpecificVersionAndUrl(VERSIONS, "linux", "13.0.0-ubuntu-20.04", (_plantform, version) =>
|
||||||
getLinuxUrl(version)
|
getLinuxUrl(version),
|
||||||
)
|
),
|
||||||
).toStrictEqual([
|
).toStrictEqual([
|
||||||
"13.0.0-ubuntu-20.04",
|
"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",
|
"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",
|
||||||
"5.0.0",
|
"5.0.0",
|
||||||
"4",
|
"4",
|
||||||
].map((version) => testUrl(version))
|
].map((version) => testUrl(version)),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -99,25 +98,6 @@ describe("setup-llvm", () => {
|
||||||
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
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 () => {
|
it("should setup clang-tidy and clang-format", async () => {
|
||||||
const osVersion = await ubuntuVersion()
|
const osVersion = await ubuntuVersion()
|
||||||
const { binDir } = await setupClangTools(getVersion("llvm", "true", osVersion), directory, process.arch)
|
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
|
return installationInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
|
async function setupLLVMWithoutActivation_raw(version: string, setupDir: string, arch: string) {
|
||||||
export const setupClangTools = setupLLVMWithoutActivation
|
|
||||||
|
|
||||||
async function setupLLVMWithoutActivation(version: string, setupDir: string, arch: string) {
|
|
||||||
// install LLVM and its dependencies in parallel
|
// install LLVM and its dependencies in parallel
|
||||||
const [installationInfo, _1, _2] = await Promise.all([
|
const [installationInfo, _1, _2] = await Promise.all([
|
||||||
setupLLVMOnly(version, setupDir, arch),
|
setupLLVMOnly(version, setupDir, arch),
|
||||||
|
@ -35,6 +32,10 @@ async function setupLLVMWithoutActivation(version: string, setupDir: string, arc
|
||||||
|
|
||||||
return installationInfo
|
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) {
|
async function setupLLVMOnly(version: string, setupDir: string, arch: string) {
|
||||||
const coeredVersion = semverCoerceIfInvalid(version)
|
const coeredVersion = semverCoerceIfInvalid(version)
|
||||||
|
@ -115,7 +116,7 @@ export async function activateLLVM(directory: string) {
|
||||||
updateAptAlternatives("clang++", `${directory}/bin/clang++`),
|
updateAptAlternatives("clang++", `${directory}/bin/clang++`),
|
||||||
updateAptAlternatives("lld", `${directory}/bin/lld`),
|
updateAptAlternatives("lld", `${directory}/bin/lld`),
|
||||||
updateAptAlternatives("ld.lld", `${directory}/bin/ld.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(
|
return givenScript.replace(
|
||||||
/add-apt-repository "\${REPO_NAME}"/g,
|
/add-apt-repository "\${REPO_NAME}"/g,
|
||||||
// eslint-disable-next-line no-template-curly-in-string
|
// 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
|
// fix conflicts between libclang-rt and libclang
|
||||||
let script = givenScript.replace(
|
let script = givenScript.replace(
|
||||||
/apt-get install -y/g,
|
/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
|
// 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}`)
|
info(`Removing conflicting package ${installingPack}`)
|
||||||
script = script.replace(pack, "")
|
script = script.replace(pack, "")
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
return script
|
return script
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ export async function getLLVMPackageInfo(
|
||||||
version: string,
|
version: string,
|
||||||
platform: NodeJS.Platform,
|
platform: NodeJS.Platform,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
_arch: string
|
_arch: string,
|
||||||
): Promise<PackageInfo> {
|
): Promise<PackageInfo> {
|
||||||
const [specificVersion, url] = await getSpecificVersionAndUrl(VERSIONS, platform, version, getUrl)
|
const [specificVersion, url] = await getSpecificVersionAndUrl(VERSIONS, platform, version, getUrl)
|
||||||
info(`specific llvm version: ${specificVersion}`)
|
info(`specific llvm version: ${specificVersion}`)
|
||||||
|
|
|
@ -17,7 +17,7 @@ export async function setupMSVC(
|
||||||
arch: string,
|
arch: string,
|
||||||
sdk?: string,
|
sdk?: string,
|
||||||
uwp?: boolean,
|
uwp?: boolean,
|
||||||
spectre?: boolean
|
spectre?: boolean,
|
||||||
) {
|
) {
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
return
|
return
|
||||||
|
|
|
@ -24,7 +24,7 @@ export async function setupNala(version: string, _setupDir: string, _arch: strin
|
||||||
// https://github.com/volitank/nala#-installation
|
// https://github.com/volitank/nala#-installation
|
||||||
const keyFileName = await addAptKeyViaDownload(
|
const keyFileName = await addAptKeyViaDownload(
|
||||||
"volian-archive-scar-unstable.gpg",
|
"volian-archive-scar-unstable.gpg",
|
||||||
"https://deb.volian.org/volian/scar.key"
|
"https://deb.volian.org/volian/scar.key",
|
||||||
)
|
)
|
||||||
execRootSync("/bin/bash", [
|
execRootSync("/bin/bash", [
|
||||||
"-c",
|
"-c",
|
||||||
|
|
|
@ -38,7 +38,7 @@ export async function installTool(
|
||||||
arch: string,
|
arch: string,
|
||||||
setupCppDir: string,
|
setupCppDir: string,
|
||||||
successMessages: string[],
|
successMessages: string[],
|
||||||
errorMessages: string[]
|
errorMessages: string[],
|
||||||
) {
|
) {
|
||||||
startGroup(`Installing ${tool} ${version}`)
|
startGroup(`Installing ${tool} ${version}`)
|
||||||
let hasLLVM = false
|
let hasLLVM = false
|
||||||
|
|
|
@ -30,7 +30,7 @@ const defaultAddEnvOptions: AddEnvOptions = {
|
||||||
export async function addEnv(
|
export async function addEnv(
|
||||||
name: string,
|
name: string,
|
||||||
valGiven: string | undefined,
|
valGiven: string | undefined,
|
||||||
options: AddEnvOptions = defaultAddEnvOptions
|
options: AddEnvOptions = defaultAddEnvOptions,
|
||||||
) {
|
) {
|
||||||
const val = escapeString(valGiven ?? "", options.shouldEscapeSpace)
|
const val = escapeString(valGiven ?? "", options.shouldEscapeSpace)
|
||||||
try {
|
try {
|
||||||
|
@ -126,7 +126,7 @@ async function addPathSystem(path: string) {
|
||||||
case "win32": {
|
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
|
// 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(
|
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.`)
|
info(`"${path}" was added to the PATH.`)
|
||||||
return
|
return
|
||||||
|
|
|
@ -169,7 +169,7 @@ async function initApt(apt: string) {
|
||||||
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
||||||
promises.push(
|
promises.push(
|
||||||
addEnv("LANG", "C.UTF-8", { shouldAddOnlyIfNotDefined: true }),
|
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)
|
await Promise.all(promises)
|
||||||
|
@ -197,7 +197,7 @@ export async function addAptKeyViaServer(keys: string[], name: string, server =
|
||||||
key,
|
key,
|
||||||
])
|
])
|
||||||
await execRoot("chmod", ["644", fileName])
|
await execRoot("chmod", ["644", fileName])
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return fileName
|
return fileName
|
||||||
|
@ -226,7 +226,7 @@ export async function updateAptAlternatives(name: string, path: string) {
|
||||||
await setupCppInProfile()
|
await setupCppInProfile()
|
||||||
return appendFile(
|
return appendFile(
|
||||||
cpprc_path,
|
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,
|
version: string,
|
||||||
getPackageInfo: (version: string, platform: NodeJS.Platform, arch: string) => PackageInfo | Promise<PackageInfo>,
|
getPackageInfo: (version: string, platform: NodeJS.Platform, arch: string) => PackageInfo | Promise<PackageInfo>,
|
||||||
setupDir: string,
|
setupDir: string,
|
||||||
arch: string
|
arch: string,
|
||||||
): Promise<InstallationInfo> {
|
): Promise<InstallationInfo> {
|
||||||
info(`Installing ${name} ${version} ${arch} via direct downloading`)
|
info(`Installing ${name} ${version} ${arch} via direct downloading`)
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export async function setupBin(
|
||||||
const { url, binRelativeDir, binFileName, extractedFolderName, extractFunction } = await getPackageInfo(
|
const { url, binRelativeDir, binFileName, extractedFolderName, extractFunction } = await getPackageInfo(
|
||||||
version,
|
version,
|
||||||
process.platform,
|
process.platform,
|
||||||
arch
|
arch,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Restore from cache (if found).
|
// Restore from cache (if found).
|
||||||
|
@ -98,7 +98,7 @@ export async function setupBin(
|
||||||
() => {
|
() => {
|
||||||
return downloadTool(url)
|
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) {
|
if (!didInit) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ let hasBrew = false
|
||||||
export async function setupBrewPack(
|
export async function setupBrewPack(
|
||||||
name: string,
|
name: string,
|
||||||
version?: string,
|
version?: string,
|
||||||
extraArgs: string[] = []
|
extraArgs: string[] = [],
|
||||||
): Promise<InstallationInfo> {
|
): Promise<InstallationInfo> {
|
||||||
info(`Installing ${name} ${version ?? ""} via brew`)
|
info(`Installing ${name} ${version ?? ""} via brew`)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ export async function setupBrewPack(
|
||||||
["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs],
|
["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs],
|
||||||
{
|
{
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
return { binDir }
|
return { binDir }
|
||||||
|
|
|
@ -19,7 +19,7 @@ export async function setupPipPackWithPython(
|
||||||
givenPython: string,
|
givenPython: string,
|
||||||
name: string,
|
name: string,
|
||||||
version?: string,
|
version?: string,
|
||||||
upgrade = false
|
upgrade = false,
|
||||||
): Promise<InstallationInfo> {
|
): Promise<InstallationInfo> {
|
||||||
info(`Installing ${name} ${version ?? ""} via pip`)
|
info(`Installing ${name} ${version ?? ""} via pip`)
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ export async function getSpecificVersionAndUrl(
|
||||||
versions: Set<string>,
|
versions: Set<string>,
|
||||||
platform: string,
|
platform: string,
|
||||||
version: 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]> {
|
): Promise<[string, string]> {
|
||||||
// specific ubuntu version
|
// specific ubuntu version
|
||||||
if (platform === "linux" && version.includes("ubuntu")) {
|
if (platform === "linux" && version.includes("ubuntu")) {
|
||||||
|
@ -57,8 +57,8 @@ export async function getSpecificVersionAndUrl(
|
||||||
if (!versions.has(version)) {
|
if (!versions.has(version)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unsupported target! (platform='${platform}', version='${version}'). Try one of the following: ${JSON.stringify(
|
`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(
|
throw new Error(
|
||||||
`Unsupported target! (platform='${platform}', version='${version}'). Try one of the following: ${JSON.stringify(
|
`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(
|
export async function isBinUptoDate(
|
||||||
givenFile: string,
|
givenFile: string,
|
||||||
targetVersion: string,
|
targetVersion: string,
|
||||||
versionRegex: RegExp = defaultVersionRegex
|
versionRegex: RegExp = defaultVersionRegex,
|
||||||
) {
|
) {
|
||||||
const givenVersion = await getBinVersion(givenFile, versionRegex)
|
const givenVersion = await getBinVersion(givenFile, versionRegex)
|
||||||
if (givenVersion !== undefined && targetVersion !== "") {
|
if (givenVersion !== undefined && targetVersion !== "") {
|
||||||
|
|
|
@ -33,7 +33,7 @@ export async function cleanupTmpDir(testName: string) {
|
||||||
export async function testBin(
|
export async function testBin(
|
||||||
name: string,
|
name: string,
|
||||||
args: string[] | null = ["--version"],
|
args: string[] | null = ["--version"],
|
||||||
binDir: string | undefined = undefined
|
binDir: string | undefined = undefined,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
let bin = name
|
let bin = name
|
||||||
|
|
|
@ -28,7 +28,7 @@ export async function setupVCVarsall(
|
||||||
toolset: string | undefined,
|
toolset: string | undefined,
|
||||||
sdk?: string,
|
sdk?: string,
|
||||||
uwp?: boolean,
|
uwp?: boolean,
|
||||||
spectre?: boolean
|
spectre?: boolean,
|
||||||
) {
|
) {
|
||||||
if (VCTargetsPath !== undefined && (await pathExists(VCTargetsPath))) {
|
if (VCTargetsPath !== undefined && (await pathExists(VCTargetsPath))) {
|
||||||
info(`Adding ${VCTargetsPath} to PATH`)
|
info(`Adding ${VCTargetsPath} to PATH`)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
"./src",
|
"./src",
|
||||||
"dev/scripts",
|
"dev/scripts",
|
||||||
"packages/untildify-user/untildify.ts",
|
"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