Cache source packages in pip cache

This commit is contained in:
Dmitry Vedenko 2022-02-02 13:40:06 +03:00
parent cdc77d5b2f
commit ffb1245b24
No known key found for this signature in database
GPG Key ID: F4C37A6204F983A2
4 changed files with 27 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,9 @@ inputs:
cmake_options:
description: 'Additional options for the CMake'
required: false
additional_python_packages:
description: "Additional Python packages to cache"
required: false
runs:
using: 'node16'
main: '../dist/generate_offline_dependencies/index.js'

View File

@ -10,7 +10,8 @@ const generator = core.getInput('generator') || 'Unix Makefiles';
const buildType = core.getInput('build_type') || 'Release';
async function run() {
await offlineDependencies.prepareEnvironment();
await offlineDependencies.prepareEnvironment(core.getMultilineInput('additional_python_packages'));
const tempPath = path.join(workspaceDir, '.offline', 'temp');
try {

View File

@ -12,6 +12,15 @@ const conanVenvLocation = path.join(workspaceDir, '.venv');
const conanCacheLocation = path.join(offlineCacheLocation, 'conan');
const conanDownloadCacheLocation = path.join(conanCacheLocation, 'download_cache');
const packages = [
'conan',
'setuptools',
'wheel',
'Cython',
'setuptools_scm',
'flit_core'
]
async function getPip() {
try {
await helpers.execWithLog('pip3', ['--version']);
@ -32,10 +41,18 @@ async function getPython() {
}
}
async function prepareEnvironment() {
async function prepareEnvironment(additionalPyhtonPackages) {
let pip = await getPip();
let python = await getPython();
// Predowload packages
await helpers.execWithLog(pip, [
'download',
'--dest', pipDownloadCacheLocation,
'--no-binary=:all:',
...packages,
...(additionalPyhtonPackages || [])
]);
// Prepare venev
if (fs.existsSync(conanVenvLocation)) {
await fs.promises.rm(conanVenvLocation, { recursive: true, force: true });
@ -52,16 +69,10 @@ async function prepareEnvironment() {
await fs.promises.mkdir(pipDownloadCacheLocation, { recursive: true });
await helpers.execWithLog(pip, [
'download',
'--dest', pipDownloadCacheLocation,
'conan==1.43.2', 'setuptools', 'wheel', 'Cython'
]);
await helpers.execWithLog(pip, [
'install', '--no-index',
'--find-links', pipDownloadCacheLocation,
'setuptools', 'wheel'
'setuptools', 'wheel', 'Cython'
]);
await helpers.execWithLog(pip, [