From 1249eb6de4ebf0192c4028e9bc0e38f96be11e2c Mon Sep 17 00:00:00 2001 From: Mohammedalduhamshi <24508@office365works.net> Date: Sat, 23 Nov 2024 09:55:57 +0300 Subject: [PATCH] Revert "fix: add arch to cached path (#843)" This reverts commit 39370e3970a6d050c480ffad4ff0ed4d3fdee5af. --- __tests__/cache-restore.test.ts | 9 +-------- dist/setup/index.js | 4 +--- src/cache-restore.ts | 4 +--- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts index 0bbf2812..90153a40 100644 --- a/__tests__/cache-restore.test.ts +++ b/__tests__/cache-restore.test.ts @@ -2,7 +2,6 @@ import * as core from '@actions/core'; import * as cache from '@actions/cache'; import * as path from 'path'; import * as glob from '@actions/glob'; -import osm from 'os'; import * as utils from '../src/cache-utils'; import {restoreCache} from '../src/cache-restore'; @@ -13,7 +12,6 @@ describe('cache-restore', () => { process.env.RUNNER_OS = 'Linux'; } const platform = process.env.RUNNER_OS; - const arch = 'arm64'; const commonPath = '/some/random/path'; const npmCachePath = `${commonPath}/npm`; const pnpmCachePath = `${commonPath}/pnpm`; @@ -54,7 +52,6 @@ describe('cache-restore', () => { let getCommandOutputSpy: jest.SpyInstance; let restoreCacheSpy: jest.SpyInstance; let hashFilesSpy: jest.SpyInstance; - let archSpy: jest.SpyInstance; beforeEach(() => { // core @@ -105,10 +102,6 @@ describe('cache-restore', () => { // cache-utils getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); - - // os - archSpy = jest.spyOn(osm, 'arch'); - archSpy.mockImplementation(() => arch); }); describe('Validate provided package manager', () => { @@ -142,7 +135,7 @@ describe('cache-restore', () => { await restoreCache(packageManager, ''); expect(hashFilesSpy).toHaveBeenCalled(); expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: node-cache-${platform}-${arch}-${packageManager}-${fileHash}` + `Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}` ); expect(infoSpy).not.toHaveBeenCalledWith( `${packageManager} cache is not found` diff --git a/dist/setup/index.js b/dist/setup/index.js index 5d7eb1e5..832d1db3 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -93303,7 +93303,6 @@ const core = __importStar(__nccwpck_require__(2186)); const glob = __importStar(__nccwpck_require__(8090)); const path_1 = __importDefault(__nccwpck_require__(1017)); const fs_1 = __importDefault(__nccwpck_require__(7147)); -const os_1 = __importDefault(__nccwpck_require__(2037)); const constants_1 = __nccwpck_require__(9042); const cache_utils_1 = __nccwpck_require__(1678); const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { @@ -93312,7 +93311,6 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, throw new Error(`Caching for '${packageManager}' is not supported`); } const platform = process.env.RUNNER_OS; - const arch = os_1.default.arch(); const cachePaths = yield (0, cache_utils_1.getCacheDirectories)(packageManagerInfo, cacheDependencyPath); core.saveState(constants_1.State.CachePaths, cachePaths); const lockFilePath = cacheDependencyPath @@ -93322,7 +93320,7 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, if (!fileHash) { throw new Error('Some specified paths were not resolved, unable to cache dependencies.'); } - const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`; + const keyPrefix = `node-cache-${platform}-${packageManager}`; const primaryKey = `${keyPrefix}-${fileHash}`; core.debug(`primary key is ${primaryKey}`); core.saveState(constants_1.State.CachePrimaryKey, primaryKey); diff --git a/src/cache-restore.ts b/src/cache-restore.ts index af12ad83..3b230970 100644 --- a/src/cache-restore.ts +++ b/src/cache-restore.ts @@ -3,7 +3,6 @@ import * as core from '@actions/core'; import * as glob from '@actions/glob'; import path from 'path'; import fs from 'fs'; -import os from 'os'; import {State} from './constants'; import { @@ -22,7 +21,6 @@ export const restoreCache = async ( throw new Error(`Caching for '${packageManager}' is not supported`); } const platform = process.env.RUNNER_OS; - const arch = os.arch(); const cachePaths = await getCacheDirectories( packageManagerInfo, @@ -40,7 +38,7 @@ export const restoreCache = async ( ); } - const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`; + const keyPrefix = `node-cache-${platform}-${packageManager}`; const primaryKey = `${keyPrefix}-${fileHash}`; core.debug(`primary key is ${primaryKey}`);