@@ -87714,22 +87714,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
87714
87714
}) : function(o, v) {
87715
87715
o["default"] = v;
87716
87716
});
87717
- var __importStar = (this && this.__importStar) || function (mod) {
87718
- if (mod && mod.__esModule) return mod;
87719
- var result = {};
87720
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
87721
- __setModuleDefault(result, mod);
87722
- return result;
87723
- };
87724
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
87725
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
87726
- return new (P || (P = Promise))(function (resolve, reject) {
87727
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
87728
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
87729
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
87730
- step((generator = generator.apply(thisArg, _arguments || [])).next());
87731
- });
87732
- };
87717
+ var __importStar = (this && this.__importStar) || (function () {
87718
+ var ownKeys = function(o) {
87719
+ ownKeys = Object.getOwnPropertyNames || function (o) {
87720
+ var ar = [];
87721
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
87722
+ return ar;
87723
+ };
87724
+ return ownKeys(o);
87725
+ };
87726
+ return function (mod) {
87727
+ if (mod && mod.__esModule) return mod;
87728
+ var result = {};
87729
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
87730
+ __setModuleDefault(result, mod);
87731
+ return result;
87732
+ };
87733
+ })();
87733
87734
Object.defineProperty(exports, "__esModule", ({ value: true }));
87734
87735
exports.State = void 0;
87735
87736
const cache = __importStar(__nccwpck_require__(5116));
@@ -87747,36 +87748,32 @@ class CacheDistributor {
87747
87748
this.cacheDependencyPath = cacheDependencyPath;
87748
87749
this.CACHE_KEY_PREFIX = 'setup-python';
87749
87750
}
87750
- handleLoadedCache() {
87751
- return __awaiter(this, void 0, void 0, function* () { });
87752
- }
87753
- restoreCache() {
87754
- return __awaiter(this, void 0, void 0, function* () {
87755
- const { primaryKey, restoreKey } = yield this.computeKeys();
87756
- if (primaryKey.endsWith('-')) {
87757
- const file = this.packageManager === 'pip'
87758
- ? `${this.cacheDependencyPath
87759
- .split('\n')
87760
- .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
87761
- : this.cacheDependencyPath.split('\n').join(',');
87762
- throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
87763
- }
87764
- const cachePath = yield this.getCacheGlobalDirectories();
87765
- core.saveState(State.CACHE_PATHS, cachePath);
87766
- let matchedKey;
87767
- try {
87768
- matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
87769
- }
87770
- catch (err) {
87771
- const message = err.message;
87772
- core.info(`[warning]${message}`);
87773
- core.setOutput('cache-hit', false);
8000
87774
- return;
87775
- }
87776
- core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
87777
- yield this.handleLoadedCache();
87778
- this.handleMatchResult(matchedKey, primaryKey);
87779
- });
87751
+ async handleLoadedCache() { }
87752
+ async restoreCache() {
87753
+ const { primaryKey, restoreKey } = await this.computeKeys();
87754
+ if (primaryKey.endsWith('-')) {
87755
+ const file = this.packageManager === 'pip'
87756
+ ? `${this.cacheDependencyPath
87757
+ .split('\n')
87758
+ .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
87759
+ : this.cacheDependencyPath.split('\n').join(',');
87760
+ throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
87761
+ }
87762
+ const cachePath = await this.getCacheGlobalDirectories();
87763
+ core.saveState(State.CACHE_PATHS, cachePath);
87764
+ let matchedKey;
87765
+ try {
87766
+ matchedKey = await cache.restoreCache(cachePath, primaryKey, restoreKey);
87767
+ }
87768
+ catch (err) {
87769
+ const message = err.message;
87770
+ core.info(`[warning]${message}`);
87771
+ core.setOutput('cache-hit', false);
87772
+ return;
87773
+ }
87774
+ core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
87775
+ await this.handleLoadedCache();
87776
+ this.handleMatchResult(matchedKey, primaryKey);
87780
87777
}
87781
87778
handleMatchResult(matchedKey, primaryKey) {
87782
87779
if (matchedKey) {
@@ -87827,90 +87824,86 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
87827
87824
}) : function(o, v) {
87828
87825
o["default"] = v;
87829
87826
});
87830
- var __importStar = (this && this.__importStar) || function (mod) {
87831
- if (mod && mod.__esModule) return mod;
87832
- var result = {};
87833
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
87834
- __setModuleDefault(result, mod);
87835
- return result;
87836
- };
87837
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
87838
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
87839
- return new (P || (P = Promise))(function (resolve, reject) {
87840
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
87841
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
87842
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
87843
- step((generator = generator.apply(thisArg, _arguments || [])).next());
87844
- });
87845
- };
87827
+ var __importStar = (this && this.__importStar) || (function () {
87828
+ var ownKeys = function(o) {
87829
+ ownKeys = Object.getOwnPropertyNames || function (o) {
87830
+ var ar = [];
87831
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
87832
+ return ar;
87833
+ };
87834
+ return ownKeys(o);
87835
+ };
87836
+ return function (mod) {
87837
+ if (mod && mod.__esModule) return mod;
87838
+ var result = {};
87839
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
87840
+ __setModuleDefault(result, mod);
87841
+ return result;
87842
+ };
87843
+ })();
87846
87844
var __importDefault = (this && this.__importDefault) || function (mod) {
87847
87845
return (mod && mod.__esModule) ? mod : { "default": mod };
87848
87846
};
87849
87847
Object.defineProperty(exports, "__esModule", ({ value: true }));
87850
- exports.run = void 0 ;
87848
+ exports.run = run ;
87851
87849
const core = __importStar(__nccwpck_require__(7484));
87852
87850
const cache = __importStar(__nccwpck_require__(5116));
87853
87851
const fs_1 = __importDefault(__nccwpck_require__(9896));
87854
87852
const cache_distributor_1 = __nccwpck_require__(2326);
87855
87853
// Added early exit to resolve issue with slow post action step:
87856
87854
// - https://github.com/actions/setup-node/issues/878
87857
87855
// https://github.com/actions/cache/pull/1217
87858
- function run(earlyExit) {
87859
- return __awaiter(this, void 0, void 0, function* () {
87860
- try {
87861
- const cache = core.getInput('cache');
87862
- if (cache) {
87863
- yield saveCache(cache);
87864
- if (earlyExit) {
87865
- process.exit(0);
87866
- }
87856
+ async function run(earlyExit) {
87857
+ try {
87858
+ const cache = core.getInput('cache');
87859
+ if (cache) {
87860
+ await saveCache(cache);
87861
+ if (earlyExit) {
87862
+ process.exit(0);
87867
87863
}
87868
87864
}
87869
- catch (error) {
87870
- const err = error;
87871
- core.setFailed(err.message) ;
87872
- }
87873
- });
87865
+ }
87866
+ catch ( error) {
87867
+ const err = error ;
87868
+ core.setFailed(err.message);
87869
+ }
87874
87870
}
87875
- exports.run = run;
87876
- function saveCache(packageManager) {
87877
- return __awaiter(this, void 0, void 0, function* () {
87878
- const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
87879
- if (!cachePathState) {
87880
- core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
87881
- return;
87882
- }
87883
- const cachePaths = JSON.parse(cachePathState);
87884
- core.debug(`paths for caching are ${cachePaths.join(', ')}`);
87885
- if (!isCacheDirectoryExists(cachePaths)) {
87886
- core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
87887
- return;
87888
- }
87889
- const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
87890
- const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
87891
- if (!primaryKey) {
87892
- core.warning('Error retrieving key from state.');
87893
- return;
87894
- }
87895
- else if (matchedKey === primaryKey) {
87896
- // no change in target directories
87897
- core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
87898
- return;
87899
- }
87900
- let cacheId = 0;
87901
- try {
87902
- cacheId = yield cache.saveCache(cachePaths, primaryKey);
87903
- }
87904
- catch (err) {
87905
- const message = err.message;
87906
- core.info(`[warning]${message}`);
87907
- return;
87908
- }
87909
- if (cacheId == -1) {
87910
- return;
87911
- }
87912
- core.info(`Cache saved with the key: ${primaryKey}`);
87913
- });
87871
+ async function saveCache(packageManager) {
87872
+ const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
87873
+ if (!cachePathState) {
87874
+ core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
87875
+ return;
87876
+ }
87877
+ const cachePaths = JSON.parse(cachePathState);
87878
+ core.debug(`paths for caching are ${cachePaths.join(', ')}`);
87879
+ if (!isCacheDirectoryExists(cachePaths)) {
87880
+ core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
87881
+ return;
87882
+ }
87883
+ const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
87884
+ const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
87885
+ if (!primaryKey) {
87886
+ core.warning('Error retrieving key from state.');
87887
+ return;
87888
+ }
87889
+ else if (matchedKey === primaryKey) {
87890
+ // no change in target directories
87891
+ core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
87892
+ return;
87893
+ }
87894
+ let cacheId = 0;
87895
+ try {
87896
+ cacheId = await cache.saveCache(cachePaths, primaryKey);
87897
+ }
87898
+ catch (err) {
87899
+ const message = err.message;
87900
+ core.info(`[warning]${message}`);
87901
+ return;
87902
+ }
87903
+ if (cacheId == -1) {
87904
+ return;
87905
+ }
87906
+ core.info(`Cache saved with the key: ${primaryKey}`);
87914
87907
}
87915
87908
function isCacheDirectoryExists(cacheDirectory) {
87916
87909
const result = cacheDirectory.reduce((previousValue, currentValue) => {
0 commit comments