From 2cf593d66bcc2d4d14fc72e413737326f19e8533 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 11 Feb 2023 13:45:25 +0100 Subject: [PATCH] Don't group bundle install output * So any error from Bundler is immediately shown. * Some users do not realize they should expand the group apparently. --- common.js | 13 +++++++++++++ dist/index.js | 16 +++++++++++++++- index.js | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/common.js b/common.js index 0d09eed..c7a7e2a 100644 --- a/common.js +++ b/common.js @@ -47,6 +47,19 @@ export async function measure(name, block) { } } +// Same as mesaure() but without the group +export async function time(name, block) { + console.log(`> ${name}`) + const start = performance.now() + try { + return await block() + } finally { + const end = performance.now() + const duration = (end - start) / 1000.0 + console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`) + } +} + export function isHeadVersion(rubyVersion) { return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion) } diff --git a/dist/index.js b/dist/index.js index 2279aef..edaa8ce 100644 --- a/dist/index.js +++ b/dist/index.js @@ -282,6 +282,7 @@ __nccwpck_require__.r(__webpack_exports__); /* harmony export */ "drive": () => (/* binding */ drive), /* harmony export */ "partition": () => (/* binding */ partition), /* harmony export */ "measure": () => (/* binding */ measure), +/* harmony export */ "time": () => (/* binding */ time), /* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion), /* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion), /* harmony export */ "hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem), @@ -348,6 +349,19 @@ async function measure(name, block) { } } +// Same as mesaure() but without the group +async function time(name, block) { + console.log(`> ${name}`) + const start = performance.now() + try { + return await block() + } finally { + const end = performance.now() + const duration = (end - start) / 1000.0 + console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`) + } +} + function isHeadVersion(rubyVersion) { return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion) } @@ -68822,7 +68836,7 @@ async function setupRuby(options = {}) { } if (inputs['bundler-cache'] === 'true') { - await common.measure('bundle install', async () => + await common.time('bundle install', async () => bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version'])) } diff --git a/index.js b/index.js index 6440290..6594742 100644 --- a/index.js +++ b/index.js @@ -92,7 +92,7 @@ export async function setupRuby(options = {}) { } if (inputs['bundler-cache'] === 'true') { - await common.measure('bundle install', async () => + await common.time('bundle install', async () => bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version'])) }