From 108628bcbd9f5d8417425bca4641b5ac77ae4b9b Mon Sep 17 00:00:00 2001 From: Alena Sviridenko Date: Wed, 4 Aug 2021 17:00:50 +0300 Subject: [PATCH] Revert "Temporarily disable image cache usage for v1" --- __tests__/installer.test.ts | 6 ++---- dist/index.js | 7 ++----- src/installer.ts | 7 ++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 9d577a53..7f76aebc 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -88,8 +88,7 @@ describe('installer tests', () => { } }, 100000); - // Usage of pre-cached Node.js is temporarily disabled. - xit('Uses version of node installed in cache', async () => { + it('Uses version of node installed in cache', async () => { const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch()); await io.mkdirP(nodeDir); fs.writeFileSync(`${nodeDir}.complete`, 'hello'); @@ -112,8 +111,7 @@ describe('installer tests', () => { return; }); - // Usage of pre-cached Node.js is temporarily disabled. - xit('Resolves semantic versions of node installed in cache', async () => { + it('Resolves semantic versions of node installed in cache', async () => { const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch()); await io.mkdirP(nodeDir); fs.writeFileSync(`${nodeDir}.complete`, 'hello'); diff --git a/dist/index.js b/dist/index.js index 333a1f6e..d6c6c078 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12231,8 +12231,7 @@ function getNode(versionSpec) { let toolPath; toolPath = tc.find('node', versionSpec); // If not found in cache, download - // Usage of pre-cached Node.js is temporarily disabled. - if (true) { + if (!toolPath) { let version; const c = semver.clean(versionSpec) || ''; // If explicit version @@ -12249,8 +12248,7 @@ function getNode(versionSpec) { // check cache toolPath = tc.find('node', version); } - // Usage of pre-cached Node.js is temporarily disabled. - if (true) { + if (!toolPath) { // download, extract, cache toolPath = yield acquireNode(version); } @@ -12344,7 +12342,6 @@ function acquireNode(version) { let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`; let downloadPath; try { - core.info(`Downloading ${downloadUrl}`); downloadPath = yield tc.downloadTool(downloadUrl); } catch (err) { diff --git a/src/installer.ts b/src/installer.ts index 44618410..1265ed85 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -25,8 +25,7 @@ export async function getNode(versionSpec: string) { toolPath = tc.find('node', versionSpec); // If not found in cache, download - // Usage of pre-cached Node.js is temporarily disabled. - if (true) { + if (!toolPath) { let version: string; const c = semver.clean(versionSpec) || ''; // If explicit version @@ -46,8 +45,7 @@ export async function getNode(versionSpec: string) { toolPath = tc.find('node', version); } - // Usage of pre-cached Node.js is temporarily disabled. - if (true) { + if (!toolPath) { // download, extract, cache toolPath = await acquireNode(version); } @@ -148,7 +146,6 @@ async function acquireNode(version: string): Promise { let downloadPath: string; try { - core.info(`Downloading ${downloadUrl}`); downloadPath = await tc.downloadTool(downloadUrl); } catch (err) { if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {