Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .terserrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ const compress =
module.exports = {
...terserConfig,
compress,
format: {
...terserConfig.format,
comments: false,
},
}
91 changes: 46 additions & 45 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- aarch
- aminya
- applellvm
- buildtools
- caxa
- ccache
- choco
- vsversion
- pwsh
- pypy
- cmake
- CPATH
- Cppcheck
- CPPFLAGS
- cpprc
- Cpython
- deps
- devel
- dyld
- eabi
- execa
- gcovr
- ghes
- applellvm
- xcrun
- Graphviz
- isci
- kcov
- LDFLAGS
- libbinutils
- libdw
- libstdc
- libtinfo
- libdw
- msbuild
- msvc
- msys
- multilib
- mxschmitt
- nothrow
- npmrc
- Opencppcoverage
- OSSDK
- pnpm
- pwsh
- pypy
- setupcpp
- aarch
- devel
- aminya
- caxa
- libbinutils
- tsbuildinfo
- deps
- mxschmitt
- 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
2 changes: 2 additions & 0 deletions dist/actions_python.a1cdadc4.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/actions_python.a1cdadc4.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ignored-error-codes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["TS6133", "TS7010"]
1 change: 1 addition & 0 deletions loosely-type-checked-files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["node_modules/setup-python/src/cache-distributions/poetry-cache.ts", "node_modules/time-delta/types/index.d.ts"]
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
Expand All @@ -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",
Expand Down
26 changes: 18 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/python/actions_cache.ts
Original file line number Diff line number Diff line change
@@ -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()
}
}
52 changes: 24 additions & 28 deletions src/python/actions_python.ts
Original file line number Diff line number Diff line change
@@ -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 = "pip" // core.getInput("cache") // package manager used for caching

// const cache = core.getInput("cache")
// if (cache) {
// await cacheDependencies(cache, pythonVersion)
// }
await cacheDependencies(cache, pythonVersion)
}

if (isGitHubCI()) {
addPythonLoggingMatcher()
Expand Down
5 changes: 2 additions & 3 deletions src/python/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down