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,22 +12,19 @@ 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 finderPyPy.findPyPyVersion(version, arch)
|
const installed = await findPyPyVersion(version, arch)
|
||||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||||
info(
|
info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
||||||
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
const installed = await finder.useCpythonVersion(version, arch)
|
const installed = await useCpythonVersion(version, arch)
|
||||||
pythonVersion = installed.version
|
pythonVersion = installed.version
|
||||||
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
info(`Successfully setup ${installed.impl} (${pythonVersion})`)
|
||||||
}
|
}
|
||||||
|
@ -37,9 +34,6 @@ export async function setupActionsPython(version: string, _setupDir: string, arc
|
||||||
const { cacheDependencies } = await import("./cache")
|
const { cacheDependencies } = await import("./cache")
|
||||||
await cacheDependencies(cache, pythonVersion)
|
await cacheDependencies(cache, pythonVersion)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
core.setFailed((err as Error).message)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isGitHubCI()) {
|
if (isGitHubCI()) {
|
||||||
addPythonLoggingMatcher()
|
addPythonLoggingMatcher()
|
||||||
|
|
Loading…
Reference in New Issue