mirror of https://github.com/aminya/setup-cpp
parent
6c260e10fa
commit
4b165e7747
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -37,12 +37,12 @@
|
|||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^1.7.2",
|
||||
"dayjs": "^1.11.1",
|
||||
"execa": "^5.1.1",
|
||||
"mri": "^1.2.0",
|
||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||
"semver": "7.3.7",
|
||||
"setup-python": "github:actions/setup-python#7f80679172b057fc5e90d70d197929d454754a5a",
|
||||
"time-delta": "^1.0.0",
|
||||
"untildify": "^4.0.0",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
|
|
|
@ -22,7 +22,6 @@ specifiers:
|
|||
cross-env: 7.0.3
|
||||
cross-spawn: ^7.0.3
|
||||
cspell: ^5.19.7
|
||||
dayjs: ^1.11.1
|
||||
eslint: ^8.13.0
|
||||
eslint-config-atomic: ^1.17.1
|
||||
execa: ^5.1.1
|
||||
|
@ -49,7 +48,6 @@ dependencies:
|
|||
'@actions/exec': 1.1.1
|
||||
'@actions/io': 1.1.2
|
||||
'@actions/tool-cache': 1.7.2
|
||||
dayjs: 1.11.1
|
||||
execa: 5.1.1
|
||||
mri: 1.2.0
|
||||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
||||
|
@ -3255,10 +3253,6 @@ packages:
|
|||
resolution: {integrity: sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=}
|
||||
dev: true
|
||||
|
||||
/dayjs/1.11.1:
|
||||
resolution: {integrity: sha512-ER7EjqVAMkRRsxNCC5YqJ9d9VQYuWdGt7aiH2qA5R5wt8ZmWaP2dLUSIK6y/kVzLMlmh1Tvu5xUf4M/wdGJ5KA==}
|
||||
dev: false
|
||||
|
||||
/debug/2.6.9:
|
||||
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
|
||||
dependencies:
|
||||
|
|
30
src/main.ts
30
src/main.ts
|
@ -18,9 +18,10 @@ import { setupPython } from "./python/python"
|
|||
import mri from "mri"
|
||||
import { untildify_user as untildify } from "./utils/path/untildify"
|
||||
import { isGitHubCI } from "./utils/env/isci"
|
||||
import dayjs from "dayjs"
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import "dayjs/locale/en"
|
||||
import * as timeDelta from "time-delta"
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
import enLocale from "time-delta/locales/en"
|
||||
|
||||
import semverValid from "semver/functions/valid"
|
||||
import { getVersion } from "./default_versions"
|
||||
|
@ -127,9 +128,10 @@ export async function main(args: string[]): Promise<number> {
|
|||
const successMessages: string[] = []
|
||||
const errorMessages: string[] = []
|
||||
|
||||
dayjs.locale("en")
|
||||
let time1: number
|
||||
let time2: number
|
||||
const timeFormatter = timeDelta.create()
|
||||
timeDelta.addLocale(enLocale as timeDelta.LocaleData)
|
||||
let time1: Date
|
||||
let time2: Date
|
||||
|
||||
// installing the specified tools
|
||||
|
||||
|
@ -141,7 +143,7 @@ export async function main(args: string[]): Promise<number> {
|
|||
// skip if undefined
|
||||
if (version !== undefined) {
|
||||
// running the setup function for this tool
|
||||
time1 = Date.now()
|
||||
time1 = new Date(Date.now())
|
||||
startGroup(`Installing ${tool} ${version}`)
|
||||
try {
|
||||
let installationInfo: InstallationInfo | undefined | void
|
||||
|
@ -163,14 +165,14 @@ export async function main(args: string[]): Promise<number> {
|
|||
errorMessages.push(`${tool} failed to install`)
|
||||
}
|
||||
endGroup()
|
||||
time2 = Date.now()
|
||||
info(`took ${dayjs(new Date(time2 - time1)).format()}`)
|
||||
time2 = new Date(Date.now())
|
||||
info(`took ${timeFormatter.format(time1, time2) as string}`)
|
||||
}
|
||||
}
|
||||
|
||||
// installing the specified compiler
|
||||
const maybeCompiler = opts.compiler
|
||||
time1 = Date.now()
|
||||
time1 = new Date(Date.now())
|
||||
try {
|
||||
if (maybeCompiler !== undefined) {
|
||||
const { compiler, version } = getCompilerInfo(maybeCompiler)
|
||||
|
@ -217,15 +219,15 @@ export async function main(args: string[]): Promise<number> {
|
|||
}
|
||||
}
|
||||
endGroup()
|
||||
time2 = Date.now()
|
||||
info(`took ${dayjs(new Date(time2 - time1)).format()}`)
|
||||
time2 = new Date(Date.now())
|
||||
info(`took ${timeFormatter.format(time1, time2) as string}`)
|
||||
}
|
||||
} catch (e) {
|
||||
error(e as string | Error)
|
||||
errorMessages.push(`Failed to install the ${maybeCompiler}`)
|
||||
endGroup()
|
||||
time2 = Date.now()
|
||||
info(`took ${dayjs(new Date(time2 - time1)).format()}`)
|
||||
time2 = new Date(Date.now())
|
||||
info(`took ${timeFormatter.format(time1, time2) as string}`)
|
||||
}
|
||||
|
||||
if (successMessages.length === 0 && errorMessages.length === 0) {
|
||||
|
|
Loading…
Reference in New Issue