This commit is contained in:
Jamie Magee 2023-05-23 13:56:27 -07:00 committed by GitHub
commit 7c44cdd71f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 645 additions and 821 deletions

View File

@ -59042,7 +59042,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];
@ -59059,15 +59063,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));
@ -59085,36 +59080,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) {
@ -59151,7 +59142,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];
@ -59168,15 +59163,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 };
};
@ -59186,58 +59172,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

File diff suppressed because it is too large Load Diff

41
package-lock.json generated
View File

@ -19,12 +19,13 @@
"semver": "^7.1.3"
},
"devDependencies": {
"@tsconfig/node16": "1.0.3",
"@types/jest": "^27.0.2",
"@types/node": "^16.11.25",
"@types/semver": "^7.1.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.33.4",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.2.1",
@ -34,7 +35,7 @@
"jest-circus": "^27.2.5",
"prettier": "^2.8.4",
"ts-jest": "^27.0.5",
"typescript": "^4.2.3"
"typescript": "^4.9.5"
}
},
"node_modules/@actions/cache": {
@ -2383,6 +2384,12 @@
"node": ">= 6"
}
},
"node_modules/@tsconfig/node16": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
"dev": true
},
"node_modules/@types/babel__core": {
"version": "7.1.16",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz",
@ -2723,9 +2730,9 @@
}
},
"node_modules/@vercel/ncc": {
"version": "0.33.4",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
"integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
"version": "0.36.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
@ -6596,9 +6603,9 @@
}
},
"node_modules/typescript": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@ -8784,6 +8791,12 @@
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
"dev": true
},
"@tsconfig/node16": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
"dev": true
},
"@types/babel__core": {
"version": "7.1.16",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz",
@ -9035,9 +9048,9 @@
}
},
"@vercel/ncc": {
"version": "0.33.4",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
"integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
"version": "0.36.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
"dev": true
},
"abab": {
@ -11908,9 +11921,9 @@
}
},
"typescript": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"dev": true
},
"universalify": {

View File

@ -35,12 +35,13 @@
"semver": "^7.1.3"
},
"devDependencies": {
"@tsconfig/node16": "1.0.3",
"@types/jest": "^27.0.2",
"@types/node": "^16.11.25",
"@types/semver": "^7.1.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.33.4",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.2.1",
@ -50,7 +51,7 @@
"jest-circus": "^27.2.5",
"prettier": "^2.8.4",
"ts-jest": "^27.0.5",
"typescript": "^4.2.3"
"typescript": "^4.9.5"
},
"husky": {
"skipCI": true,

View File

@ -1,64 +1,12 @@
{
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"resolveJsonModule": true, /* Allows importing modules with a '.json' extension, which is a common practice in node projects. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"outDir": "./lib",
"rootDir": "./src",
"resolveJsonModule": true,
},
"exclude": ["node_modules", "**/*.test.ts"]
"exclude": [
"node_modules",
"**/*.test.ts"
]
}