Skip to content

Saleor Core: the high performance, composable, headless commerce API.

CI: add Poetry Venv to PATH (#14554)

Mikail0cb26375de16
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index 5b088ec173..015b7e4a2b 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -20,6 +20,7 @@ on:
- Dockerfile
- requirements_dev.txt
- "saleor/**"
+ - ".github/workflows/pytest.yml"
- pyproject.toml
- poetry.lock
@@ -54,7 +55,7 @@ jobs:
- name: Install and configure poetry
run: |
- python -m pip install poetry==1.5.0
+ pip install poetry==1.5.0
- name: Cache the venv
id: cached-poetry-dependencies
@@ -65,20 +66,28 @@ jobs:
- name: Install dependencies
run: |
- python -m poetry install --no-root
+ poetry env use python3.9
+ poetry install --no-root
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
+ - name: Add Python Virtual Environment to PATH
+ run: |
+ # Note: requires `poetry env use` to be ran, otherwise poetry
+ # may not be able to find which virtual environment is in use.
+ # Ticket: https://github.com/python-poetry/poetry/issues/7190
+ echo "$(poetry env info -p)"/bin >> $GITHUB_PATH
+
# Run linters and Django related checks
# `git config` command is a workaround for https://github.com/actions/runner-images/issues/6775
- name: Run Linters and Checks
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- python -m poetry run pre-commit run --all
+ pre-commit run --all
if: ${{ always() }}
- name: Run unit tests
run: |
- python -m poetry run pytest \
+ pytest \
-m "not e2e" \
--cov \
--junitxml=junit/test-results.xml \
@@ -118,5 +127,4 @@ jobs:
- name: Run E2E tests
run: |
- python -m poetry run pytest \
- -m "e2e"
+ pytest -m "e2e"