mirror of
https://github.com/actions/setup-python.git
synced 2026-01-15 06:28:20 +00:00
Compare commits
2 Commits
c3739a195c
...
4e05d63840
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e05d63840 | ||
|
|
2666be1633 |
53
.github/workflows/e2e-cache-freethreaded.yml
vendored
53
.github/workflows/e2e-cache-freethreaded.yml
vendored
@@ -219,56 +219,3 @@ jobs:
|
|||||||
pip-version: '25.0.1'
|
pip-version: '25.0.1'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install numpy pandas requests
|
run: pip install numpy pandas requests
|
||||||
|
|
||||||
python-pip-dependencies-caching-with-pip-install:
|
|
||||||
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
[
|
|
||||||
ubuntu-latest,
|
|
||||||
ubuntu-22.04,
|
|
||||||
ubuntu-24.04-arm,
|
|
||||||
ubuntu-22.04-arm,
|
|
||||||
windows-latest,
|
|
||||||
macos-latest,
|
|
||||||
macos-13
|
|
||||||
]
|
|
||||||
python-version: [3.13.0t, 3.13.1t, 3.13.2t]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Setup Python
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
cache: 'pip'
|
|
||||||
pip-install: numpy pandas requests
|
|
||||||
|
|
||||||
python-pip-dependencies-caching-path-with-pip-install:
|
|
||||||
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}, caching path)
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
[
|
|
||||||
ubuntu-latest,
|
|
||||||
ubuntu-22.04,
|
|
||||||
ubuntu-24.04-arm,
|
|
||||||
ubuntu-22.04-arm,
|
|
||||||
windows-latest,
|
|
||||||
macos-latest,
|
|
||||||
macos-13
|
|
||||||
]
|
|
||||||
python-version: [3.13.0t, 3.13.1t, 3.13.2t]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Setup Python
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
cache: 'pip'
|
|
||||||
cache-dependency-path: __tests__/data/requirements.txt
|
|
||||||
pip-install: numpy pandas requests
|
|
||||||
|
|||||||
53
.github/workflows/e2e-cache.yml
vendored
53
.github/workflows/e2e-cache.yml
vendored
@@ -311,56 +311,3 @@ jobs:
|
|||||||
pip-version: '25.0.1'
|
pip-version: '25.0.1'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install numpy pandas requests
|
run: pip install numpy pandas requests
|
||||||
|
|
||||||
python-pip-dependencies-caching-with-pip-install:
|
|
||||||
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
[
|
|
||||||
ubuntu-latest,
|
|
||||||
ubuntu-24.04-arm,
|
|
||||||
ubuntu-22.04,
|
|
||||||
ubuntu-22.04-arm,
|
|
||||||
windows-latest,
|
|
||||||
macos-latest,
|
|
||||||
macos-13
|
|
||||||
]
|
|
||||||
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Setup Python
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
cache: 'pip'
|
|
||||||
pip-install: numpy pandas requests
|
|
||||||
|
|
||||||
python-pip-dependencies-caching-path-with-pip-install:
|
|
||||||
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}, caching path)
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
[
|
|
||||||
ubuntu-latest,
|
|
||||||
ubuntu-24.04-arm,
|
|
||||||
ubuntu-22.04,
|
|
||||||
ubuntu-22.04-arm,
|
|
||||||
windows-latest,
|
|
||||||
macos-latest,
|
|
||||||
macos-13
|
|
||||||
]
|
|
||||||
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Setup Python
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
cache: 'pip'
|
|
||||||
cache-dependency-path: __tests__/data/requirements.txt
|
|
||||||
pip-install: numpy pandas requests
|
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ See examples of using `cache` and `cache-dependency-path` for `pipenv` and `poet
|
|||||||
- [Using `setup-python` on GHES](docs/advanced-usage.md#using-setup-python-on-ghes)
|
- [Using `setup-python` on GHES](docs/advanced-usage.md#using-setup-python-on-ghes)
|
||||||
- [Allow pre-releases](docs/advanced-usage.md#allow-pre-releases)
|
- [Allow pre-releases](docs/advanced-usage.md#allow-pre-releases)
|
||||||
- [Using the pip-version input](docs/advanced-usage.md#using-the-pip-version-input)
|
- [Using the pip-version input](docs/advanced-usage.md#using-the-pip-version-input)
|
||||||
- [Using the pip-install input](docs/advanced-usage.md#using-the-pip-install-input)
|
|
||||||
|
|
||||||
## Recommended permissions
|
## Recommended permissions
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ inputs:
|
|||||||
default: false
|
default: false
|
||||||
pip-version:
|
pip-version:
|
||||||
description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]."
|
description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]."
|
||||||
pip-install:
|
|
||||||
description: "Used to specify the packages to install with pip after setting up Python. Can be a requirements file or package names."
|
|
||||||
outputs:
|
outputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "The installed Python or PyPy version. Useful when given a version range as input."
|
description: "The installed Python or PyPy version. Useful when given a version range as input."
|
||||||
|
|||||||
225
dist/cache-save/index.js
vendored
225
dist/cache-save/index.js
vendored
@@ -87714,22 +87714,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
if (mod && mod.__esModule) return mod;
|
var ownKeys = function(o) {
|
||||||
var result = {};
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
var ar = [];
|
||||||
__setModuleDefault(result, mod);
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
return result;
|
return ar;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
return ownKeys(o);
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
};
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return function (mod) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
if (mod && mod.__esModule) return mod;
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
var result = {};
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
__setModuleDefault(result, mod);
|
||||||
});
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.State = void 0;
|
exports.State = void 0;
|
||||||
const cache = __importStar(__nccwpck_require__(5116));
|
const cache = __importStar(__nccwpck_require__(5116));
|
||||||
@@ -87747,36 +87748,32 @@ class CacheDistributor {
|
|||||||
this.cacheDependencyPath = cacheDependencyPath;
|
this.cacheDependencyPath = cacheDependencyPath;
|
||||||
this.CACHE_KEY_PREFIX = 'setup-python';
|
this.CACHE_KEY_PREFIX = 'setup-python';
|
||||||
}
|
}
|
||||||
handleLoadedCache() {
|
async handleLoadedCache() { }
|
||||||
return __awaiter(this, void 0, void 0, function* () { });
|
async restoreCache() {
|
||||||
}
|
const { primaryKey, restoreKey } = await this.computeKeys();
|
||||||
restoreCache() {
|
if (primaryKey.endsWith('-')) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const file = this.packageManager === 'pip'
|
||||||
const { primaryKey, restoreKey } = yield this.computeKeys();
|
? `${this.cacheDependencyPath
|
||||||
if (primaryKey.endsWith('-')) {
|
.split('\n')
|
||||||
const file = this.packageManager === 'pip'
|
.join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
|
||||||
? `${this.cacheDependencyPath
|
: this.cacheDependencyPath.split('\n').join(',');
|
||||||
.split('\n')
|
throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
|
||||||
.join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
|
}
|
||||||
: this.cacheDependencyPath.split('\n').join(',');
|
const cachePath = await this.getCacheGlobalDirectories();
|
||||||
throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
|
core.saveState(State.CACHE_PATHS, cachePath);
|
||||||
}
|
let matchedKey;
|
||||||
const cachePath = yield this.getCacheGlobalDirectories();
|
try {
|
||||||
core.saveState(State.CACHE_PATHS, cachePath);
|
matchedKey = await cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||||
let matchedKey;
|
}
|
||||||
try {
|
catch (err) {
|
||||||
matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
const message = err.message;
|
||||||
}
|
core.info(`[warning]${message}`);
|
||||||
catch (err) {
|
core.setOutput('cache-hit', false);
|
||||||
const message = err.message;
|
return;
|
||||||
core.info(`[warning]${message}`);
|
}
|
||||||
core.setOutput('cache-hit', false);
|
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
return;
|
await this.handleLoadedCache();
|
||||||
}
|
this.handleMatchResult(matchedKey, primaryKey);
|
||||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
|
||||||
yield this.handleLoadedCache();
|
|
||||||
this.handleMatchResult(matchedKey, primaryKey);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleMatchResult(matchedKey, primaryKey) {
|
handleMatchResult(matchedKey, primaryKey) {
|
||||||
if (matchedKey) {
|
if (matchedKey) {
|
||||||
@@ -87827,27 +87824,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
if (mod && mod.__esModule) return mod;
|
var ownKeys = function(o) {
|
||||||
var result = {};
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
var ar = [];
|
||||||
__setModuleDefault(result, mod);
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
return result;
|
return ar;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
return ownKeys(o);
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
};
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return function (mod) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
if (mod && mod.__esModule) return mod;
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
var result = {};
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
__setModuleDefault(result, mod);
|
||||||
});
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
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.run = void 0;
|
exports.run = run;
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const cache = __importStar(__nccwpck_require__(5116));
|
const cache = __importStar(__nccwpck_require__(5116));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(9896));
|
const fs_1 = __importDefault(__nccwpck_require__(9896));
|
||||||
@@ -87855,62 +87853,57 @@ const cache_distributor_1 = __nccwpck_require__(2326);
|
|||||||
// Added early exit to resolve issue with slow post action step:
|
// Added early exit to resolve issue with slow post action step:
|
||||||
// - https://github.com/actions/setup-node/issues/878
|
// - https://github.com/actions/setup-node/issues/878
|
||||||
// https://github.com/actions/cache/pull/1217
|
// https://github.com/actions/cache/pull/1217
|
||||||
function run(earlyExit) {
|
async function run(earlyExit) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
try {
|
||||||
try {
|
const cache = core.getInput('cache');
|
||||||
const cache = core.getInput('cache');
|
if (cache) {
|
||||||
if (cache) {
|
await saveCache(cache);
|
||||||
yield saveCache(cache);
|
if (earlyExit) {
|
||||||
if (earlyExit) {
|
process.exit(0);
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
}
|
||||||
const err = error;
|
catch (error) {
|
||||||
core.setFailed(err.message);
|
const err = error;
|
||||||
}
|
core.setFailed(err.message);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
exports.run = run;
|
async function saveCache(packageManager) {
|
||||||
function saveCache(packageManager) {
|
const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (!cachePathState) {
|
||||||
const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
|
core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
|
||||||
if (!cachePathState) {
|
return;
|
||||||
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(', ')}`);
|
||||||
const cachePaths = JSON.parse(cachePathState);
|
if (!isCacheDirectoryExists(cachePaths)) {
|
||||||
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
|
core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
|
||||||
if (!isCacheDirectoryExists(cachePaths)) {
|
return;
|
||||||
core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
|
}
|
||||||
return;
|
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
|
||||||
}
|
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
|
||||||
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
|
if (!primaryKey) {
|
||||||
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
|
core.warning('Error retrieving key from state.');
|
||||||
if (!primaryKey) {
|
return;
|
||||||
core.warning('Error retrieving key from state.');
|
}
|
||||||
return;
|
else if (matchedKey === primaryKey) {
|
||||||
}
|
// no change in target directories
|
||||||
else if (matchedKey === primaryKey) {
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
// no change in target directories
|
return;
|
||||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
}
|
||||||
return;
|
let cacheId = 0;
|
||||||
}
|
try {
|
||||||
let cacheId = 0;
|
cacheId = await cache.saveCache(cachePaths, primaryKey);
|
||||||
try {
|
}
|
||||||
cacheId = yield cache.saveCache(cachePaths, primaryKey);
|
catch (err) {
|
||||||
}
|
const message = err.message;
|
||||||
catch (err) {
|
core.info(`[warning]${message}`);
|
||||||
const message = err.message;
|
return;
|
||||||
core.info(`[warning]${message}`);
|
}
|
||||||
return;
|
if (cacheId == -1) {
|
||||||
}
|
return;
|
||||||
if (cacheId == -1) {
|
}
|
||||||
return;
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
}
|
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function isCacheDirectoryExists(cacheDirectory) {
|
function isCacheDirectoryExists(cacheDirectory) {
|
||||||
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||||
|
|||||||
1967
dist/setup/index.js
vendored
1967
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,6 @@
|
|||||||
- [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes)
|
- [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes)
|
||||||
- [Allow pre-releases](advanced-usage.md#allow-pre-releases)
|
- [Allow pre-releases](advanced-usage.md#allow-pre-releases)
|
||||||
- [Using the pip-version input](advanced-usage.md#using-the-pip-version-input)
|
- [Using the pip-version input](advanced-usage.md#using-the-pip-version-input)
|
||||||
- [Using the pip-install input](advanced-usage.md#using-the-pip-install-input)
|
|
||||||
|
|
||||||
## Using the `python-version` input
|
## Using the `python-version` input
|
||||||
|
|
||||||
@@ -673,20 +672,3 @@ The version of Pip should be specified in the format `major`, `major.minor`, or
|
|||||||
> The `pip-version` input is supported only with standard Python versions. It is not available when using PyPy or GraalPy.
|
> The `pip-version` input is supported only with standard Python versions. It is not available when using PyPy or GraalPy.
|
||||||
|
|
||||||
> Using a specific or outdated version of pip may result in compatibility or security issues and can cause job failures. For best practices and guidance, refer to the official [pip documentation](https://pip.pypa.io/en/stable/).
|
> Using a specific or outdated version of pip may result in compatibility or security issues and can cause job failures. For best practices and guidance, refer to the official [pip documentation](https://pip.pypa.io/en/stable/).
|
||||||
|
|
||||||
## Using the pip-install input
|
|
||||||
|
|
||||||
The `pip-install` input allows you to install dependencies as part of the Python setup step.
|
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: '3.13'
|
|
||||||
pip-install: -r requirements.txt
|
|
||||||
```
|
|
||||||
> Note: This feature is intended for standard pip-based dependency installations.
|
|
||||||
For complex workflows, or alternative package managers (e.g., poetry, pipenv), we recommend using separate steps to maintain clarity and flexibility.
|
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -34,7 +34,7 @@
|
|||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^29.7.0",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"ts-jest": "^29.3.2",
|
"ts-jest": "^29.3.2",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=24.0.0"
|
"node": ">=24.0.0"
|
||||||
@@ -5446,9 +5446,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.9.3",
|
"version": "5.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
|
||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -53,6 +53,6 @@
|
|||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^29.7.0",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"ts-jest": "^29.3.2",
|
"ts-jest": "^29.3.2",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
getVersionInputFromFile,
|
getVersionInputFromFile,
|
||||||
getVersionsInputFromPlainFile
|
getVersionsInputFromPlainFile
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import {exec} from '@actions/exec';
|
|
||||||
|
|
||||||
function isPyPyVersion(versionSpec: string) {
|
function isPyPyVersion(versionSpec: string) {
|
||||||
return versionSpec.startsWith('pypy');
|
return versionSpec.startsWith('pypy');
|
||||||
@@ -23,19 +22,6 @@ function isGraalPyVersion(versionSpec: string) {
|
|||||||
return versionSpec.startsWith('graalpy');
|
return versionSpec.startsWith('graalpy');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function installPipPackages(pipInstall: string) {
|
|
||||||
core.info(`Installing pip packages: ${pipInstall}`);
|
|
||||||
try {
|
|
||||||
const installArgs = pipInstall.trim().split(/\s+/);
|
|
||||||
await exec('python', ['-m', 'pip', 'install', ...installArgs]);
|
|
||||||
core.info('Successfully installed pip packages');
|
|
||||||
} catch (error) {
|
|
||||||
core.setFailed(
|
|
||||||
`Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct and installable, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function cacheDependencies(cache: string, pythonVersion: string) {
|
async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||||
const cacheDependencyPath =
|
const cacheDependencyPath =
|
||||||
core.getInput('cache-dependency-path') || undefined;
|
core.getInput('cache-dependency-path') || undefined;
|
||||||
@@ -159,10 +145,6 @@ async function run() {
|
|||||||
if (cache && isCacheFeatureAvailable()) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
await cacheDependencies(cache, pythonVersion);
|
await cacheDependencies(cache, pythonVersion);
|
||||||
}
|
}
|
||||||
const pipInstall = core.getInput('pip-install');
|
|
||||||
if (pipInstall) {
|
|
||||||
await installPipPackages(pipInstall);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
core.warning(
|
core.warning(
|
||||||
'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'
|
'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Basic Options */
|
/* Basic Options */
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "es2018", /* 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'. */
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
// "checkJs": true, /* Report errors in .js files. */
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
|||||||
Reference in New Issue
Block a user