mirror of https://github.com/aminya/setup-cpp
Merge pull request #56 from aminya/setup-python [skip ci]
This commit is contained in:
commit
9b3e93e13e
|
@ -15,4 +15,8 @@ const compress =
|
|||
module.exports = {
|
||||
...terserConfig,
|
||||
compress,
|
||||
format: {
|
||||
...terserConfig.format,
|
||||
comments: false,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -8,60 +8,61 @@ ignorePaths:
|
|||
- .git/
|
||||
- dist/
|
||||
words:
|
||||
- "buildtools"
|
||||
- "ccache"
|
||||
- "cmake"
|
||||
- "CPATH"
|
||||
- "Cppcheck"
|
||||
- "CPPFLAGS"
|
||||
- "cpprc"
|
||||
- "dyld"
|
||||
- "eabi"
|
||||
- "execa"
|
||||
- "gcovr"
|
||||
- "Graphviz"
|
||||
- "isci"
|
||||
- "LDFLAGS"
|
||||
- "msbuild"
|
||||
- "msvc"
|
||||
- "msys"
|
||||
- "multilib"
|
||||
- "nothrow"
|
||||
- "Opencppcoverage"
|
||||
- "OSSDK"
|
||||
- "setx"
|
||||
- "untildify"
|
||||
- "vcpkg"
|
||||
- "visualc"
|
||||
- "visualcpp"
|
||||
- pnpm
|
||||
- Yahyaabadi
|
||||
- vcvarsall
|
||||
- kcov
|
||||
- choco
|
||||
- vsversion
|
||||
- pwsh
|
||||
- pypy
|
||||
- ghes
|
||||
- aarch
|
||||
- aminya
|
||||
- applellvm
|
||||
- xcrun
|
||||
- buildtools
|
||||
- caxa
|
||||
- ccache
|
||||
- choco
|
||||
- cmake
|
||||
- CPATH
|
||||
- Cppcheck
|
||||
- CPPFLAGS
|
||||
- cpprc
|
||||
- Cpython
|
||||
- deps
|
||||
- devel
|
||||
- dyld
|
||||
- eabi
|
||||
- execa
|
||||
- gcovr
|
||||
- ghes
|
||||
- Graphviz
|
||||
- isci
|
||||
- kcov
|
||||
- LDFLAGS
|
||||
- libbinutils
|
||||
- libdw
|
||||
- libstdc
|
||||
- libtinfo
|
||||
- libdw
|
||||
- npmrc
|
||||
- setupcpp
|
||||
- aarch
|
||||
- devel
|
||||
- aminya
|
||||
- caxa
|
||||
- libbinutils
|
||||
- tsbuildinfo
|
||||
- deps
|
||||
- msbuild
|
||||
- msvc
|
||||
- msys
|
||||
- multilib
|
||||
- mxschmitt
|
||||
- nothrow
|
||||
- npmrc
|
||||
- Opencppcoverage
|
||||
- OSSDK
|
||||
- pnpm
|
||||
- pwsh
|
||||
- pypy
|
||||
- setupcpp
|
||||
- setx
|
||||
- terserrc
|
||||
- tsbuildinfo
|
||||
- untildify
|
||||
- vcpkg
|
||||
- vcvarsall
|
||||
- visualc
|
||||
- visualcpp
|
||||
- vsversion
|
||||
- xcrun
|
||||
- Yahyaabadi
|
||||
ignoreWords: []
|
||||
import: []
|
||||
dictionaryDefinitions: []
|
||||
dictionaries: []
|
||||
language: "en, en-GB"
|
||||
language: en, en-GB
|
||||
allowCompoundWords: true
|
||||
|
|
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
|
@ -0,0 +1 @@
|
|||
["TS6133", "TS7010"]
|
|
@ -0,0 +1 @@
|
|||
["node_modules/setup-python/src/cache-distributions/poetry-cache.ts", "node_modules/time-delta/types/index.d.ts"]
|
|
@ -14,10 +14,10 @@
|
|||
"scripts": {
|
||||
"build": "run-p test.tsc build.parcel copy.matchers",
|
||||
"build.docker": "pnpm build && docker build -f ./building/docker/ubuntu_node.dockerfile -t setup_cpp .",
|
||||
"build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report",
|
||||
"build.parcel": "shx rm -rf ./dist/*.js ./dist/*.js.map && cross-env NODE_ENV=production parcel build --detailed-report",
|
||||
"bump": "ncu -u -x execa && pnpm update",
|
||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/ && shx cp ./src/msvc/msvc_matcher.json ./dist && shx cp ./src/python/python_matcher.json ./dist/ && shx cp ./src/llvm/llvm_matcher.json ./dist/ ",
|
||||
"copy.matchers": "shx rm -rf ./dist/*.json && shx cp ./src/gcc/gcc_matcher.json ./dist/ && shx cp ./src/msvc/msvc_matcher.json ./dist && shx cp ./src/python/python_matcher.json ./dist/ && shx cp ./src/llvm/llvm_matcher.json ./dist/ ",
|
||||
"dev": "cross-env NODE_ENV=development parcel watch",
|
||||
"format": "prettier --write .",
|
||||
"lint": "eslint . --fix",
|
||||
|
@ -28,7 +28,7 @@
|
|||
"test.cspell": "cspell lint --no-progress --show-suggestions",
|
||||
"test.format": "prettier . --check",
|
||||
"test.lint": "eslint .",
|
||||
"test.tsc": "tsc --noEmit",
|
||||
"test.tsc": "tsc --noEmit | loose-ts-check",
|
||||
"test.unit": "jest --runInBand"
|
||||
},
|
||||
"prettier": "prettier-config-atomic",
|
||||
|
@ -42,7 +42,7 @@
|
|||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||
"numerous": "1.0.3",
|
||||
"semver": "7.3.7",
|
||||
"setup-python": "github:actions/setup-python#7f80679172b057fc5e90d70d197929d454754a5a",
|
||||
"setup-python": "github:actions/setup-python#v3.1.2",
|
||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||
"untildify": "^4.0.0",
|
||||
"which": "^2.0.2"
|
||||
|
@ -61,6 +61,7 @@
|
|||
"eslint": "^8.13.0",
|
||||
"eslint-config-atomic": "^1.17.1",
|
||||
"jest": "^27.5.1",
|
||||
"loose-ts-check": "^1.2.0",
|
||||
"npm-check-updates": "^12.5.9",
|
||||
"npm-run-all2": "^5.0.2",
|
||||
"parcel": "^2.4.1",
|
||||
|
|
|
@ -27,6 +27,7 @@ specifiers:
|
|||
eslint-config-atomic: ^1.17.1
|
||||
execa: ^5.1.1
|
||||
jest: ^27.5.1
|
||||
loose-ts-check: ^1.2.0
|
||||
mri: ^1.2.0
|
||||
msvc-dev-cmd: github:aminya/msvc-dev-cmd#9f672c1
|
||||
npm-check-updates: ^12.5.9
|
||||
|
@ -36,7 +37,7 @@ specifiers:
|
|||
prettier: 2.6.2
|
||||
prettier-config-atomic: ^3.0.9
|
||||
semver: 7.3.7
|
||||
setup-python: github:actions/setup-python#7f80679172b057fc5e90d70d197929d454754a5a
|
||||
setup-python: github:actions/setup-python#v3.1.2
|
||||
shx: 0.3.4
|
||||
terser-config-atomic: ^0.1.1
|
||||
time-delta: github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e
|
||||
|
@ -55,7 +56,7 @@ dependencies:
|
|||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
||||
numerous: 1.0.3
|
||||
semver: 7.3.7
|
||||
setup-python: github.com/actions/setup-python/7f80679172b057fc5e90d70d197929d454754a5a
|
||||
setup-python: github.com/actions/setup-python/98f2ad02fd48d057ee3b4d4f66525b231c3e52b6
|
||||
time-delta: github.com/aminya/time-delta/69d91a41cef28e569be9a2991129f5f7d1f0d00e
|
||||
untildify: 4.0.0
|
||||
which: 2.0.2
|
||||
|
@ -74,6 +75,7 @@ devDependencies:
|
|||
eslint: 8.13.0
|
||||
eslint-config-atomic: 1.17.1
|
||||
jest: 27.5.1
|
||||
loose-ts-check: 1.2.0
|
||||
npm-check-updates: 12.5.9
|
||||
npm-run-all2: 5.0.2
|
||||
parcel: 2.4.1
|
||||
|
@ -86,8 +88,8 @@ devDependencies:
|
|||
|
||||
packages:
|
||||
|
||||
/@actions/cache/1.0.11:
|
||||
resolution: {integrity: sha512-L+VCF1JpFePAzxkYtpwYDWnd0WzSU1DoNPE2cuINKpEie27ONH0Cpqt40cG8NiJW4zbZLN+kNkEDo3F2MkUuRw==}
|
||||
/@actions/cache/2.0.2:
|
||||
resolution: {integrity: sha512-K1DCaW/OtHj5mV7hI7HEXiceX3rM4Nc0iG2hfYsrkEy6GiOeqlCC/LyICrBZIRDM6+vSrS12tg1ORl4hghomBA==}
|
||||
dependencies:
|
||||
'@actions/core': 1.6.0
|
||||
'@actions/exec': 1.1.1
|
||||
|
@ -5778,6 +5780,14 @@ packages:
|
|||
js-tokens: 4.0.0
|
||||
dev: true
|
||||
|
||||
/loose-ts-check/1.2.0:
|
||||
resolution: {integrity: sha512-RnVczoE60wOWBkgjjPVieeUknHftgeiyTnjxbwRBF1RRqdUGB42f4yUjJ0KNlBRLRQNnGZwEl+aM/YijcWJtTA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
yargs: 16.2.0
|
||||
dev: true
|
||||
|
||||
/lowercase-keys/1.0.1:
|
||||
resolution: {integrity: sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -8219,12 +8229,12 @@ packages:
|
|||
readable-stream: 3.6.0
|
||||
dev: true
|
||||
|
||||
github.com/actions/setup-python/7f80679172b057fc5e90d70d197929d454754a5a:
|
||||
resolution: {tarball: https://codeload.github.com/actions/setup-python/tar.gz/7f80679172b057fc5e90d70d197929d454754a5a}
|
||||
github.com/actions/setup-python/98f2ad02fd48d057ee3b4d4f66525b231c3e52b6:
|
||||
resolution: {tarball: https://codeload.github.com/actions/setup-python/tar.gz/98f2ad02fd48d057ee3b4d4f66525b231c3e52b6}
|
||||
name: setup-python
|
||||
version: 2.2.2
|
||||
version: 3.1.1
|
||||
dependencies:
|
||||
'@actions/cache': 1.0.11
|
||||
'@actions/cache': 2.0.2
|
||||
'@actions/core': 1.6.0
|
||||
'@actions/exec': 1.1.1
|
||||
'@actions/glob': 0.2.1
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { isCacheFeatureAvailable } from "setup-python/src/utils"
|
||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||
|
||||
export async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||
if (isCacheFeatureAvailable()) {
|
||||
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
|
||||
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||
await cacheDistributor.restoreCache()
|
||||
}
|
||||
}
|
|
@ -1,43 +1,39 @@
|
|||
import * as finder from "setup-python/src/find-python"
|
||||
import * as finderPyPy from "setup-python/src/find-pypy"
|
||||
import { useCpythonVersion } from "setup-python/src/find-python"
|
||||
import { findPyPyVersion } from "setup-python/src/find-pypy"
|
||||
import { existsSync } from "fs"
|
||||
import { warning } from "../utils/io/io"
|
||||
import { info } from "@actions/core"
|
||||
import { info, warning } from "../utils/io/io"
|
||||
import { debug } from "@actions/core"
|
||||
import path from "path"
|
||||
import { isGitHubCI } from "../utils/env/isci"
|
||||
// import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||
// import { isGhes } from "setup-python/src/utils"
|
||||
import { cacheDependencies } from "./actions_cache"
|
||||
|
||||
function isPyPyVersion(versionSpec: string) {
|
||||
return versionSpec.startsWith("pypy-")
|
||||
}
|
||||
|
||||
// // @ts-ignore
|
||||
// async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||
// if (isGhes()) {
|
||||
// throw new Error("Caching is not supported on GHES")
|
||||
// }
|
||||
// const cacheDependencyPath = core.getInput("cache-dependency-path") || undefined
|
||||
// const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||
// await cacheDistributor.restoreCache()
|
||||
// }
|
||||
|
||||
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
||||
let pythonVersion: string
|
||||
if (isPyPyVersion(version)) {
|
||||
const installed = await finderPyPy.findPyPyVersion(version, arch)
|
||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||
info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
||||
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||
debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`)
|
||||
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
||||
} else {
|
||||
const installed = await finder.findPythonVersion(version, arch)
|
||||
pythonVersion = installed.version
|
||||
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
||||
debug(`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env.RUNNER_TOOL_CACHE}`)
|
||||
}
|
||||
if (version) {
|
||||
let pythonVersion: string
|
||||
if (isPyPyVersion(version)) {
|
||||
const installed = await findPyPyVersion(version, arch)
|
||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||
info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
||||
} else {
|
||||
const installed = await useCpythonVersion(version, arch)
|
||||
pythonVersion = installed.version
|
||||
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
||||
}
|
||||
|
||||
// const cache = core.getInput("cache")
|
||||
// if (cache) {
|
||||
// await cacheDependencies(cache, pythonVersion)
|
||||
// }
|
||||
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
||||
|
||||
await cacheDependencies(cache, pythonVersion)
|
||||
}
|
||||
|
||||
if (isGitHubCI()) {
|
||||
addPythonLoggingMatcher()
|
||||
|
|
|
@ -6,14 +6,13 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
|||
import { isGitHubCI } from "../utils/env/isci"
|
||||
import { warning } from "@actions/core"
|
||||
|
||||
export function setupPython(version: string, setupDir: string, arch: string) {
|
||||
export async function setupPython(version: string, setupDir: string, arch: string) {
|
||||
if (!isGitHubCI()) {
|
||||
// TODO parse version
|
||||
return setupPythonViaSystem(version, setupDir, arch)
|
||||
}
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const { setupActionsPython } = require("./actions_python") as typeof import("./actions_python")
|
||||
const { setupActionsPython } = await import("./actions_python")
|
||||
return setupActionsPython(version, setupDir, arch)
|
||||
} catch (err) {
|
||||
warning(err as Error)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"inlineSources": true,
|
||||
"preserveSymlinks": true,
|
||||
"removeComments": false,
|
||||
"skipLibCheck": true, // TODO: time-delta has issues
|
||||
"skipLibCheck": false,
|
||||
"lib": ["ES2018", "dom"],
|
||||
"target": "ES2018",
|
||||
"allowJs": true,
|
||||
|
|
Loading…
Reference in New Issue