You've already forked setup-python
mirror of
https://github.com/actions/setup-python.git
synced 2025-07-17 04:20:31 +07:00
Compare commits
2 Commits
dependabot
...
main
Author | SHA1 | Date | |
---|---|---|---|
532b046aaf | |||
1264885983 |
4
.github/workflows/e2e-cache-freethreaded.yml
vendored
4
.github/workflows/e2e-cache-freethreaded.yml
vendored
@ -58,7 +58,7 @@ jobs:
|
|||||||
macos-latest,
|
macos-latest,
|
||||||
macos-13
|
macos-13
|
||||||
]
|
]
|
||||||
python-version: [3.13.0t, 3.13.1t, 3.13.2t]
|
python-version: [3.13.1t, 3.13.2t, 3.13.5t]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
@ -148,7 +148,7 @@ jobs:
|
|||||||
macos-latest,
|
macos-latest,
|
||||||
macos-13
|
macos-13
|
||||||
]
|
]
|
||||||
python-version: [3.13.0t, 3.13.1t, 3.13.2t]
|
python-version: [3.13.1t, 3.13.2t, 3.13.5t]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
|
3
.github/workflows/e2e-tests.yml
vendored
3
.github/workflows/e2e-tests.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
- name: Verify 3.9.13
|
- name: Verify 3.9.13
|
||||||
run: python __tests__/verify-python.py 3.9.13
|
run: python __tests__/verify-python.py 3.9.13
|
||||||
|
|
||||||
- name: Run with setup-python 3.9.13
|
- name: Run with setup-python 3.10.11
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
python-version: 3.10.11
|
python-version: 3.10.11
|
||||||
@ -89,6 +89,7 @@ jobs:
|
|||||||
python-version: '<3.13'
|
python-version: '<3.13'
|
||||||
- name: Verify <3.13
|
- name: Verify <3.13
|
||||||
run: python __tests__/verify-python.py 3.12
|
run: python __tests__/verify-python.py 3.12
|
||||||
|
|
||||||
- name: Test Raw Endpoint Access
|
- name: Test Raw Endpoint Access
|
||||||
run: |
|
run: |
|
||||||
curl -L https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | jq empty
|
curl -L https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | jq empty
|
||||||
|
1
.github/workflows/test-pypy.yml
vendored
1
.github/workflows/test-pypy.yml
vendored
@ -88,7 +88,6 @@ jobs:
|
|||||||
- macos-13
|
- macos-13
|
||||||
- macos-14
|
- macos-14
|
||||||
- macos-15
|
- macos-15
|
||||||
- windows-2019
|
|
||||||
- windows-2022
|
- windows-2022
|
||||||
- windows-2025
|
- windows-2025
|
||||||
- ubuntu-22.04
|
- ubuntu-22.04
|
||||||
|
149
__tests__/setup-python.test.ts
Normal file
149
__tests__/setup-python.test.ts
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import {cacheDependencies} from '../src/setup-python';
|
||||||
|
import {getCacheDistributor} from '../src/cache-distributions/cache-factory';
|
||||||
|
|
||||||
|
jest.mock('fs', () => {
|
||||||
|
const actualFs = jest.requireActual('fs');
|
||||||
|
return {
|
||||||
|
...actualFs,
|
||||||
|
promises: {
|
||||||
|
access: jest.fn(),
|
||||||
|
mkdir: jest.fn(),
|
||||||
|
copyFile: jest.fn(),
|
||||||
|
writeFile: jest.fn(),
|
||||||
|
appendFile: jest.fn()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
jest.mock('@actions/core');
|
||||||
|
jest.mock('../src/cache-distributions/cache-factory');
|
||||||
|
|
||||||
|
const mockedFsPromises = fs.promises as jest.Mocked<typeof fs.promises>;
|
||||||
|
const mockedCore = core as jest.Mocked<typeof core>;
|
||||||
|
const mockedGetCacheDistributor = getCacheDistributor as jest.Mock;
|
||||||
|
|
||||||
|
describe('cacheDependencies', () => {
|
||||||
|
const mockRestoreCache = jest.fn();
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
process.env.GITHUB_ACTION_PATH = '/github/action';
|
||||||
|
process.env.GITHUB_WORKSPACE = '/github/workspace';
|
||||||
|
|
||||||
|
mockedCore.getInput.mockReturnValue('nested/deps.lock');
|
||||||
|
|
||||||
|
// Simulate file exists by resolving access without error
|
||||||
|
mockedFsPromises.access.mockImplementation(async p => {
|
||||||
|
const pathStr = typeof p === 'string' ? p : p.toString();
|
||||||
|
if (pathStr === '/github/action/nested/deps.lock') {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
// Simulate directory doesn't exist to test mkdir
|
||||||
|
if (pathStr === path.dirname('/github/workspace/nested/deps.lock')) {
|
||||||
|
return Promise.reject(new Error('no dir'));
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Simulate mkdir success
|
||||||
|
mockedFsPromises.mkdir.mockResolvedValue(undefined);
|
||||||
|
|
||||||
|
// Simulate copyFile success
|
||||||
|
mockedFsPromises.copyFile.mockResolvedValue(undefined);
|
||||||
|
|
||||||
|
mockedGetCacheDistributor.mockReturnValue({restoreCache: mockRestoreCache});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('copies the dependency file and resolves the path with directory structure', async () => {
|
||||||
|
await cacheDependencies('pip', '3.12');
|
||||||
|
|
||||||
|
const sourcePath = path.resolve('/github/action', 'nested/deps.lock');
|
||||||
|
const targetPath = path.resolve('/github/workspace', 'nested/deps.lock');
|
||||||
|
|
||||||
|
expect(mockedFsPromises.access).toHaveBeenCalledWith(
|
||||||
|
sourcePath,
|
||||||
|
fs.constants.F_OK
|
||||||
|
);
|
||||||
|
expect(mockedFsPromises.mkdir).toHaveBeenCalledWith(
|
||||||
|
path.dirname(targetPath),
|
||||||
|
{
|
||||||
|
recursive: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
expect(mockedFsPromises.copyFile).toHaveBeenCalledWith(
|
||||||
|
sourcePath,
|
||||||
|
targetPath
|
||||||
|
);
|
||||||
|
expect(mockedCore.info).toHaveBeenCalledWith(
|
||||||
|
`Copied ${sourcePath} to ${targetPath}`
|
||||||
|
);
|
||||||
|
expect(mockedCore.info).toHaveBeenCalledWith(
|
||||||
|
`Resolved cache-dependency-path: nested/deps.lock`
|
||||||
|
);
|
||||||
|
expect(mockRestoreCache).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('warns if the dependency file does not exist', async () => {
|
||||||
|
// Simulate file does not exist by rejecting access
|
||||||
|
mockedFsPromises.access.mockRejectedValue(new Error('file not found'));
|
||||||
|
|
||||||
|
await cacheDependencies('pip', '3.12');
|
||||||
|
|
||||||
|
expect(mockedCore.warning).toHaveBeenCalledWith(
|
||||||
|
expect.stringContaining('does not exist')
|
||||||
|
);
|
||||||
|
expect(mockedFsPromises.copyFile).not.toHaveBeenCalled();
|
||||||
|
expect(mockRestoreCache).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('warns if file copy fails', async () => {
|
||||||
|
// Simulate copyFile failure
|
||||||
|
mockedFsPromises.copyFile.mockRejectedValue(new Error('copy failed'));
|
||||||
|
|
||||||
|
await cacheDependencies('pip', '3.12');
|
||||||
|
|
||||||
|
expect(mockedCore.warning).toHaveBeenCalledWith(
|
||||||
|
expect.stringContaining('Failed to copy file')
|
||||||
|
);
|
||||||
|
expect(mockRestoreCache).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('skips path logic if no input is provided', async () => {
|
||||||
|
mockedCore.getInput.mockReturnValue('');
|
||||||
|
|
||||||
|
await cacheDependencies('pip', '3.12');
|
||||||
|
|
||||||
|
expect(mockedFsPromises.copyFile).not.toHaveBeenCalled();
|
||||||
|
expect(mockedCore.warning).not.toHaveBeenCalled();
|
||||||
|
expect(mockRestoreCache).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not copy if dependency file is already inside the workspace but still sets resolved path', async () => {
|
||||||
|
// Simulate cacheDependencyPath inside workspace
|
||||||
|
mockedCore.getInput.mockReturnValue('deps.lock');
|
||||||
|
|
||||||
|
// Override sourcePath and targetPath to be equal
|
||||||
|
const actionPath = '/github/workspace'; // same path for action and workspace
|
||||||
|
process.env.GITHUB_ACTION_PATH = actionPath;
|
||||||
|
process.env.GITHUB_WORKSPACE = actionPath;
|
||||||
|
|
||||||
|
// access resolves to simulate file exists
|
||||||
|
mockedFsPromises.access.mockResolvedValue();
|
||||||
|
|
||||||
|
await cacheDependencies('pip', '3.12');
|
||||||
|
|
||||||
|
const sourcePath = path.resolve(actionPath, 'deps.lock');
|
||||||
|
const targetPath = sourcePath; // same path
|
||||||
|
|
||||||
|
expect(mockedFsPromises.copyFile).not.toHaveBeenCalled();
|
||||||
|
expect(mockedCore.info).toHaveBeenCalledWith(
|
||||||
|
`Dependency file is already inside the workspace: ${sourcePath}`
|
||||||
|
);
|
||||||
|
expect(mockedCore.info).toHaveBeenCalledWith(
|
||||||
|
`Resolved cache-dependency-path: deps.lock`
|
||||||
|
);
|
||||||
|
expect(mockRestoreCache).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
68
dist/setup/index.js
vendored
68
dist/setup/index.js
vendored
@ -96103,11 +96103,32 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
|
|||||||
if (utils_1.IS_WINDOWS) {
|
if (utils_1.IS_WINDOWS) {
|
||||||
// Add --user directory
|
// Add --user directory
|
||||||
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
|
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
|
||||||
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
|
// Extract version details
|
||||||
const version = path.basename(path.dirname(installDir));
|
const version = path.basename(path.dirname(installDir));
|
||||||
const major = semver.major(version);
|
const major = semver.major(version);
|
||||||
const minor = semver.minor(version);
|
const minor = semver.minor(version);
|
||||||
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
const basePath = process.env['APPDATA'] || '';
|
||||||
|
let versionSuffix = `${major}${minor}`;
|
||||||
|
// Append '-32' for x86 architecture if Python version is >= 3.10
|
||||||
|
if (architecture === 'x86' &&
|
||||||
|
(major > 3 || (major === 3 && minor >= 10))) {
|
||||||
|
versionSuffix += '-32';
|
||||||
|
}
|
||||||
|
else if (architecture === 'arm64') {
|
||||||
|
versionSuffix += '-arm64';
|
||||||
|
}
|
||||||
|
// Append 't' for freethreaded builds
|
||||||
|
if (freethreaded) {
|
||||||
|
versionSuffix += 't';
|
||||||
|
if (architecture === 'x86-freethreaded') {
|
||||||
|
versionSuffix += '-32';
|
||||||
|
}
|
||||||
|
else if (architecture === 'arm64-freethreaded') {
|
||||||
|
versionSuffix += '-arm64';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add user Scripts path
|
||||||
|
const userScriptsDir = path.join(basePath, 'Python', `Python${versionSuffix}`, 'Scripts');
|
||||||
core.addPath(userScriptsDir);
|
core.addPath(userScriptsDir);
|
||||||
}
|
}
|
||||||
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
||||||
@ -96844,6 +96865,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.cacheDependencies = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const finder = __importStar(__nccwpck_require__(6843));
|
const finder = __importStar(__nccwpck_require__(6843));
|
||||||
const finderPyPy = __importStar(__nccwpck_require__(2625));
|
const finderPyPy = __importStar(__nccwpck_require__(2625));
|
||||||
@ -96862,10 +96884,50 @@ function isGraalPyVersion(versionSpec) {
|
|||||||
function cacheDependencies(cache, pythonVersion) {
|
function cacheDependencies(cache, pythonVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined;
|
const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined;
|
||||||
const cacheDistributor = (0, cache_factory_1.getCacheDistributor)(cache, pythonVersion, cacheDependencyPath);
|
let resolvedDependencyPath = undefined;
|
||||||
|
if (cacheDependencyPath) {
|
||||||
|
const actionPath = process.env.GITHUB_ACTION_PATH || '';
|
||||||
|
const workspace = process.env.GITHUB_WORKSPACE || process.cwd();
|
||||||
|
const sourcePath = path.resolve(actionPath, cacheDependencyPath);
|
||||||
|
const relativePath = path.relative(actionPath, sourcePath);
|
||||||
|
const targetPath = path.resolve(workspace, relativePath);
|
||||||
|
try {
|
||||||
|
const sourceExists = yield fs_1.default.promises
|
||||||
|
.access(sourcePath, fs_1.default.constants.F_OK)
|
||||||
|
.then(() => true)
|
||||||
|
.catch(() => false);
|
||||||
|
if (!sourceExists) {
|
||||||
|
core.warning(`The resolved cache-dependency-path does not exist: ${sourcePath}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (sourcePath !== targetPath) {
|
||||||
|
const targetDir = path.dirname(targetPath);
|
||||||
|
// Create target directory if it doesn't exist
|
||||||
|
yield fs_1.default.promises.mkdir(targetDir, { recursive: true });
|
||||||
|
// Copy file asynchronously
|
||||||
|
yield fs_1.default.promises.copyFile(sourcePath, targetPath);
|
||||||
|
core.info(`Copied ${sourcePath} to ${targetPath}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`Dependency file is already inside the workspace: ${sourcePath}`);
|
||||||
|
}
|
||||||
|
resolvedDependencyPath = path
|
||||||
|
.relative(workspace, targetPath)
|
||||||
|
.replace(/\\/g, '/');
|
||||||
|
core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.warning(`Failed to copy file from ${sourcePath} to ${targetPath}: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Pass resolvedDependencyPath if available, else fallback to original input
|
||||||
|
const dependencyPathForCache = resolvedDependencyPath !== null && resolvedDependencyPath !== void 0 ? resolvedDependencyPath : cacheDependencyPath;
|
||||||
|
const cacheDistributor = (0, cache_factory_1.getCacheDistributor)(cache, pythonVersion, dependencyPathForCache);
|
||||||
yield cacheDistributor.restoreCache();
|
yield cacheDistributor.restoreCache();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
exports.cacheDependencies = cacheDependencies;
|
||||||
function resolveVersionInputFromDefaultFile() {
|
function resolveVersionInputFromDefaultFile() {
|
||||||
const couples = [
|
const couples = [
|
||||||
['.python-version', utils_1.getVersionsInputFromPlainFile]
|
['.python-version', utils_1.getVersionsInputFromPlainFile]
|
||||||
|
@ -412,7 +412,7 @@ steps:
|
|||||||
- run: pip install -e .
|
- run: pip install -e .
|
||||||
# Or pip install -e '.[test]' to install test dependencies
|
# Or pip install -e '.[test]' to install test dependencies
|
||||||
```
|
```
|
||||||
|
Note: cache-dependency-path supports files located outside the workspace root by copying them into the workspace to enable proper caching.
|
||||||
# Outputs and environment variables
|
# Outputs and environment variables
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
@ -71,8 +71,8 @@ export async function useCpythonVersion(
|
|||||||
// Use the freethreaded version if it was specified in the input, e.g., 3.13t
|
// Use the freethreaded version if it was specified in the input, e.g., 3.13t
|
||||||
freethreaded = true;
|
freethreaded = true;
|
||||||
}
|
}
|
||||||
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
|
||||||
|
|
||||||
|
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
||||||
if (freethreaded) {
|
if (freethreaded) {
|
||||||
// Free threaded versions use an architecture suffix like `x64-freethreaded`
|
// Free threaded versions use an architecture suffix like `x64-freethreaded`
|
||||||
core.debug(`Using freethreaded version of ${semanticVersionSpec}`);
|
core.debug(`Using freethreaded version of ${semanticVersionSpec}`);
|
||||||
@ -176,15 +176,36 @@ export async function useCpythonVersion(
|
|||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// Add --user directory
|
// Add --user directory
|
||||||
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
|
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
|
||||||
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
|
// Extract version details
|
||||||
const version = path.basename(path.dirname(installDir));
|
const version = path.basename(path.dirname(installDir));
|
||||||
const major = semver.major(version);
|
const major = semver.major(version);
|
||||||
const minor = semver.minor(version);
|
const minor = semver.minor(version);
|
||||||
|
|
||||||
|
const basePath = process.env['APPDATA'] || '';
|
||||||
|
let versionSuffix = `${major}${minor}`;
|
||||||
|
// Append '-32' for x86 architecture if Python version is >= 3.10
|
||||||
|
if (
|
||||||
|
architecture === 'x86' &&
|
||||||
|
(major > 3 || (major === 3 && minor >= 10))
|
||||||
|
) {
|
||||||
|
versionSuffix += '-32';
|
||||||
|
} else if (architecture === 'arm64') {
|
||||||
|
versionSuffix += '-arm64';
|
||||||
|
}
|
||||||
|
// Append 't' for freethreaded builds
|
||||||
|
if (freethreaded) {
|
||||||
|
versionSuffix += 't';
|
||||||
|
if (architecture === 'x86-freethreaded') {
|
||||||
|
versionSuffix += '-32';
|
||||||
|
} else if (architecture === 'arm64-freethreaded') {
|
||||||
|
versionSuffix += '-arm64';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add user Scripts path
|
||||||
const userScriptsDir = path.join(
|
const userScriptsDir = path.join(
|
||||||
process.env['APPDATA'] || '',
|
basePath,
|
||||||
'Python',
|
'Python',
|
||||||
`Python${major}${minor}`,
|
`Python${versionSuffix}`,
|
||||||
'Scripts'
|
'Scripts'
|
||||||
);
|
);
|
||||||
core.addPath(userScriptsDir);
|
core.addPath(userScriptsDir);
|
||||||
|
@ -22,13 +22,62 @@ function isGraalPyVersion(versionSpec: string) {
|
|||||||
return versionSpec.startsWith('graalpy');
|
return versionSpec.startsWith('graalpy');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cacheDependencies(cache: string, pythonVersion: string) {
|
export async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||||
const cacheDependencyPath =
|
const cacheDependencyPath =
|
||||||
core.getInput('cache-dependency-path') || undefined;
|
core.getInput('cache-dependency-path') || undefined;
|
||||||
|
let resolvedDependencyPath: string | undefined = undefined;
|
||||||
|
|
||||||
|
if (cacheDependencyPath) {
|
||||||
|
const actionPath = process.env.GITHUB_ACTION_PATH || '';
|
||||||
|
const workspace = process.env.GITHUB_WORKSPACE || process.cwd();
|
||||||
|
|
||||||
|
const sourcePath = path.resolve(actionPath, cacheDependencyPath);
|
||||||
|
const relativePath = path.relative(actionPath, sourcePath);
|
||||||
|
const targetPath = path.resolve(workspace, relativePath);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const sourceExists = await fs.promises
|
||||||
|
.access(sourcePath, fs.constants.F_OK)
|
||||||
|
.then(() => true)
|
||||||
|
.catch(() => false);
|
||||||
|
|
||||||
|
if (!sourceExists) {
|
||||||
|
core.warning(
|
||||||
|
`The resolved cache-dependency-path does not exist: ${sourcePath}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (sourcePath !== targetPath) {
|
||||||
|
const targetDir = path.dirname(targetPath);
|
||||||
|
// Create target directory if it doesn't exist
|
||||||
|
await fs.promises.mkdir(targetDir, {recursive: true});
|
||||||
|
// Copy file asynchronously
|
||||||
|
await fs.promises.copyFile(sourcePath, targetPath);
|
||||||
|
core.info(`Copied ${sourcePath} to ${targetPath}`);
|
||||||
|
} else {
|
||||||
|
core.info(
|
||||||
|
`Dependency file is already inside the workspace: ${sourcePath}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
resolvedDependencyPath = path
|
||||||
|
.relative(workspace, targetPath)
|
||||||
|
.replace(/\\/g, '/');
|
||||||
|
core.info(`Resolved cache-dependency-path: ${resolvedDependencyPath}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(
|
||||||
|
`Failed to copy file from ${sourcePath} to ${targetPath}: ${error}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass resolvedDependencyPath if available, else fallback to original input
|
||||||
|
const dependencyPathForCache = resolvedDependencyPath ?? cacheDependencyPath;
|
||||||
|
|
||||||
const cacheDistributor = getCacheDistributor(
|
const cacheDistributor = getCacheDistributor(
|
||||||
cache,
|
cache,
|
||||||
pythonVersion,
|
pythonVersion,
|
||||||
cacheDependencyPath
|
dependencyPathForCache
|
||||||
);
|
);
|
||||||
await cacheDistributor.restoreCache();
|
await cacheDistributor.restoreCache();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user