From d21ecc7c5be116ff576d1e1dd67cf7eefbb22ed3 Mon Sep 17 00:00:00 2001 From: Alena Sviridenko Date: Wed, 4 Aug 2021 17:00:35 +0300 Subject: [PATCH 1/2] Revert "Temporarily disabled cache usage for v2" --- .github/workflows/e2e-cache.yml | 2 -- __tests__/installer.test.ts | 21 +++++++-------------- dist/setup/index.js | 5 +++-- src/installer.ts | 3 +-- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 69e75fec..9c294f16 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -101,8 +101,6 @@ jobs: node-yarn2-depencies-caching: name: Test yarn 2 (Node ${{ matrix.node-version}}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: false strategy: fail-fast: false matrix: diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 85cf264a..99489236 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -171,8 +171,7 @@ describe('setup-node', () => { // Found in cache tests //-------------------------------------------------- - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('finds version in cache with stable true', async () => { + it('finds version in cache with stable true', async () => { inputs['node-version'] = '12'; inputs.stable = 'true'; @@ -183,8 +182,7 @@ describe('setup-node', () => { expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); }); - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('finds version in cache with stable not supplied', async () => { + it('finds version in cache with stable not supplied', async () => { inputs['node-version'] = '12'; inSpy.mockImplementation(name => inputs[name]); @@ -196,8 +194,7 @@ describe('setup-node', () => { expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); }); - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('finds version in cache and adds it to the path', async () => { + it('finds version in cache and adds it to the path', async () => { inputs['node-version'] = '12'; inSpy.mockImplementation(name => inputs[name]); @@ -387,8 +384,7 @@ describe('setup-node', () => { }, 100000); describe('check-latest flag', () => { - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('use local version and dont check manifest if check-latest is not specified', async () => { + it('use local version and dont check manifest if check-latest is not specified', async () => { os.platform = 'linux'; os.arch = 'x64'; @@ -409,8 +405,7 @@ describe('setup-node', () => { ); }); - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('check latest version and resolve it from local cache', async () => { + it('check latest version and resolve it from local cache', async () => { os.platform = 'linux'; os.arch = 'x64'; @@ -561,8 +556,7 @@ describe('setup-node', () => { inputs.stable = 'true'; }); - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('find latest LTS version and resolve it from local cache (lts/erbium)', async () => { + it('find latest LTS version and resolve it from local cache (lts/erbium)', async () => { // arrange inputs['node-version'] = 'lts/erbium'; @@ -632,8 +626,7 @@ describe('setup-node', () => { ); }); - // Usage of pre-cached Node.js versions is temporarily disabled. - xit('find latest LTS version and resolve it from local cache (lts/*)', async () => { + it('find latest LTS version and resolve it from local cache (lts/*)', async () => { // arrange inputs['node-version'] = 'lts/*'; diff --git a/dist/setup/index.js b/dist/setup/index.js index edf4b446..1a213700 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65086,8 +65086,9 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { let toolPath; toolPath = tc.find('node', versionSpec, osArch); // If not found in cache, download - // Usage of pre-cached Node.js versions is temporarily disabled. - if (false) {} + if (toolPath) { + core.info(`Found in cache @ ${toolPath}`); + } else { core.info(`Attempting to download ${versionSpec}...`); let downloadPath = ''; diff --git a/src/installer.ts b/src/installer.ts index beb8d941..e2084b95 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -71,8 +71,7 @@ export async function getNode( toolPath = tc.find('node', versionSpec, osArch); // If not found in cache, download - // Usage of pre-cached Node.js versions is temporarily disabled. - if (false) { + if (toolPath) { core.info(`Found in cache @ ${toolPath}`); } else { core.info(`Attempting to download ${versionSpec}...`); From 896ee80599ea831592cc8484629043410040b226 Mon Sep 17 00:00:00 2001 From: Alena Sviridenko Date: Wed, 4 Aug 2021 17:04:32 +0300 Subject: [PATCH 2/2] Restore YARN flag --- .github/workflows/e2e-cache.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 9c294f16..69e75fec 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -101,6 +101,8 @@ jobs: node-yarn2-depencies-caching: name: Test yarn 2 (Node ${{ matrix.node-version}}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: false strategy: fail-fast: false matrix: