Skip to content

Commit 5f0e3d5

Browse files
check failures fix
1 parent 23543aa commit 5f0e3d5

File tree

2 files changed

+1032
-1116
lines changed

2 files changed

+1032
-1116
lines changed

dist/cache-save/index.js

Lines changed: 108 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -86644,22 +86644,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
8664486644
}) : function(o, v) {
8664586645
o["default"] = v;
8664686646
});
86647-
var __importStar = (this && this.__importStar) || function (mod) {
86648-
if (mod && mod.__esModule) return mod;
86649-
var result = {};
86650-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
86651-
__setModuleDefault(result, mod);
86652-
return result;
86653-
};
86654-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
86655-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
86656-
return new (P || (P = Promise))(function (resolve, reject) {
86657-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
86658-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
86659-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
86660-
step((generator = generator.apply(thisArg, _arguments || [])).next());
86661-
});
86662-
};
86647+
var __importStar = (this && this.__importStar) || (function () {
86648+
var ownKeys = function(o) {
86649+
ownKeys = Object.getOwnPropertyNames || function (o) {
86650+
var ar = [];
86651+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
86652+
return ar;
86653+
};
86654+
return ownKeys(o);
86655+
};
86656+
return function (mod) {
86657+
if (mod && mod.__esModule) return mod;
86658+
var result = {};
86659+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
86660+
__setModuleDefault(result, mod);
86661+
return result;
86662+
};
86663+
})();
8666386664
Object.defineProperty(exports, "__esModule", ({ value: true }));
8666486665
exports.State = void 0;
8666586666
const cache = __importStar(__nccwpck_require__(5116));
@@ -86677,36 +86678,32 @@ class CacheDistributor {
8667786678
this.cacheDependencyPath = cacheDependencyPath;
8667886679
this.CACHE_KEY_PREFIX = 'setup-python';
8667986680
}
86680-
handleLoadedCache() {
86681-
return __awaiter(this, void 0, void 0, function* () { });
86682-
}
86683-
restoreCache() {
86684-
return __awaiter(this, void 0, void 0, function* () {
86685-
const { primaryKey, restoreKey } = yield this.computeKeys();
86686-
if (primaryKey.endsWith('-')) {
86687-
const file = this.packageManager === 'pip'
86688-
? `${this.cacheDependencyPath
86689-
.split('\n')
86690-
.join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
86691-
: this.cacheDependencyPath.split('\n').join(',');
86692-
throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
86693-
}
86694-
const cachePath = yield this.getCacheGlobalDirectories();
86695-
core.saveState(State.CACHE_PATHS, cachePath);
86696-
let matchedKey;
86697-
try {
86698-
matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
86699-
}
86700-
catch (err) {
86701-
const message = err.message;
86702-
core.info(`[warning]${message}`);
86703-
core.setOutput('cache-hit', false);
86704-
return;
86705-
}
86706-
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
86707-
yield this.handleLoadedCache();
86708-
this.handleMatchResult(matchedKey, primaryKey);
86709-
});
86681+
async handleLoadedCache() { }
86682+
async restoreCache() {
86683+
const { primaryKey, restoreKey } = await this.computeKeys();
86684+
if (primaryKey.endsWith('-')) {
86685+
const file = this.packageManager === 'pip'
86686+
? `${this.cacheDependencyPath
86687+
.split('\n')
86688+
.join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
86689+
: this.cacheDependencyPath.split('\n').join(',');
86690+
throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
86691+
}
86692+
const cachePath = await this.getCacheGlobalDirectories();
86693+
core.saveState(State.CACHE_PATHS, cachePath);
86694+
let matchedKey;
86695+
try {
86696+
matchedKey = await cache.restoreCache(cachePath, primaryKey, restoreKey);
86697+
}
86698+
catch (err) {
86699+
const message = err.message;
86700+
core.info(`[warning]${message}`);
86701+
core.setOutput('cache-hit', false);
86702+
return;
86703+
}
86704+
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
86705+
await this.handleLoadedCache();
86706+
this.handleMatchResult(matchedKey, primaryKey);
8671086707
}
8671186708
handleMatchResult(matchedKey, primaryKey) {
8671286709
if (matchedKey) {
@@ -86757,89 +86754,85 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
8675786754
}) : function(o, v) {
8675886755
o["default"] = v;
8675986756
});
86760-
var __importStar = (this && this.__importStar) || function (mod) {
86761-
if (mod && mod.__esModule) return mod;
86762-
var result = {};
86763-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
86764-
__setModuleDefault(result, mod);
86765-
return result;
86766-
};
86767-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
86768-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
86769-
return new (P || (P = Promise))(function (resolve, reject) {
86770-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
86771-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
86772-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
86773-
step((generator = generator.apply(thisArg, _arguments || [])).next());
86774-
});
86775-
};
86757+
var __importStar = (this && this.__importStar) || (function () {
86758+
var ownKeys = function(o) {
86759+
ownKeys = Object.getOwnPropertyNames || function (o) {
86760+
var ar = [];
86761+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
86762+
return ar;
86763+
};
86764+
return ownKeys(o);
86765+
};
86766+
return function (mod) {
86767+
if (mod && mod.__esModule) return mod;
86768+
var result = {};
86769+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
86770+
__setModuleDefault(result, mod);
86771+
return result;
86772+
};
86773+
})();
8677686774
var __importDefault = (this && this.__importDefault) || function (mod) {
8677786775
return (mod && mod.__esModule) ? mod : { "default": mod };
8677886776
};
8677986777
Object.defineProperty(exports, "__esModule", ({ value: true }));
86780-
exports.run = void 0;
86778+
exports.run = run;
8678186779
const core = __importStar(__nccwpck_require__(7484));
8678286780
const cache = __importStar(__nccwpck_require__(5116));
8678386781
const fs_1 = __importDefault(__nccwpck_require__(9896));
8678486782
const cache_distributor_1 = __nccwpck_require__(2326);
8678586783
// Added early exit to resolve issue with slow post action step:
8678686784
// - https://github.com/actions/setup-node/issues/878
8678786785
// https://github.com/actions/cache/pull/1217
86788-
function run(earlyExit) {
86789-
return __awaiter(this, void 0, void 0, function* () {
86790-
try {
86791-
const cache = core.getInput('cache');
86792-
if (cache) {
86793-
yield saveCache(cache);
86794-
if (earlyExit) {
86795-
process.exit(0);
86796-
}
86786+
async function run(earlyExit) {
86787+
try {
86788+
const cache = core.getInput('cache');
86789+
if (cache) {
86790+
await saveCache(cache);
86791+
if (earlyExit) {
86792+
process.exit(0);
8679786793
}
8679886794
}
86799-
catch (error) {
86800-
const err = error;
86801-
core.setFailed(err.message);
86802-
}
86803-
});
86795+
}
86796+
catch (error) {
86797+
const err = error;
86798+
core.setFailed(err.message);
86799+
}
8680486800
}
86805-
exports.run = run;
86806-
function saveCache(packageManager) {
86807-
return __awaiter(this, void 0, void 0, function* () {
86808-
const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
86809-
if (!cachePathState) {
86810-
core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
86811-
return;
86812-
}
86813-
const cachePaths = JSON.parse(cachePathState);
86814-
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
86815-
if (!isCacheDirectoryExists(cachePaths)) {
86816-
throw new Error(`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.`);
86817-
}
86818-
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
86819-
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
86820-
if (!primaryKey) {
86821-
core.warning('Error retrieving key from state.');
86822-
return;
86823-
}
86824-
else if (matchedKey === primaryKey) {
86825-
// no change in target directories
86826-
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
86827-
return;
86828-
}
86829-
let cacheId = 0;
86830-
try {
86831-
cacheId = yield cache.saveCache(cachePaths, primaryKey);
86832-
}
86833-
catch (err) {
86834-
const message = err.message;
86835-
core.info(`[warning]${message}`);
86836-
return;
86837-
}
86838-
if (cacheId == -1) {
86839-
return;
86840-
}
86841-
core.info(`Cache saved with the key: ${primaryKey}`);
86842-
});
86801+
async function saveCache(packageManager) {
86802+
const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
86803+
if (!cachePathState) {
86804+
core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
86805+
return;
86806+
}
86807+
const cachePaths = JSON.parse(cachePathState);
86808+
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
86809+
if (!isCacheDirectoryExists(cachePaths)) {
86810+
throw new Error(`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.`);
86811+
}
86812+
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
86813+
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
86814+
if (!primaryKey) {
86815+
core.warning('Error retrieving key from state.');
86816+
return;
86817+
}
86818+
else if (matchedKey === primaryKey) {
86819+
// no change in target directories
86820+
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
86821+
return;
86822+
}
86823+
let cacheId = 0;
86824+
try {
86825+
cacheId = await cache.saveCache(cachePaths, primaryKey);
86826+
}
86827+
catch (err) {
86828+
const message = err.message;
86829+
core.info(`[warning]${message}`);
86830+
return;
86831+
}
86832+
if (cacheId == -1) {
86833+
return;
86834+
}
86835+
core.info(`Cache saved with the key: ${primaryKey}`);
8684386836
}
8684486837
function isCacheDirectoryExists(cacheDirectory) {
8684586838
const result = cacheDirectory.reduce((previousValue, currentValue) => {

0 commit comments

Comments
 (0)