Skip to content

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

Add poetry to workflow actions (#13603) (#13736)

Rafał Krupińskib60319c38a59
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index e6eeb3fb0d..5b088ec173 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -9,6 +9,8 @@ on:
- requirements_dev.txt
- "saleor/**"
- ".github/workflows/pytest.yml"
+ - pyproject.toml
+ - poetry.lock
push:
branches:
- main
@@ -18,6 +20,8 @@ on:
- Dockerfile
- requirements_dev.txt
- "saleor/**"
+ - pyproject.toml
+ - poetry.lock
env:
BENCH_PATH: ./queries-results.json
@@ -45,32 +49,36 @@ jobs:
- uses: actions/checkout@v4
- name: Install system dependencies
- run: apt-get install -y libpq-dev
+ run: |
+ apt-get install -y libpq-dev
- - uses: actions/cache@v3
+ - name: Install and configure poetry
+ run: |
+ python -m pip install poetry==1.5.0
+
+ - name: Cache the venv
+ id: cached-poetry-dependencies
+ uses: actions/cache@v3
with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements_dev.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-
+ path: ~/.venv
+ key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- # To remove once the issue is resolved.
- name: Install dependencies
run: |
- python -m pip install wheel
- python -m pip install -r requirements_dev.txt
+ python -m poetry install --no-root
+ if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# 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"
- pre-commit run --all
+ python -m poetry run pre-commit run --all
if: ${{ always() }}
- name: Run unit tests
run: |
- pytest \
+ python -m poetry run pytest \
-m "not e2e" \
--cov \
--junitxml=junit/test-results.xml \
@@ -110,5 +118,5 @@ jobs:
- name: Run E2E tests
run: |
- pytest \
+ python -m poetry run pytest \
-m "e2e"
diff --git a/.github/workflows/test-migrations-compatibility.yml b/.github/workflows/test-migrations-compatibility.yml
index 898d37d7ac..fa010ad348 100644
--- a/.github/workflows/test-migrations-compatibility.yml
+++ b/.github/workflows/test-migrations-compatibility.yml
@@ -30,30 +30,32 @@ jobs:
--health-retries 5
steps:
- - name: Checkout branch
- uses: actions/checkout@v4
+ - uses: actions/checkout@v4
- name: Install system dependencies
- run: apt-get install -y libpq-dev
+ run: |
+ apt-get install -y libpq-dev
+
+ - name: Install and configure poetry
+ run: |
+ python -m pip install poetry==1.5.0
- - name: Cache pip
+ - name: Cache the venv
+ id: cached-poetry-dependencies
uses: actions/cache@v3
with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements_dev.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-
+ path: ~/.venv
+ key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- # To remove once the issue is resolved.
- name: Install dependencies
run: |
- python -m pip install wheel
- python -m pip install -r requirements_dev.txt
+ python -m poetry install --no-root
+ if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Migrate
run: |
export DJANGO_SETTINGS_MODULE=saleor.tests.settings
- ./manage.py migrate
+ python -m poetry run python manage.py migrate
- name: Checkout base
uses: actions/checkout@v4
@@ -63,4 +65,4 @@ jobs:
- name: Run tests
run: |
export PYTEST_DB_URL=$DATABASE_URL
- pytest -n 0 --reuse-db
+ python -m poetry run pytest -n 0 --reuse-db
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6baf29737b..c90d0acd2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -54,6 +54,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix NoneType in `prodcutChannelsListingUpdate` - #13694 by @Manoj-gowra
- Extended `AttributeValueTranslation.name` to 250 characters - #13776 by @aniav
- Add a new `page` field on `AssignedPageAttributeValue`. First stage (migration) of a simplification of Attribute - Page relation from #13403. by michal-macioszczyk
+- Update workflow actions with poetry dependencies - #13736 by @rafiwts
# 3.15.0