mirror of https://github.com/aminya/setup-cpp
fix: do not use setFailed
This commit is contained in:
parent
8705b57937
commit
660f362f49
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,8 +1,8 @@
|
||||||
import * as finder from "setup-python/src/find-python"
|
import { useCpythonVersion } from "setup-python/src/find-python"
|
||||||
import * as finderPyPy from "setup-python/src/find-pypy"
|
import { findPyPyVersion } from "setup-python/src/find-pypy"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { info, warning } from "../utils/io/io"
|
import { info, warning } from "../utils/io/io"
|
||||||
import * as core from "@actions/core"
|
import { debug } from "@actions/core"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
|
|
||||||
|
@ -12,33 +12,27 @@ function isPyPyVersion(versionSpec: string) {
|
||||||
|
|
||||||
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
||||||
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||||
core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`)
|
debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`)
|
||||||
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
||||||
} else {
|
} else {
|
||||||
core.debug(`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env.RUNNER_TOOL_CACHE}`)
|
debug(`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env.RUNNER_TOOL_CACHE}`)
|
||||||
}
|
}
|
||||||
try {
|
if (version) {
|
||||||
if (version) {
|
let pythonVersion: string
|
||||||
let pythonVersion: string
|
if (isPyPyVersion(version)) {
|
||||||
if (isPyPyVersion(version)) {
|
const installed = await findPyPyVersion(version, arch)
|
||||||
const installed = await finderPyPy.findPyPyVersion(version, arch)
|
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
||||||
info(
|
} else {
|
||||||
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
|
const installed = await useCpythonVersion(version, arch)
|
||||||
)
|
pythonVersion = installed.version
|
||||||
} else {
|
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
||||||
const installed = await finder.useCpythonVersion(version, arch)
|
|
||||||
pythonVersion = installed.version
|
|
||||||
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
|
||||||
|
|
||||||
const { cacheDependencies } = await import("./cache")
|
|
||||||
await cacheDependencies(cache, pythonVersion)
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
core.setFailed((err as Error).message)
|
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
||||||
|
|
||||||
|
const { cacheDependencies } = await import("./cache")
|
||||||
|
await cacheDependencies(cache, pythonVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGitHubCI()) {
|
if (isGitHubCI()) {
|
||||||
|
|
Loading…
Reference in New Issue