add fixes

This commit is contained in:
Dmitry Shibanov 2022-06-27 14:00:48 +02:00
parent b313c4cb46
commit cb8feb63f7
4 changed files with 40 additions and 7 deletions

View file

@ -66,15 +66,15 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install poetry - name: Install poetry
run: pipx install poetry run: pipx install poetry
- name: Init pyproject.toml
run: mv ./__tests__/data/pyproject.toml .
- name: Setup Python - name: Setup Python
uses: ./ uses: ./
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: 'poetry' cache: 'poetry'
- name: Init pyproject.toml
run: poetry init -n
- name: Install dependencies - name: Install dependencies
run: poetry add flake8 run: poetry install
python-pip-dependencies-caching-path: python-pip-dependencies-caching-path:
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})

View file

@ -0,0 +1,15 @@
[tool.poetry]
name = "testactiontasks"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
[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"

13
dist/setup/index.js vendored
View file

@ -63876,8 +63876,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const glob = __importStar(__nccwpck_require__(8090)); const glob = __importStar(__nccwpck_require__(8090));
const io = __importStar(__nccwpck_require__(7436));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const core = __importStar(__nccwpck_require__(2186));
const cache_distributor_1 = __importDefault(__nccwpck_require__(8953)); const cache_distributor_1 = __importDefault(__nccwpck_require__(8953));
class PoetryCache extends cache_distributor_1.default { class PoetryCache extends cache_distributor_1.default {
constructor(pythonVersion, patterns = '**/poetry.lock') { constructor(pythonVersion, patterns = '**/poetry.lock') {
@ -63894,6 +63896,17 @@ class PoetryCache extends cache_distributor_1.default {
if (poetryConfig['virtualenvs.in-project'] === true) { if (poetryConfig['virtualenvs.in-project'] === true) {
paths.push(path.join(process.cwd(), '.venv')); 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; return paths;
}); });
} }

View file

@ -33,15 +33,20 @@ class PoetryCache extends CacheDistributor {
if (pythonLocation) { if (pythonLocation) {
core.debug(`pythonLocation is ${pythonLocation}`); core.debug(`pythonLocation is ${pythonLocation}`);
const {exitCode, stderr} = await exec.getExecOutput( const {
`poetry env use ${pythonLocation}` exitCode,
stderr
} = await exec.getExecOutput(
`poetry env use ${pythonLocation}`,
undefined,
{ignoreReturnCode: true}
); );
if (exitCode) { if (exitCode) {
throw new Error(stderr); core.info(`[warning]${stderr}`);
} }
} else { } else {
core.warning('python binaries were not found in PATH.'); core.info('[warning]python binaries were not found in PATH.');
} }
return paths; return paths;