From 2cdf4ccee9afe789d871732eb767d0d4e241659a Mon Sep 17 00:00:00 2001 From: panticmilos Date: Sat, 2 Jul 2022 14:06:55 +0200 Subject: [PATCH 01/19] add release to primary key --- src/cache-distributions/pip-cache.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index 17055ea5a..c47e3cf50 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -57,8 +57,8 @@ class PipCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; + const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os.release()}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os.release()}-python-${this.pythonVersion}-${this.packageManager}`; return { primaryKey, From e16bc7c6e9c2d67f897578f7ee866961e72fa73c Mon Sep 17 00:00:00 2001 From: panticmilos Date: Sat, 2 Jul 2022 14:08:18 +0200 Subject: [PATCH 02/19] run build --- dist/setup/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index f1c0ac3a7..af708d8a3 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64430,8 +64430,8 @@ class PipCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; + const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os_1.default.release()}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os_1.default.release()}-python-${this.pythonVersion}-${this.packageManager}`; return { primaryKey, restoreKey: [restoreKey] From b1af1ac3a28159c20769811e6617e04a239e6542 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Thu, 7 Jul 2022 18:13:04 +0200 Subject: [PATCH 03/19] add releases --- dist/setup/index.js | 62 ++++++++++++++++++++++++++-- src/cache-distributions/pip-cache.ts | 8 ++-- src/utils.ts | 46 +++++++++++++++++++++ 3 files changed, 110 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index af708d8a3..05b38a33e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64430,8 +64430,9 @@ class PipCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os_1.default.release()}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os_1.default.release()}-python-${this.pythonVersion}-${this.packageManager}`; + const osRelease = utils_1.getOSRelease(); + const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; return { primaryKey, restoreKey: [restoreKey] @@ -65347,11 +65348,20 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_LINUX = exports.IS_WINDOWS = void 0; +exports.getOSRelease = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_LINUX = exports.IS_WINDOWS = void 0; const cache = __importStar(__nccwpck_require__(7799)); const core = __importStar(__nccwpck_require__(2186)); const fs_1 = __importDefault(__nccwpck_require__(7147)); @@ -65362,6 +65372,8 @@ exports.IS_LINUX = process.platform === 'linux'; exports.WINDOWS_ARCHS = ['x86', 'x64']; exports.WINDOWS_PLATFORMS = ['win32', 'win64']; const PYPY_VERSION_FILE = 'PYPY_VERSION'; +const exec = __importStar(__nccwpck_require__(1514)); +const os_1 = __importDefault(__nccwpck_require__(2037)); /** create Symlinks for downloaded PyPy * It should be executed only for downloaded versions in runtime, because * toolcache versions have this setup. @@ -65440,6 +65452,50 @@ function isCacheFeatureAvailable() { return true; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; +function getOSRelease() { + return __awaiter(this, void 0, void 0, function* () { + if (exports.IS_WINDOWS) { + return os_1.default.release(); + } + else if (exports.IS_LINUX) { + const version = yield exec.getExecOutput('cat', ['/etc/*release | grep -E ^NAME']); + return version.stdout.split('=')[1]; + } + else { + macosRelease(os_1.default.release()); + } + }); +} +exports.getOSRelease = getOSRelease; +function macosRelease(release) { + const macRelease = Number((release || os_1.default.release()).split('.')[0]); + const [name, version] = nameMap.get(macRelease) || ['Unknown', '']; + return { + name, + version, + }; +} +exports["default"] = macosRelease; +const nameMap = new Map([ + [22, ['Ventura', '13']], + [21, ['Monterey', '12']], + [20, ['Big Sur', '11']], + [19, ['Catalina', '10.15']], + [18, ['Mojave', '10.14']], + [17, ['High Sierra', '10.13']], + [16, ['Sierra', '10.12']], + [15, ['El Capitan', '10.11']], + [14, ['Yosemite', '10.10']], + [13, ['Mavericks', '10.9']], + [12, ['Mountain Lion', '10.8']], + [11, ['Lion', '10.7']], + [10, ['Snow Leopard', '10.6']], + [9, ['Leopard', '10.5']], + [8, ['Tiger', '10.4']], + [7, ['Panther', '10.3']], + [6, ['Jaguar', '10.2']], + [5, ['Puma', '10.1']], +]); /***/ }), diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index c47e3cf50..be786ae97 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import os from 'os'; import CacheDistributor from './cache-distributor'; -import {IS_WINDOWS} from '../utils'; +import {getOSRelease, IS_WINDOWS} from '../utils'; class PipCache extends CacheDistributor { constructor( @@ -57,8 +57,10 @@ class PipCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os.release()}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${os.release()}-python-${this.pythonVersion}-${this.packageManager}`; + const osRelease = getOSRelease(); + + const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; return { primaryKey, diff --git a/src/utils.ts b/src/utils.ts index eb3a1ba68..d103e90e9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -10,6 +10,9 @@ export const WINDOWS_ARCHS = ['x86', 'x64']; export const WINDOWS_PLATFORMS = ['win32', 'win64']; const PYPY_VERSION_FILE = 'PYPY_VERSION'; +import * as exec from '@actions/exec'; + +import os from 'os'; export interface IPyPyManifestAsset { filename: string; arch: string; @@ -119,3 +122,46 @@ export function isCacheFeatureAvailable(): boolean { return true; } + +export async function getOSRelease() { + if(IS_WINDOWS) { + return os.release(); + } else if(IS_LINUX) { + const version = await exec.getExecOutput('cat', ['/etc/*release | grep -E ^NAME']); + return version.stdout.split('=')[1]; + } else { + macosRelease(os.release()) + } +} + +export default function macosRelease(release : string) { + const macRelease = Number((release || os.release()).split('.')[0]); + + const [name, version] = nameMap.get(macRelease) || ['Unknown', '']; + + return { + name, + version, + }; +} + +const nameMap = new Map([ + [22, ['Ventura', '13']], + [21, ['Monterey', '12']], + [20, ['Big Sur', '11']], + [19, ['Catalina', '10.15']], + [18, ['Mojave', '10.14']], + [17, ['High Sierra', '10.13']], + [16, ['Sierra', '10.12']], + [15, ['El Capitan', '10.11']], + [14, ['Yosemite', '10.10']], + [13, ['Mavericks', '10.9']], + [12, ['Mountain Lion', '10.8']], + [11, ['Lion', '10.7']], + [10, ['Snow Leopard', '10.6']], + [9, ['Leopard', '10.5']], + [8, ['Tiger', '10.4']], + [7, ['Panther', '10.3']], + [6, ['Jaguar', '10.2']], + [5, ['Puma', '10.1']], +]); \ No newline at end of file From 4a9025f655bc06060ca01e66f7f62dbc155b96d2 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Thu, 7 Jul 2022 18:21:41 +0200 Subject: [PATCH 04/19] add releases --- dist/setup/index.js | 2 +- src/cache-distributions/pip-cache.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 05b38a33e..8479904a7 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64430,7 +64430,7 @@ class PipCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const osRelease = utils_1.getOSRelease(); + const osRelease = yield utils_1.getOSRelease(); const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; return { diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index be786ae97..3e3e7c3b3 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -57,7 +57,7 @@ class PipCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const osRelease = getOSRelease(); + const osRelease = await getOSRelease(); const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; From 23169522641781efca455e2cae8ca12ff9eaf392 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Thu, 7 Jul 2022 18:34:23 +0200 Subject: [PATCH 05/19] update --- dist/setup/index.js | 4 ++-- src/utils.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 8479904a7..9c9d97a90 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,11 +65458,11 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const version = yield exec.getExecOutput('cat', ['/etc/*release | grep -E ^NAME']); + const version = yield exec.getExecOutput('cat', ['cat /etc/os-release']); return version.stdout.split('=')[1]; } else { - macosRelease(os_1.default.release()); + return macosRelease(os_1.default.release()); } }); } diff --git a/src/utils.ts b/src/utils.ts index d103e90e9..76f7e6523 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,10 +127,10 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const version = await exec.getExecOutput('cat', ['/etc/*release | grep -E ^NAME']); + const version = await exec.getExecOutput('cat', ['cat /etc/os-release']); return version.stdout.split('=')[1]; } else { - macosRelease(os.release()) + return macosRelease(os.release()) } } From 342fea48789917ee5a4d949dd20e51e714689408 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:26:30 +0200 Subject: [PATCH 06/19] Ubuntu dep key --- dist/setup/index.js | 5 +++-- src/utils.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 9c9d97a90..db9e688dc 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,11 +65458,12 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const version = yield exec.getExecOutput('cat', ['cat /etc/os-release']); + const version = yield exec.getExecOutput('lsb_release', ['-r']); return version.stdout.split('=')[1]; } else { - return macosRelease(os_1.default.release()); + const macOSRelease = macosRelease(os_1.default.release()); + return `${macOSRelease.name}_${macOSRelease.version}`; } }); } diff --git a/src/utils.ts b/src/utils.ts index 76f7e6523..6a227ad2c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,10 +127,11 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const version = await exec.getExecOutput('cat', ['cat /etc/os-release']); + const version = await exec.getExecOutput('lsb_release', ['-r']); return version.stdout.split('=')[1]; } else { - return macosRelease(os.release()) + const macOSRelease = macosRelease(os.release()); + return `${macOSRelease.name}_${macOSRelease.version}` } } From 778a86d097533e60071faf48fbf03b4589f65088 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:29:27 +0200 Subject: [PATCH 07/19] Ubuntu dep key --- dist/setup/index.js | 1 + src/utils.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index db9e688dc..c290e6415 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65459,6 +65459,7 @@ function getOSRelease() { } else if (exports.IS_LINUX) { const version = yield exec.getExecOutput('lsb_release', ['-r']); + core.info(version.stdout); return version.stdout.split('=')[1]; } else { diff --git a/src/utils.ts b/src/utils.ts index 6a227ad2c..eaff428fa 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -128,6 +128,7 @@ export async function getOSRelease() { return os.release(); } else if(IS_LINUX) { const version = await exec.getExecOutput('lsb_release', ['-r']); + core.info(version.stdout) return version.stdout.split('=')[1]; } else { const macOSRelease = macosRelease(os.release()); From 40da00d877af70ef04387301abaf852d61989f28 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:32:21 +0200 Subject: [PATCH 08/19] Ubuntu dep key --- dist/setup/index.js | 4 ++-- src/utils.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index c290e6415..2cee5e743 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65459,8 +65459,8 @@ function getOSRelease() { } else if (exports.IS_LINUX) { const version = yield exec.getExecOutput('lsb_release', ['-r']); - core.info(version.stdout); - return version.stdout.split('=')[1]; + core.info(version.stdout.split(':')[1].trim()); + return version.stdout.split(':')[1].trim(); } else { const macOSRelease = macosRelease(os_1.default.release()); diff --git a/src/utils.ts b/src/utils.ts index eaff428fa..906d9a625 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -128,8 +128,8 @@ export async function getOSRelease() { return os.release(); } else if(IS_LINUX) { const version = await exec.getExecOutput('lsb_release', ['-r']); - core.info(version.stdout) - return version.stdout.split('=')[1]; + core.info(version.stdout.split(':')[1].trim()) + return version.stdout.split(':')[1].trim(); } else { const macOSRelease = macosRelease(os.release()); return `${macOSRelease.name}_${macOSRelease.version}` From 3459742876827fe99ddd1c4189876fe98055e666 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:39:41 +0200 Subject: [PATCH 09/19] Ubuntu dep key --- dist/setup/index.js | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 2cee5e743..37e0101b4 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,7 +65458,7 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const version = yield exec.getExecOutput('lsb_release', ['-r']); + const version = yield exec.getExecOutput('lsb_release', ['-a']); core.info(version.stdout.split(':')[1].trim()); return version.stdout.split(':')[1].trim(); } diff --git a/src/utils.ts b/src/utils.ts index 906d9a625..82c362f49 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,7 +127,7 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const version = await exec.getExecOutput('lsb_release', ['-r']); + const version = await exec.getExecOutput('lsb_release', ['-a']); core.info(version.stdout.split(':')[1].trim()) return version.stdout.split(':')[1].trim(); } else { From 34dc338e82595d7bc028fa23fbabb883c48224aa Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:40:21 +0200 Subject: [PATCH 10/19] Ubuntu dep key --- dist/setup/index.js | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 37e0101b4..a7d68cb14 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65459,7 +65459,7 @@ function getOSRelease() { } else if (exports.IS_LINUX) { const version = yield exec.getExecOutput('lsb_release', ['-a']); - core.info(version.stdout.split(':')[1].trim()); + core.info(version.stdout); return version.stdout.split(':')[1].trim(); } else { diff --git a/src/utils.ts b/src/utils.ts index 82c362f49..a454f62ae 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -128,7 +128,7 @@ export async function getOSRelease() { return os.release(); } else if(IS_LINUX) { const version = await exec.getExecOutput('lsb_release', ['-a']); - core.info(version.stdout.split(':')[1].trim()) + core.info(version.stdout) return version.stdout.split(':')[1].trim(); } else { const macOSRelease = macosRelease(os.release()); From 592462e3c78f10292bddf2876045e0260dc125e6 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:43:23 +0200 Subject: [PATCH 11/19] Ubuntu dep key --- dist/setup/index.js | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index a7d68cb14..35db26aeb 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,7 +65458,7 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const version = yield exec.getExecOutput('lsb_release', ['-a']); + const version = yield exec.getExecOutput('lsb_release', ['-i -r']); core.info(version.stdout); return version.stdout.split(':')[1].trim(); } diff --git a/src/utils.ts b/src/utils.ts index a454f62ae..5732b7d56 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,7 +127,7 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const version = await exec.getExecOutput('lsb_release', ['-a']); + const version = await exec.getExecOutput('lsb_release', ['-i -r']); core.info(version.stdout) return version.stdout.split(':')[1].trim(); } else { From ba6bc8e26b77a1316311d38d1f0de7ed6aa36d25 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:48:44 +0200 Subject: [PATCH 12/19] Ubuntu dep key --- dist/setup/index.js | 8 +++++--- src/utils.ts | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 35db26aeb..2196b2901 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,9 +65458,11 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const version = yield exec.getExecOutput('lsb_release', ['-i -r']); - core.info(version.stdout); - return version.stdout.split(':')[1].trim(); + const versionRelease = yield exec.getExecOutput('lsb_release', ['-a']); + const versionId = yield exec.getExecOutput('lsb_release', ['-i']); + core.info(versionId.stdout); + core.info(versionRelease.stdout); + return versionRelease.stdout.split(':')[1].trim(); } else { const macOSRelease = macosRelease(os_1.default.release()); diff --git a/src/utils.ts b/src/utils.ts index 5732b7d56..fddaa9dd4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,9 +127,12 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const version = await exec.getExecOutput('lsb_release', ['-i -r']); - core.info(version.stdout) - return version.stdout.split(':')[1].trim(); + const versionRelease = await exec.getExecOutput('lsb_release', ['-a']); + const versionId = await exec.getExecOutput('lsb_release', ['-i']); + + core.info(versionId.stdout) + core.info(versionRelease.stdout) + return versionRelease.stdout.split(':')[1].trim(); } else { const macOSRelease = macosRelease(os.release()); return `${macOSRelease.name}_${macOSRelease.version}` From 921c593b06e125b1751156a6a81cfd104c2b9ed9 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:51:18 +0200 Subject: [PATCH 13/19] Ubuntu dep key --- dist/setup/index.js | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 2196b2901..4a7500b1c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,7 +65458,7 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const versionRelease = yield exec.getExecOutput('lsb_release', ['-a']); + const versionRelease = yield exec.getExecOutput('lsb_release', ['-r']); const versionId = yield exec.getExecOutput('lsb_release', ['-i']); core.info(versionId.stdout); core.info(versionRelease.stdout); diff --git a/src/utils.ts b/src/utils.ts index fddaa9dd4..ab8ce2c32 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,7 +127,7 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const versionRelease = await exec.getExecOutput('lsb_release', ['-a']); + const versionRelease = await exec.getExecOutput('lsb_release', ['-r']); const versionId = await exec.getExecOutput('lsb_release', ['-i']); core.info(versionId.stdout) From 08311c9565177080ebc149dd54c8023eeb63307f Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:56:41 +0200 Subject: [PATCH 14/19] Ubuntu dep key --- dist/setup/index.js | 15 +++++++++++---- src/utils.ts | 14 ++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 4a7500b1c..e1eaf79c8 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,11 +65458,18 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const versionRelease = yield exec.getExecOutput('lsb_release', ['-r']); const versionId = yield exec.getExecOutput('lsb_release', ['-i']); - core.info(versionId.stdout); - core.info(versionRelease.stdout); - return versionRelease.stdout.split(':')[1].trim(); + let osVersion = ''; + let osRelease = ''; + versionId.stdout.split('\n').forEach(elem => { + if (elem.includes('Distributor')) + osVersion = elem.split(':')[1].trim(); + if (elem.includes('Release')) + osRelease = elem.split(':')[1].trim(); + }); + core.info(osRelease); + core.info(osVersion); + return `${osVersion}-${osRelease}`; } else { const macOSRelease = macosRelease(os_1.default.release()); diff --git a/src/utils.ts b/src/utils.ts index ab8ce2c32..b74cf5518 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,12 +127,18 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const versionRelease = await exec.getExecOutput('lsb_release', ['-r']); const versionId = await exec.getExecOutput('lsb_release', ['-i']); + let osVersion = '' + let osRelease = '' - core.info(versionId.stdout) - core.info(versionRelease.stdout) - return versionRelease.stdout.split(':')[1].trim(); + versionId.stdout.split('\n').forEach(elem => { + if(elem.includes('Distributor')) osVersion = elem.split(':')[1].trim() + if(elem.includes('Release')) osRelease = elem.split(':')[1].trim() + }) + + core.info(osRelease) + core.info(osVersion) + return `${osVersion}-${osRelease}` } else { const macOSRelease = macosRelease(os.release()); return `${macOSRelease.name}_${macOSRelease.version}` From e1269e2a9421066330044c004ca0cb0fdc999b61 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 10:59:33 +0200 Subject: [PATCH 15/19] Ubuntu dep key --- dist/setup/index.js | 3 +++ src/utils.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index e1eaf79c8..59baa1d24 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65461,6 +65461,9 @@ function getOSRelease() { const versionId = yield exec.getExecOutput('lsb_release', ['-i']); let osVersion = ''; let osRelease = ''; + core.info("1"); + core.info(versionId.stdout); + core.info("2"); versionId.stdout.split('\n').forEach(elem => { if (elem.includes('Distributor')) osVersion = elem.split(':')[1].trim(); diff --git a/src/utils.ts b/src/utils.ts index b74cf5518..d65353856 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -131,6 +131,10 @@ export async function getOSRelease() { let osVersion = '' let osRelease = '' + core.info("1") + core.info(versionId.stdout) + core.info("2") + versionId.stdout.split('\n').forEach(elem => { if(elem.includes('Distributor')) osVersion = elem.split(':')[1].trim() if(elem.includes('Release')) osRelease = elem.split(':')[1].trim() From 0299bb6bcbb507cc19970e4114a61521cf050b16 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 11:00:39 +0200 Subject: [PATCH 16/19] Ubuntu dep key --- dist/setup/index.js | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 59baa1d24..d5539781e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -65458,7 +65458,7 @@ function getOSRelease() { return os_1.default.release(); } else if (exports.IS_LINUX) { - const versionId = yield exec.getExecOutput('lsb_release', ['-i']); + const versionId = yield exec.getExecOutput('lsb_release', ['-a']); let osVersion = ''; let osRelease = ''; core.info("1"); diff --git a/src/utils.ts b/src/utils.ts index d65353856..9835cc6c7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -127,7 +127,7 @@ export async function getOSRelease() { if(IS_WINDOWS) { return os.release(); } else if(IS_LINUX) { - const versionId = await exec.getExecOutput('lsb_release', ['-i']); + const versionId = await exec.getExecOutput('lsb_release', ['-a']); let osVersion = '' let osRelease = '' From a13783dfb4472429b33dace0c05cfabc3adfa5f4 Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 11:09:45 +0200 Subject: [PATCH 17/19] Ubuntu dep key --- dist/setup/index.js | 116 ++++++++++-------------- src/cache-distributions/pip-cache.ts | 16 +++- src/cache-distributions/pipenv-cache.ts | 20 +++- src/cache-distributions/poetry-cache.ts | 17 +++- src/utils.ts | 71 +++------------ 5 files changed, 106 insertions(+), 134 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index d5539781e..b52162e4b 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64430,9 +64430,17 @@ class PipCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const osRelease = yield utils_1.getOSRelease(); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; + const osRelease = yield utils_1.getLinuxOSReleaseInfo(); + let primaryKey = ''; + let restoreKey = ''; + if (utils_1.IS_LINUX) { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; + } + else { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; + } return { primaryKey, restoreKey: [restoreKey] @@ -64487,6 +64495,7 @@ const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); const core = __importStar(__nccwpck_require__(2186)); const cache_distributor_1 = __importDefault(__nccwpck_require__(8953)); +const utils_1 = __nccwpck_require__(1314); class PipenvCache extends cache_distributor_1.default { constructor(pythonVersion, patterns = '**/Pipfile.lock') { super('pipenv', patterns); @@ -64512,12 +64521,21 @@ class PipenvCache extends cache_distributor_1.default { } computeKeys() { return __awaiter(this, void 0, void 0, function* () { - const hash = yield glob.hashFiles(this.patterns); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = undefined; + const hash = yield glob.hashFiles(this.cacheDependencyPath); + const osRelease = yield utils_1.getLinuxOSReleaseInfo(); + let primaryKey = ''; + let restoreKey = ''; + if (utils_1.IS_LINUX) { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; + } + else { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; + } return { primaryKey, - restoreKey + restoreKey: [restoreKey] }; }); } @@ -64568,6 +64586,7 @@ const glob = __importStar(__nccwpck_require__(8090)); const path = __importStar(__nccwpck_require__(1017)); const exec = __importStar(__nccwpck_require__(1514)); const cache_distributor_1 = __importDefault(__nccwpck_require__(8953)); +const utils_1 = __nccwpck_require__(1314); class PoetryCache extends cache_distributor_1.default { constructor(pythonVersion, patterns = '**/poetry.lock') { super('poetry', patterns); @@ -64588,8 +64607,15 @@ class PoetryCache extends cache_distributor_1.default { } computeKeys() { return __awaiter(this, void 0, void 0, function* () { - const hash = yield glob.hashFiles(this.patterns); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const hash = yield glob.hashFiles(this.cacheDependencyPath); + const osRelease = yield utils_1.getLinuxOSReleaseInfo(); + let primaryKey = ''; + if (utils_1.IS_LINUX) { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + } + else { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + } const restoreKey = undefined; return { primaryKey, @@ -65361,7 +65387,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getOSRelease = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_LINUX = exports.IS_WINDOWS = void 0; +exports.getLinuxOSReleaseInfo = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_LINUX = exports.IS_WINDOWS = void 0; const cache = __importStar(__nccwpck_require__(7799)); const core = __importStar(__nccwpck_require__(2186)); const fs_1 = __importDefault(__nccwpck_require__(7147)); @@ -65373,7 +65399,6 @@ exports.WINDOWS_ARCHS = ['x86', 'x64']; exports.WINDOWS_PLATFORMS = ['win32', 'win64']; const PYPY_VERSION_FILE = 'PYPY_VERSION'; const exec = __importStar(__nccwpck_require__(1514)); -const os_1 = __importDefault(__nccwpck_require__(2037)); /** create Symlinks for downloaded PyPy * It should be executed only for downloaded versions in runtime, because * toolcache versions have this setup. @@ -65452,64 +65477,23 @@ function isCacheFeatureAvailable() { return true; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; -function getOSRelease() { +function getLinuxOSReleaseInfo() { return __awaiter(this, void 0, void 0, function* () { - if (exports.IS_WINDOWS) { - return os_1.default.release(); - } - else if (exports.IS_LINUX) { - const versionId = yield exec.getExecOutput('lsb_release', ['-a']); - let osVersion = ''; - let osRelease = ''; - core.info("1"); - core.info(versionId.stdout); - core.info("2"); - versionId.stdout.split('\n').forEach(elem => { - if (elem.includes('Distributor')) - osVersion = elem.split(':')[1].trim(); - if (elem.includes('Release')) - osRelease = elem.split(':')[1].trim(); - }); - core.info(osRelease); - core.info(osVersion); - return `${osVersion}-${osRelease}`; - } - else { - const macOSRelease = macosRelease(os_1.default.release()); - return `${macOSRelease.name}_${macOSRelease.version}`; - } + const versionId = yield exec.getExecOutput('lsb_release', ['-a']); + let osVersion = ''; + let osRelease = ''; + versionId.stdout.split('\n').forEach(elem => { + if (elem.includes('Distributor')) + osVersion = elem.split(':')[1].trim(); + if (elem.includes('Release')) + osRelease = elem.split(':')[1].trim(); + }); + core.info(osRelease); + core.info(osVersion); + return `${osVersion}-${osRelease}`; }); } -exports.getOSRelease = getOSRelease; -function macosRelease(release) { - const macRelease = Number((release || os_1.default.release()).split('.')[0]); - const [name, version] = nameMap.get(macRelease) || ['Unknown', '']; - return { - name, - version, - }; -} -exports["default"] = macosRelease; -const nameMap = new Map([ - [22, ['Ventura', '13']], - [21, ['Monterey', '12']], - [20, ['Big Sur', '11']], - [19, ['Catalina', '10.15']], - [18, ['Mojave', '10.14']], - [17, ['High Sierra', '10.13']], - [16, ['Sierra', '10.12']], - [15, ['El Capitan', '10.11']], - [14, ['Yosemite', '10.10']], - [13, ['Mavericks', '10.9']], - [12, ['Mountain Lion', '10.8']], - [11, ['Lion', '10.7']], - [10, ['Snow Leopard', '10.6']], - [9, ['Leopard', '10.5']], - [8, ['Tiger', '10.4']], - [7, ['Panther', '10.3']], - [6, ['Jaguar', '10.2']], - [5, ['Puma', '10.1']], -]); +exports.getLinuxOSReleaseInfo = getLinuxOSReleaseInfo; /***/ }), diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index 3e3e7c3b3..85e9de495 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import os from 'os'; import CacheDistributor from './cache-distributor'; -import {getOSRelease, IS_WINDOWS} from '../utils'; +import {getLinuxOSReleaseInfo, IS_LINUX, IS_WINDOWS} from '../utils'; class PipCache extends CacheDistributor { constructor( @@ -57,10 +57,18 @@ class PipCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const osRelease = await getOSRelease(); + const osRelease = await getLinuxOSReleaseInfo(); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; + let primaryKey = '' + let restoreKey = '' + + if(IS_LINUX) { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; + } else { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; + } return { primaryKey, diff --git a/src/cache-distributions/pipenv-cache.ts b/src/cache-distributions/pipenv-cache.ts index fd1994a68..c89b439d1 100644 --- a/src/cache-distributions/pipenv-cache.ts +++ b/src/cache-distributions/pipenv-cache.ts @@ -4,6 +4,7 @@ import * as path from 'path'; import * as core from '@actions/core'; import CacheDistributor from './cache-distributor'; +import { getLinuxOSReleaseInfo, IS_LINUX } from '../utils'; class PipenvCache extends CacheDistributor { constructor( @@ -31,12 +32,23 @@ class PipenvCache extends CacheDistributor { } protected async computeKeys() { - const hash = await glob.hashFiles(this.patterns); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = undefined; + const hash = await glob.hashFiles(this.cacheDependencyPath); + const osRelease = await getLinuxOSReleaseInfo(); + + let primaryKey = '' + let restoreKey = '' + + if(IS_LINUX) { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; + } else { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; + } + return { primaryKey, - restoreKey + restoreKey: [restoreKey] }; } } diff --git a/src/cache-distributions/poetry-cache.ts b/src/cache-distributions/poetry-cache.ts index 5e22b5dd7..32d45d566 100644 --- a/src/cache-distributions/poetry-cache.ts +++ b/src/cache-distributions/poetry-cache.ts @@ -4,6 +4,7 @@ import * as path from 'path'; import * as exec from '@actions/exec'; import CacheDistributor from './cache-distributor'; +import { getLinuxOSReleaseInfo, IS_LINUX } from '../utils'; class PoetryCache extends CacheDistributor { constructor( @@ -32,9 +33,19 @@ class PoetryCache extends CacheDistributor { } protected async computeKeys() { - const hash = await glob.hashFiles(this.patterns); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; - const restoreKey = undefined; + const hash = await glob.hashFiles(this.cacheDependencyPath); + const osRelease = await getLinuxOSReleaseInfo(); + + let primaryKey = '' + + if(IS_LINUX) { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + } else { + primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + } + + const restoreKey = undefined + return { primaryKey, restoreKey diff --git a/src/utils.ts b/src/utils.ts index 9835cc6c7..0af58ea2b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -123,60 +123,17 @@ export function isCacheFeatureAvailable(): boolean { return true; } -export async function getOSRelease() { - if(IS_WINDOWS) { - return os.release(); - } else if(IS_LINUX) { - const versionId = await exec.getExecOutput('lsb_release', ['-a']); - let osVersion = '' - let osRelease = '' - - core.info("1") - core.info(versionId.stdout) - core.info("2") - - versionId.stdout.split('\n').forEach(elem => { - if(elem.includes('Distributor')) osVersion = elem.split(':')[1].trim() - if(elem.includes('Release')) osRelease = elem.split(':')[1].trim() - }) - - core.info(osRelease) - core.info(osVersion) - return `${osVersion}-${osRelease}` - } else { - const macOSRelease = macosRelease(os.release()); - return `${macOSRelease.name}_${macOSRelease.version}` - } -} - -export default function macosRelease(release : string) { - const macRelease = Number((release || os.release()).split('.')[0]); - - const [name, version] = nameMap.get(macRelease) || ['Unknown', '']; - - return { - name, - version, - }; -} - -const nameMap = new Map([ - [22, ['Ventura', '13']], - [21, ['Monterey', '12']], - [20, ['Big Sur', '11']], - [19, ['Catalina', '10.15']], - [18, ['Mojave', '10.14']], - [17, ['High Sierra', '10.13']], - [16, ['Sierra', '10.12']], - [15, ['El Capitan', '10.11']], - [14, ['Yosemite', '10.10']], - [13, ['Mavericks', '10.9']], - [12, ['Mountain Lion', '10.8']], - [11, ['Lion', '10.7']], - [10, ['Snow Leopard', '10.6']], - [9, ['Leopard', '10.5']], - [8, ['Tiger', '10.4']], - [7, ['Panther', '10.3']], - [6, ['Jaguar', '10.2']], - [5, ['Puma', '10.1']], -]); \ No newline at end of file +export async function getLinuxOSReleaseInfo() { + const versionId = await exec.getExecOutput('lsb_release', ['-a']); + let osVersion = '' + let osRelease = '' + + versionId.stdout.split('\n').forEach(elem => { + if(elem.includes('Distributor')) osVersion = elem.split(':')[1].trim() + if(elem.includes('Release')) osRelease = elem.split(':')[1].trim() + }) + + core.info(osRelease) + core.info(osVersion) + return `${osVersion}-${osRelease}` +} \ No newline at end of file From 3e309b7a80a235271f2e5de6e5e0c92b671cbd1a Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 11:11:35 +0200 Subject: [PATCH 18/19] Ubuntu dep key --- dist/setup/index.js | 2 +- src/cache-distributions/pipenv-cache.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index b52162e4b..78d082a5d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64522,10 +64522,10 @@ class PipenvCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const osRelease = yield utils_1.getLinuxOSReleaseInfo(); let primaryKey = ''; let restoreKey = ''; if (utils_1.IS_LINUX) { + const osRelease = yield utils_1.getLinuxOSReleaseInfo(); primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; } diff --git a/src/cache-distributions/pipenv-cache.ts b/src/cache-distributions/pipenv-cache.ts index c89b439d1..9d027f278 100644 --- a/src/cache-distributions/pipenv-cache.ts +++ b/src/cache-distributions/pipenv-cache.ts @@ -33,12 +33,12 @@ class PipenvCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const osRelease = await getLinuxOSReleaseInfo(); let primaryKey = '' let restoreKey = '' if(IS_LINUX) { + const osRelease = await getLinuxOSReleaseInfo(); primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; } else { From 7c86a97729a31d1fe06194c78eef104014b899ac Mon Sep 17 00:00:00 2001 From: panticmilos Date: Fri, 15 Jul 2022 11:13:02 +0200 Subject: [PATCH 19/19] Ubuntu dep key --- dist/setup/index.js | 4 ++-- src/cache-distributions/pip-cache.ts | 2 +- src/cache-distributions/poetry-cache.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 78d082a5d..2368c2740 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64430,10 +64430,10 @@ class PipCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const osRelease = yield utils_1.getLinuxOSReleaseInfo(); let primaryKey = ''; let restoreKey = ''; if (utils_1.IS_LINUX) { + const osRelease = yield utils_1.getLinuxOSReleaseInfo(); primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; } @@ -64608,9 +64608,9 @@ class PoetryCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const osRelease = yield utils_1.getLinuxOSReleaseInfo(); let primaryKey = ''; if (utils_1.IS_LINUX) { + const osRelease = yield utils_1.getLinuxOSReleaseInfo(); primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; } else { diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index 85e9de495..4afb6e928 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -57,12 +57,12 @@ class PipCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const osRelease = await getLinuxOSReleaseInfo(); let primaryKey = '' let restoreKey = '' if(IS_LINUX) { + const osRelease = await getLinuxOSReleaseInfo(); primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}`; } else { diff --git a/src/cache-distributions/poetry-cache.ts b/src/cache-distributions/poetry-cache.ts index 32d45d566..43ec3b568 100644 --- a/src/cache-distributions/poetry-cache.ts +++ b/src/cache-distributions/poetry-cache.ts @@ -34,11 +34,11 @@ class PoetryCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const osRelease = await getLinuxOSReleaseInfo(); let primaryKey = '' if(IS_LINUX) { + const osRelease = await getLinuxOSReleaseInfo(); primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osRelease}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; } else { primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;