fix: use time-delta for timing

This commit is contained in:
Amin Yahyaabadi 2022-04-18 03:23:58 -07:00
parent 104ee90b0f
commit cf18d3eb4f
6 changed files with 52 additions and 25 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,6 +42,7 @@
"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"
},

View File

@ -37,6 +37,7 @@ specifiers:
setup-python: github:actions/setup-python#7f80679172b057fc5e90d70d197929d454754a5a
shx: 0.3.4
terser-config-atomic: ^0.1.1
time-delta: ^1.0.0
ts-jest: ^27.1.4
typescript: ^4.6.3
untildify: ^4.0.0
@ -52,6 +53,7 @@ dependencies:
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
semver: 7.3.7
setup-python: github.com/actions/setup-python/7f80679172b057fc5e90d70d197929d454754a5a
time-delta: 1.0.0
untildify: 4.0.0
which: 2.0.2
@ -304,7 +306,7 @@ packages:
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
peerDependencies:
'@babel/core': '>=7.11.0'
eslint: ^7.5.0 || ^8.0.0 || *
eslint: '*'
dependencies:
'@babel/core': 7.17.9
eslint: 8.13.0
@ -2151,7 +2153,7 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
'@typescript-eslint/parser': ^5.0.0
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || *
eslint: '*'
typescript: '*'
peerDependenciesMeta:
typescript:
@ -2177,7 +2179,7 @@ packages:
resolution: {integrity: sha512-yhktJjMCJX8BSBczh1F/uY8wGRYrBeyn84kH6oyqdIJwTGKmzX5Qiq49LRQ0Jh0LXnWijEziSo6BRqny8nqLVQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || *
eslint: '*'
typescript: '*'
peerDependenciesMeta:
typescript:
@ -2250,7 +2252,7 @@ packages:
resolution: {integrity: sha512-ZuEckdupXpXamKvFz/Ql8YnePh2ZWcwz7APICzJL985Rp5C2AYcHO62oJzIqNhAMtMK6XvrlBTZeNG8n7gS3lQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || *
eslint: '*'
dependencies:
'@types/json-schema': 7.0.11
'@typescript-eslint/scope-manager': 5.19.0
@ -3608,7 +3610,7 @@ packages:
resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==}
engines: {node: '>= 6'}
peerDependencies:
eslint: ^5.16.0 || ^6.8.0 || ^7.2.0 || *
eslint: '*'
eslint-plugin-import: ^2.22.1
dependencies:
confusing-browser-globals: 1.0.11
@ -3623,7 +3625,7 @@ packages:
resolution: {integrity: sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==}
engines: {node: '>= 6'}
peerDependencies:
eslint: ^5.16.0 || ^6.8.0 || ^7.2.0 || *
eslint: '*'
eslint-plugin-import: ^2.22.1
eslint-plugin-jsx-a11y: ^6.4.1
eslint-plugin-react: ^7.21.5
@ -3674,7 +3676,7 @@ packages:
resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==}
hasBin: true
peerDependencies:
eslint: '>=7.0.0 || *'
eslint: '*'
dependencies:
eslint: 8.13.0
dev: true
@ -3698,7 +3700,7 @@ packages:
resolution: {integrity: sha512-+qtkIPSc9etYqOODIlENqiRjID/oEoGMAAQJN988Aczy461NIwzaamFY6Fi0QDVVDb2v+OL/StVrk/QmyItfeg==}
requiresBuild: true
peerDependencies:
eslint: '>=6.0.0 || *'
eslint: '*'
dependencies:
axe-core: 3.5.6
babel-eslint: /@babel/eslint-parser/7.17.0_@babel+core@7.17.9+eslint@8.13.0
@ -3728,7 +3730,7 @@ packages:
resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==}
engines: {node: '>=8.10.0'}
peerDependencies:
eslint: '>=4.19.1 || *'
eslint: '*'
dependencies:
eslint: 8.13.0
eslint-utils: 2.1.0
@ -3745,7 +3747,7 @@ packages:
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
engines: {node: '>=4'}
peerDependencies:
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || *
eslint: '*'
dependencies:
array-includes: 3.1.4
array.prototype.flat: 1.3.0
@ -3775,7 +3777,7 @@ packages:
resolution: {integrity: sha512-sVCFKX9fllURnXT2JwLN5Qgo24Ug5NF6dxhkmxsMEUZhXRcGg+X3e1JbJ84YePQKBl5E0ZjAH5Q4rkdcGY99+g==}
engines: {node: '>=4.0'}
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || *
eslint: '*'
dependencies:
'@babel/runtime': 7.17.9
aria-query: 4.2.2
@ -3797,7 +3799,7 @@ packages:
resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==}
engines: {node: '>=8.10.0'}
peerDependencies:
eslint: '>=5.16.0 || *'
eslint: '*'
dependencies:
eslint: 8.13.0
eslint-plugin-es: 3.0.1_eslint@8.13.0
@ -3820,7 +3822,7 @@ packages:
engines: {node: '>=10'}
requiresBuild: true
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || *
eslint: '*'
dependencies:
eslint: 8.13.0
dev: true
@ -3834,7 +3836,7 @@ packages:
/eslint-plugin-react-native/3.11.0_eslint@8.13.0:
resolution: {integrity: sha512-7F3OTwrtQPfPFd+VygqKA2VZ0f2fz0M4gJmry/TRE18JBb94/OtMxwbL7Oqwu7FGyrdeIOWnXQbBAveMcSTZIA==}
peerDependencies:
eslint: ^3.17.0 || ^4 || ^5 || ^6 || ^7 || *
eslint: '*'
dependencies:
'@babel/traverse': 7.17.9
eslint: 8.13.0
@ -3848,7 +3850,7 @@ packages:
resolution: {integrity: sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==}
engines: {node: '>=4'}
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || *
eslint: '*'
dependencies:
array-includes: 3.1.4
array.prototype.flatmap: 1.3.0
@ -3870,7 +3872,7 @@ packages:
resolution: {integrity: sha512-CVCXajliVh509PcZYRFyu/BoUEz452+jtQJq2b3Bae4v3xBUWPLCmtmBM+ZinG4MzwmxJgJ2M5rMqhqLVn7MtQ==}
engines: {node: '>=4'}
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || *
eslint: '*'
dependencies:
array-includes: 3.1.4
array.prototype.flatmap: 1.3.0
@ -3940,7 +3942,7 @@ packages:
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
peerDependencies:
eslint: '>=5 || *'
eslint: '*'
dependencies:
eslint: 8.13.0
eslint-visitor-keys: 2.1.0
@ -4847,6 +4849,11 @@ packages:
engines: {node: '>= 0.4'}
dev: true
/is-node/1.0.2:
resolution: {integrity: sha1-19ACdF733ru3R36YiVarCk/MtlM=}
engines: {node: '>= 0.10'}
dev: false
/is-npm/5.0.0:
resolution: {integrity: sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==}
engines: {node: '>=10'}
@ -6491,6 +6498,10 @@ packages:
resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==}
dev: true
/numerous/1.0.3:
resolution: {integrity: sha512-jN2WTpfdMmR1d5ClpYguln+XAvgW7B0te6wlsyaZhyev7E2CyOmvXq5LTIV/p9mt9WrPW9Xw1g5+28iZh8BhFQ==}
dev: false
/nwsapi/2.2.0:
resolution: {integrity: sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==}
dev: true
@ -7669,6 +7680,14 @@ packages:
resolution: {integrity: sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==}
dev: true
/time-delta/1.0.0:
resolution: {integrity: sha512-9Njh4IxFsKileZFMTQ01ci1Mt7HlfkkgGSNSsvo2psvSqUedqSDdxS18gI7C9kSjeJ8FSkD4ekA2w5bOZCnu7g==}
engines: {node: '>=12'}
dependencies:
is-node: 1.0.2
numerous: 1.0.3
dev: false
/timsort/0.3.0:
resolution: {integrity: sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=}
dev: true

View File

@ -18,12 +18,13 @@ 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 timeDelta from "time-delta"
import semverValid from "semver/functions/valid"
import { getVersion } from "./default_versions"
import { setupGcc } from "./gcc/gcc"
import { InstallationInfo } from "./utils/setup/setupBin"
import { error, success, warning } from "./utils/io/io"
import { error, info, success, warning } from "./utils/io/io"
import { setupVcpkg } from "./vcpkg/vcpkg"
import { join } from "path"
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
@ -124,6 +125,10 @@ export async function main(args: string[]): Promise<number> {
const successMessages: string[] = []
const errorMessages: string[] = []
const timeFormatter = timeDelta.create()
let time1: Date
let time2: Date
// installing the specified tools
// loop over the tools and run their setup function
@ -134,7 +139,7 @@ export async function main(args: string[]): Promise<number> {
// skip if undefined
if (version !== undefined) {
// running the setup function for this tool
console.time(`took`)
time1 = new Date(Date.now())
startGroup(`Installing ${tool} ${version}`)
try {
let installationInfo: InstallationInfo | undefined | void
@ -156,7 +161,8 @@ export async function main(args: string[]): Promise<number> {
errorMessages.push(`${tool} failed to install`)
}
endGroup()
console.timeEnd()
time2 = new Date(Date.now())
info(`took ${timeFormatter.format(time1, time2) as string}`)
}
}
@ -167,7 +173,7 @@ export async function main(args: string[]): Promise<number> {
const { compiler, version } = getCompilerInfo(maybeCompiler)
// install the compiler. We allow some aliases for the compiler name
console.time(`took`)
time1 = new Date(Date.now())
startGroup(`Installing ${compiler} ${version ?? ""}`)
switch (compiler) {
case "llvm":
@ -209,13 +215,13 @@ export async function main(args: string[]): Promise<number> {
}
}
endGroup()
console.timeEnd()
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()
console.timeEnd()
}
if (successMessages.length === 0 && errorMessages.length === 0) {

View File

@ -16,6 +16,7 @@
"inlineSources": true,
"preserveSymlinks": true,
"removeComments": false,
"skipLibCheck": true, // TODO: time-delta has issues
"lib": ["ES2018", "dom"],
"target": "ES2018",
"allowJs": true,