Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d1e2d2

Browse files
Revert "Enhance cache-dependency-path handling to support files outside the workspace root" (#1186)
* Revert "Enhance cache-dependency-path handling to support files outside the w…"This reverts commit1264885.* pckage.json version update---------Co-authored-by: Haritha <73516759+HarithaVattikuti@users.noreply.github.com>
1 parent65b0712 commit3d1e2d2

File tree

4 files changed

+4
-243
lines changed

4 files changed

+4
-243
lines changed

‎__tests__/setup-python.test.ts‎

Lines changed: 0 additions & 149 deletions
This file was deleted.

‎dist/setup/index.js‎

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -97935,7 +97935,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9793597935
return (mod && mod.__esModule) ? mod : { "default": mod };
9793697936
};
9793797937
Object.defineProperty(exports, "__esModule", ({ value: true }));
97938-
exports.cacheDependencies = void 0;
9793997938
const core = __importStar(__nccwpck_require__(7484));
9794097939
const finder = __importStar(__nccwpck_require__(6843));
9794197940
const finderPyPy = __importStar(__nccwpck_require__(2625));
@@ -97954,50 +97953,10 @@ function isGraalPyVersion(versionSpec) {
9795497953
function cacheDependencies(cache, pythonVersion) {
9795597954
return __awaiter(this, void 0, void 0, function* () {
9795697955
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);
9799797957
yield cacheDistributor.restoreCache();
9799897958
});
9799997959
}
98000-
exports.cacheDependencies = cacheDependencies;
9800197960
function resolveVersionInputFromDefaultFile() {
9800297961
const couples = [
9800397962
['.python-version', utils_1.getVersionsInputFromPlainFile]

‎docs/advanced-usage.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ steps:
421421
- run: pip install -e .
422422
# Or pip install -e '.[test]' to install test dependencies
423423
```
424-
Note:cache-dependency-path supports files located outside the workspace root by copying them into the workspace to enable proper caching.
424+
425425
# Outputs and environment variables
426426

427427
## Outputs

‎src/setup-python.ts‎

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,13 @@ function isGraalPyVersion(versionSpec: string) {
2222
returnversionSpec.startsWith('graalpy');
2323
}
2424

25-
exportasyncfunctioncacheDependencies(cache:string,pythonVersion:string){
25+
asyncfunctioncacheDependencies(cache:string,pythonVersion:string){
2626
constcacheDependencyPath=
2727
core.getInput('cache-dependency-path')||undefined;
28-
letresolvedDependencyPath:string|undefined=undefined;
29-
30-
if(cacheDependencyPath){
31-
constactionPath=process.env.GITHUB_ACTION_PATH||'';
32-
constworkspace=process.env.GITHUB_WORKSPACE||process.cwd();
33-
34-
constsourcePath=path.resolve(actionPath,cacheDependencyPath);
35-
constrelativePath=path.relative(actionPath,sourcePath);
36-
consttargetPath=path.resolve(workspace,relativePath);
37-
38-
try{
39-
constsourceExists=awaitfs.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-
consttargetDir=path.dirname(targetPath);
51-
// Create target directory if it doesn't exist
52-
awaitfs.promises.mkdir(targetDir,{recursive:true});
53-
// Copy file asynchronously
54-
awaitfs.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-
constdependencyPathForCache=resolvedDependencyPath??cacheDependencyPath;
76-
7728
constcacheDistributor=getCacheDistributor(
7829
cache,
7930
pythonVersion,
80-
dependencyPathForCache
31+
cacheDependencyPath
8132
);
8233
awaitcacheDistributor.restoreCache();
8334
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp