mirror of
https://github.com/actions/setup-python.git
synced 2025-07-01 23:23:46 +00:00
Use @tsonfig/node16
This commit is contained in:
parent
df6abcc733
commit
4e025854d4
5 changed files with 645 additions and 821 deletions
180
dist/cache-save/index.js
vendored
180
dist/cache-save/index.js
vendored
|
@ -59977,7 +59977,11 @@ module.exports = v4;
|
|||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
|
@ -59994,15 +59998,6 @@ 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());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.State = void 0;
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
|
@ -60020,36 +60015,32 @@ class CacheDistributor {
|
|||
this.cacheDependencyPath = cacheDependencyPath;
|
||||
this.CACHE_KEY_PREFIX = 'setup-python';
|
||||
}
|
||||
handleLoadedCache() {
|
||||
return __awaiter(this, void 0, void 0, function* () { });
|
||||
}
|
||||
restoreCache() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { primaryKey, restoreKey } = yield this.computeKeys();
|
||||
if (primaryKey.endsWith('-')) {
|
||||
const file = this.packageManager === 'pip'
|
||||
? `${this.cacheDependencyPath
|
||||
.split('\n')
|
||||
.join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
|
||||
: this.cacheDependencyPath.split('\n').join(',');
|
||||
throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
|
||||
}
|
||||
const cachePath = yield this.getCacheGlobalDirectories();
|
||||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
let matchedKey;
|
||||
try {
|
||||
matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
}
|
||||
catch (err) {
|
||||
const message = err.message;
|
||||
core.info(`[warning]${message}`);
|
||||
core.setOutput('cache-hit', false);
|
||||
return;
|
||||
}
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
yield this.handleLoadedCache();
|
||||
this.handleMatchResult(matchedKey, primaryKey);
|
||||
});
|
||||
async handleLoadedCache() { }
|
||||
async restoreCache() {
|
||||
const { primaryKey, restoreKey } = await this.computeKeys();
|
||||
if (primaryKey.endsWith('-')) {
|
||||
const file = this.packageManager === 'pip'
|
||||
? `${this.cacheDependencyPath
|
||||
.split('\n')
|
||||
.join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
|
||||
: this.cacheDependencyPath.split('\n').join(',');
|
||||
throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
|
||||
}
|
||||
const cachePath = await this.getCacheGlobalDirectories();
|
||||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
let matchedKey;
|
||||
try {
|
||||
matchedKey = await cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
}
|
||||
catch (err) {
|
||||
const message = err.message;
|
||||
core.info(`[warning]${message}`);
|
||||
core.setOutput('cache-hit', false);
|
||||
return;
|
||||
}
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
await this.handleLoadedCache();
|
||||
this.handleMatchResult(matchedKey, primaryKey);
|
||||
}
|
||||
handleMatchResult(matchedKey, primaryKey) {
|
||||
if (matchedKey) {
|
||||
|
@ -60086,7 +60077,11 @@ exports.CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml';
|
|||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
|
@ -60103,15 +60098,6 @@ 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 };
|
||||
};
|
||||
|
@ -60121,58 +60107,54 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const cache_distributor_1 = __nccwpck_require__(8953);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const cache = core.getInput('cache');
|
||||
if (cache) {
|
||||
yield saveCache(cache);
|
||||
}
|
||||
async function run() {
|
||||
try {
|
||||
const cache = core.getInput('cache');
|
||||
if (cache) {
|
||||
await saveCache(cache);
|
||||
}
|
||||
catch (error) {
|
||||
const err = error;
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
const err = error;
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
}
|
||||
exports.run = run;
|
||||
function saveCache(packageManager) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
|
||||
if (!cachePathState) {
|
||||
core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
|
||||
return;
|
||||
}
|
||||
const cachePaths = JSON.parse(cachePathState);
|
||||
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
|
||||
if (!isCacheDirectoryExists(cachePaths)) {
|
||||
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}`);
|
||||
}
|
||||
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
|
||||
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
|
||||
if (!primaryKey) {
|
||||
core.warning('Error retrieving key from state.');
|
||||
return;
|
||||
}
|
||||
else if (matchedKey === primaryKey) {
|
||||
// no change in target directories
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
let cacheId = 0;
|
||||
try {
|
||||
cacheId = yield cache.saveCache(cachePaths, primaryKey);
|
||||
}
|
||||
catch (err) {
|
||||
const message = err.message;
|
||||
core.info(`[warning]${message}`);
|
||||
return;
|
||||
}
|
||||
if (cacheId == -1) {
|
||||
return;
|
||||
}
|
||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||
});
|
||||
async function saveCache(packageManager) {
|
||||
const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
|
||||
if (!cachePathState) {
|
||||
core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
|
||||
return;
|
||||
}
|
||||
const cachePaths = JSON.parse(cachePathState);
|
||||
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
|
||||
if (!isCacheDirectoryExists(cachePaths)) {
|
||||
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}`);
|
||||
}
|
||||
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
|
||||
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
|
||||
if (!primaryKey) {
|
||||
core.warning('Error retrieving key from state.');
|
||||
return;
|
||||
}
|
||||
else if (matchedKey === primaryKey) {
|
||||
// no change in target directories
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
let cacheId = 0;
|
||||
try {
|
||||
cacheId = await cache.saveCache(cachePaths, primaryKey);
|
||||
}
|
||||
catch (err) {
|
||||
const message = err.message;
|
||||
core.info(`[warning]${message}`);
|
||||
return;
|
||||
}
|
||||
if (cacheId == -1) {
|
||||
return;
|
||||
}
|
||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||
}
|
||||
function isCacheDirectoryExists(cacheDirectory) {
|
||||
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||
|
|
1172
dist/setup/index.js
vendored
1172
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue