| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 65b0712 commit 3d1e2d2
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97935,7 +97935,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | |||
| 97935 | 97935 | return (mod && mod.__esModule) ? mod : { "default": mod }; | |
| 97936 | 97936 | }; | |
| 97937 | 97937 | Object.defineProperty(exports, "__esModule", ({ value: true })); | |
| 97938 | - exports.cacheDependencies = void 0; | ||
| 97939 | 97938 | const core = __importStar(__nccwpck_require__(7484)); | |
| 97940 | 97939 | const finder = __importStar(__nccwpck_require__(6843)); | |
| 97941 | 97940 | const finderPyPy = __importStar(__nccwpck_require__(2625)); | |
@@ -97954,50 +97953,10 @@ function isGraalPyVersion(versionSpec) { | |||
| 97954 | 97953 | function cacheDependencies(cache, pythonVersion) { | |
| 97955 | 97954 | return __awaiter(this, void 0, void 0, function* () { | |
| 97956 | 97955 | const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined; | |
| 97957 | - let resolvedDependencyPath = undefined; | ||
| 97958 | - if (cacheDependencyPath) { | ||
| 97959 | - const actionPath = process.env.GITHUB_ACTION_PATH || ''; | ||
| 97960 | - const workspace = process.env.GITHUB_WORKSPACE || process.cwd(); | ||
| 97961 | - const sourcePath = path.resolve(actionPath, cacheDependencyPath); | ||
| 97962 | - const relativePath = path.relative(actionPath, sourcePath); | ||
| 97963 | - const targetPath = path.resolve(workspace, relativePath); | ||
| 97964 | - try { | ||
| 97965 | - const sourceExists = yield fs_1.default.promises | ||
| 97966 | - .access(sourcePath, fs_1.default.constants.F_OK) | ||
| 97967 | - .then(() => true) | ||
| 97968 | - .catch(() => false); | ||
| 97969 | - if (!sourceExists) { | ||
| 97970 | - core.warning(`The resolved cache-dependency-path does not exist: ${sourcePath}`); | ||
| 97971 | - } | ||
| 97972 | - else { | ||
| 97973 | - if (sourcePath !== targetPath) { | ||
| 97974 | - const targetDir = path.dirname(targetPath); | ||
| 97975 | - // Create target directory if it doesn't exist | ||
| 97976 | - yield fs_1.default.promises.mkdir(targetDir, { recursive: true }); | ||
| 97977 | - // Copy file asynchronously | ||
| 97978 | - yield fs_1.default.promises.copyFile(sourcePath, targetPath); | ||
| 97979 | - core.info(`Copied ${sourcePath} to ${targetPath}`); | ||
| 97980 | - } | ||
| 97981 | - else { | ||
| 97982 | - core.info(`Dependency file is already inside the workspace: ${sourcePath}`); | ||
| 97983 | - } | ||
| 97984 | - resolvedDependencyPath = path | ||
| 97985 | - .relative(workspace, targetPath) | ||
| 97986 | - .replace(/\\/g, '/'); | ||
| 97987 | - core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`); | ||
| 97988 | - } | ||
| 97989 | - } | ||
| 97990 | - catch (error) { | ||
| 97991 | - core.warning(`Failed to copy file from ${sourcePath} to ${targetPath}: ${error}`); | ||
| 97992 | - } | ||
| 97993 | - } | ||
| 97994 | - // Pass resolvedDependencyPath if available, else fallback to original input | ||
| 97995 | - const dependencyPathForCache = resolvedDependencyPath !== null && resolvedDependencyPath !== void 0 ? resolvedDependencyPath : cacheDependencyPath; | ||
| 97996 | - const cacheDistributor = (0, cache_factory_1.getCacheDistributor)(cache, pythonVersion, dependencyPathForCache); | ||
| 97956 | + const cacheDistributor = (0, cache_factory_1.getCacheDistributor)(cache, pythonVersion, cacheDependencyPath); | ||
| 97997 | 97957 | yield cacheDistributor.restoreCache(); | |
| 97998 | 97958 | }); | |
| 97999 | 97959 | } | |
| 98000 | - exports.cacheDependencies = cacheDependencies; | ||
| 98001 | 97960 | function resolveVersionInputFromDefaultFile() { | |
| 98002 | 97961 | const couples = [ | |
| 98003 | 97962 | ['.python-version', utils_1.getVersionsInputFromPlainFile] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -421,7 +421,7 @@ steps: | |||
| 421 | 421 | - run: pip install -e . | |
| 422 | 422 | # Or pip install -e '.[test]' to install test dependencies | |
| 423 | 423 | ``` | |
| 424 | - Note: cache-dependency-path supports files located outside the workspace root by copying them into the workspace to enable proper caching. | ||
| 424 | + | ||
| 425 | 425 | # Outputs and environment variables | |
| 426 | 426 | ||
| 427 | 427 | ## Outputs | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,62 +22,13 @@ function isGraalPyVersion(versionSpec: string) { | |||
| 22 | 22 | return versionSpec.startsWith('graalpy'); | |
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | - export async function cacheDependencies(cache: string, pythonVersion: string) { | ||
| 25 | + async function cacheDependencies(cache: string, pythonVersion: string) { | ||
| 26 | 26 | const cacheDependencyPath = | |
| 27 | 27 | core.getInput('cache-dependency-path') || undefined; | |
| 28 | - let resolvedDependencyPath: string | undefined = undefined; | ||
| 29 | - | ||
| 30 | - if (cacheDependencyPath) { | ||
| 31 | - const actionPath = process.env.GITHUB_ACTION_PATH || ''; | ||
| 32 | - const workspace = process.env.GITHUB_WORKSPACE || process.cwd(); | ||
| 33 | - | ||
| 34 | - const sourcePath = path.resolve(actionPath, cacheDependencyPath); | ||
| 35 | - const relativePath = path.relative(actionPath, sourcePath); | ||
| 36 | - const targetPath = path.resolve(workspace, relativePath); | ||
| 37 | - | ||
| 38 | - try { | ||
| 39 | - const sourceExists = await fs.promises | ||
| 40 | - .access(sourcePath, fs.constants.F_OK) | ||
| 41 | - .then(() => true) | ||
| 42 | - .catch(() => false); | ||
| 43 | - | ||
| 44 | - if (!sourceExists) { | ||
| 45 | - core.warning( | ||
| 46 | - `The resolved cache-dependency-path does not exist: ${sourcePath}` | ||
| 47 | - ); | ||
| 48 | - } else { | ||
| 49 | - if (sourcePath !== targetPath) { | ||
| 50 | - const targetDir = path.dirname(targetPath); | ||
| 51 | - // Create target directory if it doesn't exist | ||
| 52 | - await fs.promises.mkdir(targetDir, {recursive: true}); | ||
| 53 | - // Copy file asynchronously | ||
| 54 | - await fs.promises.copyFile(sourcePath, targetPath); | ||
| 55 | - core.info(`Copied ${sourcePath} to ${targetPath}`); | ||
| 56 | - } else { | ||
| 57 | - core.info( | ||
| 58 | - `Dependency file is already inside the workspace: ${sourcePath}` | ||
| 59 | - ); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - resolvedDependencyPath = path | ||
| 63 | - .relative(workspace, targetPath) | ||
| 64 | - .replace(/\\/g, '/'); | ||
| 65 | - core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`); | ||
| 66 | - } | ||
| 67 | - } catch (error) { | ||
| 68 | - core.warning( | ||
| 69 | - `Failed to copy file from ${sourcePath} to ${targetPath}: ${error}` | ||
| 70 | - ); | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - // Pass resolvedDependencyPath if available, else fallback to original input | ||
| 75 | - const dependencyPathForCache = resolvedDependencyPath ?? cacheDependencyPath; | ||
| 76 | - | ||
| 77 | 28 | const cacheDistributor = getCacheDistributor( | |
| 78 | 29 | cache, | |
| 79 | 30 | pythonVersion, | |
| 80 | - dependencyPathForCache | ||
| 31 | + cacheDependencyPath | ||
| 81 | 32 | ); | |
| 82 | 33 | await cacheDistributor.restoreCache(); | |
| 83 | 34 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments