diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index ce3366a1..c94b2f49 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -66,15 +66,15 @@ jobs: - uses: actions/checkout@v3 - name: Install poetry run: pipx install poetry + - name: Init pyproject.toml + run: mv ./__tests__/data/pyproject.toml . - name: Setup Python uses: ./ with: python-version: ${{ matrix.python-version }} cache: 'poetry' - - name: Init pyproject.toml - run: poetry init -n - name: Install dependencies - run: poetry add flake8 + run: poetry install python-pip-dependencies-caching-path: name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) diff --git a/__tests__/data/pyproject.toml b/__tests__/data/pyproject.toml new file mode 100644 index 00000000..ff4d8bd0 --- /dev/null +++ b/__tests__/data/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "testactiontasks" +version = "0.1.0" +description = "" +authors = ["Your Name "] + +[tool.poetry.dependencies] +python = "^3.8" +flake8 = "^4.0.1" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/dist/setup/index.js b/dist/setup/index.js index 3c417588..7f067dcd 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63876,8 +63876,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); const glob = __importStar(__nccwpck_require__(8090)); +const io = __importStar(__nccwpck_require__(7436)); const path = __importStar(__nccwpck_require__(1017)); const exec = __importStar(__nccwpck_require__(1514)); +const core = __importStar(__nccwpck_require__(2186)); const cache_distributor_1 = __importDefault(__nccwpck_require__(8953)); class PoetryCache extends cache_distributor_1.default { constructor(pythonVersion, patterns = '**/poetry.lock') { @@ -63894,6 +63896,17 @@ class PoetryCache extends cache_distributor_1.default { if (poetryConfig['virtualenvs.in-project'] === true) { paths.push(path.join(process.cwd(), '.venv')); } + const pythonLocation = yield io.which('python'); + if (pythonLocation) { + core.debug(`pythonLocation is ${pythonLocation}`); + const { exitCode, stderr } = yield exec.getExecOutput(`poetry env use ${pythonLocation}`, undefined, { ignoreReturnCode: true }); + if (exitCode) { + core.info(`[warning]${stderr}`); + } + } + else { + core.info('[warning]python binaries were not found in PATH.'); + } return paths; }); } diff --git a/src/cache-distributions/poetry-cache.ts b/src/cache-distributions/poetry-cache.ts index 464a58be..3c22011f 100644 --- a/src/cache-distributions/poetry-cache.ts +++ b/src/cache-distributions/poetry-cache.ts @@ -33,15 +33,20 @@ class PoetryCache extends CacheDistributor { if (pythonLocation) { core.debug(`pythonLocation is ${pythonLocation}`); - const {exitCode, stderr} = await exec.getExecOutput( - `poetry env use ${pythonLocation}` + const { + exitCode, + stderr + } = await exec.getExecOutput( + `poetry env use ${pythonLocation}`, + undefined, + {ignoreReturnCode: true} ); if (exitCode) { - throw new Error(stderr); + core.info(`[warning]${stderr}`); } } else { - core.warning('python binaries were not found in PATH.'); + core.info('[warning]python binaries were not found in PATH.'); } return paths;