Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 68964ee

Browse filesBrowse files
committed
feat: allow using setup-cpp as a library
1 parent 6ee48d5 commit 68964ee
Copy full SHA for 68964ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

63 files changed

+374
-283
lines changed

‎.github/workflows/CI.yml

Copy file name to clipboardExpand all lines: .github/workflows/CI.yml
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ jobs:
118118
restore-keys: |
119119
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
120120
121+
- name: Cache Turbo
122+
uses: rharkor/caching-for-turbo@v1.6
123+
124+
- name: Cache .cache
125+
uses: actions/cache@v4
126+
with:
127+
path: |
128+
./.cache/eslint
129+
./.cache/cspell
130+
/home/runner/.cache/dprint
131+
key: "setupcpp-cache-OS:${{ matrix.os }}-${{ hashFiles('./*.json', './.*rc', './*.yml') }}"
132+
restore-keys: |
133+
"setupcpp-cache-OS:${{ matrix.os }}-"
134+
121135
- name: Install
122136
run: |
123137
pnpm install

‎cspell.config.yaml

Copy file name to clipboardExpand all lines: cspell.config.yaml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ words:
100100
- pygments
101101
- pypy
102102
- qlplugindir
103+
- rharkor
103104
- Sccache
104105
- setupcpp
105106
- setx

‎dist/legacy/actions_python-python.js

Copy file name to clipboardExpand all lines: dist/legacy/actions_python-python.js
+2Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/actions_python-python.js.map

Copy file name to clipboardExpand all lines: dist/legacy/actions_python-python.js.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/assets/actions_python-BgFBDq6n.js

Copy file name to clipboardExpand all lines: dist/legacy/assets/actions_python-BgFBDq6n.js
-2Lines changed: 0 additions & 2 deletions
This file was deleted.

‎dist/legacy/assets/actions_python-BgFBDq6n.js.map

Copy file name to clipboardExpand all lines: dist/legacy/assets/actions_python-BgFBDq6n.js.map
-1Lines changed: 0 additions & 1 deletion
This file was deleted.

‎dist/legacy/assets/index-BLmG_vBb.js.map

Copy file name to clipboardExpand all lines: dist/legacy/assets/index-BLmG_vBb.js.map
-1Lines changed: 0 additions & 1 deletion
This file was deleted.

‎dist/legacy/assets/proxy-agent-C54PwHVe.js.map

Copy file name to clipboardExpand all lines: dist/legacy/assets/proxy-agent-C54PwHVe.js.map
-1Lines changed: 0 additions & 1 deletion
This file was deleted.

‎dist/legacy/assets/index-BLmG_vBb.js renamed to ‎dist/legacy/index-archive-files.js

Copy file name to clipboardExpand all lines: dist/legacy/index-archive-files.js
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/index-archive-files.js.map

Copy file name to clipboardExpand all lines: dist/legacy/index-archive-files.js.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/lib.js

Copy file name to clipboardExpand all lines: dist/legacy/lib.js
+2Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/lib.js.map

Copy file name to clipboardExpand all lines: dist/legacy/lib.js.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/assets/proxy-agent-C54PwHVe.js renamed to ‎dist/legacy/proxy-agent.js

Copy file name to clipboardExpand all lines: dist/legacy/proxy-agent.js
+2-2Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/proxy-agent.js.map

Copy file name to clipboardExpand all lines: dist/legacy/proxy-agent.js.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/setup-cpp.js

Copy file name to clipboardExpand all lines: dist/legacy/setup-cpp.js
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/setup-cpp.js.map

Copy file name to clipboardExpand all lines: dist/legacy/setup-cpp.js.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/modern/assets/actions_python-b5WGf9Wg.mjs renamed to ‎dist/modern/actions_python-python.mjs

Copy file name to clipboardExpand all lines: dist/modern/actions_python-python.mjs
+2-2Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎dist/modern/actions_python-python.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/actions_python-python.mjs.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/modern/assets/actions_python-b5WGf9Wg.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/assets/actions_python-b5WGf9Wg.mjs.map
-1Lines changed: 0 additions & 1 deletion
This file was deleted.

‎dist/modern/assets/index-DbYobIHH.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/assets/index-DbYobIHH.mjs.map
-1Lines changed: 0 additions & 1 deletion
This file was deleted.

‎dist/modern/assets/proxy-agent-BmRoX2ZW.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/assets/proxy-agent-BmRoX2ZW.mjs.map
-1Lines changed: 0 additions & 1 deletion
This file was deleted.

‎dist/modern/assets/index-DbYobIHH.mjs renamed to ‎dist/modern/index-archive-files.mjs

Copy file name to clipboardExpand all lines: dist/modern/index-archive-files.mjs
+1-1Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎dist/modern/index-archive-files.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/index-archive-files.mjs.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/modern/lib.mjs

Copy file name to clipboardExpand all lines: dist/modern/lib.mjs
+2Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

‎dist/modern/lib.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/lib.mjs.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/modern/assets/proxy-agent-BmRoX2ZW.mjs renamed to ‎dist/modern/proxy-agent.mjs

Copy file name to clipboardExpand all lines: dist/modern/proxy-agent.mjs
+2-2Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎dist/modern/proxy-agent.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/proxy-agent.mjs.map
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/modern/setup-cpp.mjs

Copy file name to clipboardExpand all lines: dist/modern/setup-cpp.mjs
+1-1Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎dist/modern/setup-cpp.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/setup-cpp.mjs.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Copy file name to clipboardExpand all lines: package.json
+24-4Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@
1111
"bin": {
1212
"setup-cpp": "dist/legacy/setup-cpp.js"
1313
},
14+
"exports": {
15+
".": {
16+
"types": "./dist/modern/lib.d.ts",
17+
"require": "./dist/legacy/lib.js",
18+
"import": "./dist/modern/lib.mjs"
19+
},
20+
"./bin": {
21+
"types": "./dist/modern/setup-cpp.d.ts",
22+
"require": "./dist/legacy/setup-cpp.js",
23+
"import": "./dist/modern/setup-cpp.mjs"
24+
},
25+
"./lib": {
26+
"types": "./dist/modern/lib.d.ts",
27+
"require": "./dist/legacy/lib.js",
28+
"import": "./dist/modern/lib.mjs"
29+
},
30+
"./src/*": {
31+
"import": "./src/*/*.ts"
32+
}
33+
},
1434
"files": [
1535
"action.yml",
1636
".dockerignore",
@@ -26,9 +46,9 @@
2646
"tsconfig.json"
2747
],
2848
"scripts": {
29-
"build": "turbo build && run-p lint.root.tsc build.vite build.vite.legacy && run-p build.json build.bash",
30-
"build.vite": "cross-env NODE_ENV=production vite build",
31-
"build.vite.legacy": "cross-env NODE_ENV=production TARGET=legacy vite build",
49+
"build": "run-s clean && turbo build && run-p lint.root.tsc build.vite.modern build.vite.legacy && run-p build.json build.bash",
50+
"build.vite.modern": "cross-env NODE_ENV=production vite build --mode cli-modern",
51+
"build.vite.legacy": "cross-env NODE_ENV=production vite build --mode cli-legacy",
3252
"build.json": "shx cp ./src/*/*.json ./dist/legacy/ && shx cp ./dist/legacy/*.json ./dist/modern && minijson --file ./dist/**/*.json",
3353
"build.bash": "shx cp ./src/*/*.bash ./dist/legacy/ && shx cp ./dist/legacy/*.bash ./dist/modern",
3454
"bump": "ncu -u -x execa,numerous,eslint,@types/eslint,which && pnpm update && pnpx typesync && pnpm run clean",
@@ -120,7 +140,7 @@
120140
"mri": "^1.2.0",
121141
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#c01f519bd995460228ed3dec4df51df92dc290fd",
122142
"node-downloader-helper": "2.1.9",
123-
"npm-check-updates": "^17.1.15",
143+
"npm-check-updates": "^17.1.16",
124144
"npm-run-all2": "^7.0.2",
125145
"numerous": "1.0.3",
126146
"p-timeout": "^6.1.4",

‎pnpm-lock.yaml

Copy file name to clipboardExpand all lines: pnpm-lock.yaml
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/chocolatey/chocolatey.ts

Copy file name to clipboardExpand all lines: src/chocolatey/chocolatey.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { addPath } from "envosman"
33
import { execaSync } from "execa"
44
import { pathExists } from "path-exists"
55
import which from "which"
6-
import { rcOptions } from "../cli-options.js"
6+
import { rcOptions } from "../options.js"
77
import type { InstallationInfo } from "../utils/setup/setupBin.js"
88

99
/* eslint-disable require-atomic-updates */

‎src/cli-options.ts

Copy file name to clipboard
+10-42Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import { getInput } from "@actions/core"
21
import { info } from "ci-log"
3-
import type { AddPathOptions } from "envosman"
42
import mri from "mri"
5-
import { untildifyUser } from "untildify-user"
3+
import { type Opts, maybeGetInput } from "./options.js"
64
import { type Inputs, inputs } from "./tool.js"
7-
import type { InstallationInfo } from "./utils/setup/setupBin.js"
85

9-
export function parseArgs(args: string[]): Opts {
6+
/**
7+
* The options for the setup-cpp function
8+
*/
9+
export type CliOpts = Opts & {
10+
help: boolean
11+
version: boolean
12+
}
13+
14+
export function parseArgs(args: string[]): CliOpts {
1015
const defaults = Object.fromEntries(inputs.map((inp) => [inp, maybeGetInput(inp)]))
1116
return mri<Record<Inputs, string | undefined> & { help: boolean; version: boolean; "setup-cpp": boolean }>(args, {
1217
string: [...inputs, "timeout", "node-package-manager"],
@@ -56,40 +61,3 @@ All the available tools:
5661
["tools"],
5762
)
5863
}
59-
/** Get an object from github actions */
60-
61-
export function maybeGetInput(key: string) {
62-
const value = getInput(key.toLowerCase())
63-
if (value !== "false" && value !== "") {
64-
return value
65-
}
66-
return undefined // skip installation
67-
}
68-
export type Opts = mri.Argv<
69-
Record<Inputs, string | undefined> & {
70-
help: boolean
71-
version: boolean
72-
"setup-cpp"?: boolean
73-
timeout?: string
74-
"node-package-manager"?: string
75-
}
76-
>
77-
78-
export function getSuccessMessage(tool: string, installationInfo: InstallationInfo | undefined | void) {
79-
let msg = `✅ ${tool} was installed successfully:`
80-
if (installationInfo === undefined) {
81-
return msg
82-
}
83-
if ("installDir" in installationInfo) {
84-
msg += `\n- The installation directory is ${installationInfo.installDir}`
85-
}
86-
if (installationInfo.binDir !== "") {
87-
msg += `\n- The binary directory is ${installationInfo.binDir}`
88-
}
89-
return msg
90-
}
91-
92-
export const rcOptions: AddPathOptions = {
93-
rcPath: untildifyUser("~/.cpprc"),
94-
guard: "cpp",
95-
}

‎src/compilers.ts

Copy file name to clipboardExpand all lines: src/compilers.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { join } from "path"
22
import { endGroup, startGroup } from "@actions/core"
33
import { error, info } from "ci-log"
44
import semverValid from "semver/functions/valid"
5-
import { getSuccessMessage } from "./cli-options.js"
65
import { setupGcc } from "./gcc/gcc.js"
76
import { setupMingw } from "./gcc/mingw.js"
87
import { activateGcovGCC, activateGcovLLVM } from "./gcovr/gcovr.js"
98
import { setupAppleClang } from "./llvm/apple-clang.js"
109
import { setupLLVM } from "./llvm/llvm.js"
1110
import { setupMSVC } from "./msvc/msvc.js"
11+
import { getSuccessMessage } from "./options.js"
1212
import { appleClangSetups, gccSetups, llvmSetups, mingwSetups, msvcSetups } from "./tool.js"
1313
import type { InstallationInfo } from "./utils/setup/setupBin.js"
1414
import { getVersion } from "./versions/versions.js"

‎src/cppcheck/cppcheck.ts

Copy file name to clipboardExpand all lines: src/cppcheck/cppcheck.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { addPath } from "envosman"
22
import { hasApk, installApkPack } from "setup-alpine"
33
import { installAptPack } from "setup-apt"
44
import { installBrewPack } from "setup-brew"
5-
import { rcOptions } from "../cli-options.js"
5+
import { rcOptions } from "../options.js"
66
import { hasDnf } from "../utils/env/hasDnf.js"
77
import { isArch } from "../utils/env/isArch.js"
88
import { isUbuntu } from "../utils/env/isUbuntu.js"

‎src/doxygen/doxygen.ts

Copy file name to clipboardExpand all lines: src/doxygen/doxygen.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import retry from "retry-as-promised"
77
import { hasApk, installApkPack } from "setup-alpine"
88
import { installAptPack } from "setup-apt"
99
import { installBrewPack } from "setup-brew"
10-
import { rcOptions } from "../cli-options.js"
1110
import { setupGraphviz } from "../graphviz/graphviz.js"
11+
import { rcOptions } from "../options.js"
1212
import { arm64 } from "../utils/env/arch.js"
1313
import { hasDnf } from "../utils/env/hasDnf.js"
1414
import { isArch } from "../utils/env/isArch.js"

‎src/gcc/gcc.ts

Copy file name to clipboardExpand all lines: src/gcc/gcc.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import semverMajor from "semver/functions/major"
1313
import { hasApk, installApkPack } from "setup-alpine"
1414
import { addUpdateAlternativesToRc, installAptPack } from "setup-apt"
1515
import { installBrewPack } from "setup-brew"
16-
import { rcOptions } from "../cli-options.js"
1716
import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js"
17+
import { rcOptions } from "../options.js"
1818
import { hasDnf } from "../utils/env/hasDnf.js"
1919
import { isArch } from "../utils/env/isArch.js"
2020
import { isUbuntu } from "../utils/env/isUbuntu.js"

‎src/gcc/mingw.ts

Copy file name to clipboardExpand all lines: src/gcc/mingw.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import semverCoerce from "semver/functions/coerce.js"
1010
import semverSatisfies from "semver/functions/satisfies.js"
1111
import { enableCommunityRepository, hasApk, installApkPack } from "setup-alpine"
1212
import { installAptPack } from "setup-apt"
13-
import { rcOptions } from "../cli-options.js"
13+
import { rcOptions } from "../options.js"
1414
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
1515
import { hasDnf } from "../utils/env/hasDnf.js"
1616
import { isArch } from "../utils/env/isArch.js"

‎src/gcovr/gcovr.ts

Copy file name to clipboardExpand all lines: src/gcovr/gcovr.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { addEnv } from "envosman"
22
import semverMajor from "semver/functions/major"
33
import semverValid from "semver/functions/valid"
4-
import { rcOptions } from "../cli-options.js"
4+
import { rcOptions } from "../options.js"
55
import { setupPipPack } from "../utils/setup/setupPipPack.js"
66

77
// eslint-disable-next-line @typescript-eslint/no-unused-vars

‎src/git/git.ts

Copy file name to clipboardExpand all lines: src/git/git.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { hasApk, installApkPack } from "setup-alpine"
55
import { installAptPack } from "setup-apt"
66
import { installBrewPack } from "setup-brew"
77
import which from "which"
8-
import { rcOptions } from "../cli-options.js"
8+
import { rcOptions } from "../options.js"
99
import { hasDnf } from "../utils/env/hasDnf.js"
1010
import { isArch } from "../utils/env/isArch.js"
1111
import { isUbuntu } from "../utils/env/isUbuntu.js"

‎src/graphviz/graphviz.ts

Copy file name to clipboardExpand all lines: src/graphviz/graphviz.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { addPath } from "envosman"
22
import { hasApk, installApkPack } from "setup-alpine"
33
import { installAptPack } from "setup-apt"
44
import { installBrewPack } from "setup-brew"
5-
import { rcOptions } from "../cli-options.js"
5+
import { rcOptions } from "../options.js"
66
import { hasDnf } from "../utils/env/hasDnf.js"
77
import { isArch } from "../utils/env/isArch.js"
88
import { isUbuntu } from "../utils/env/isUbuntu.js"

‎src/installTool.ts

Copy file name to clipboardExpand all lines: src/installTool.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { join } from "path"
22
import { endGroup, startGroup } from "@actions/core"
33
import { error } from "ci-log"
44
import { setupBrew } from "setup-brew"
5-
import { getSuccessMessage, rcOptions } from "./cli-options.js"
5+
import { getSuccessMessage, rcOptions } from "./options.js"
66
import { type ToolName, llvmTools, setups } from "./tool.js"
77
import type { InstallationInfo } from "./utils/setup/setupBin.js"
88
import { setupVCVarsall } from "./vcvarsall/vcvarsall.js"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.