Skip to content

ProductsQueryset manager execute duplicated channel queries #18748

ProductsQueryset manager execute duplicated channel queries

ProductsQueryset manager execute duplicated channel queries #18748

Workflow file for this run

name: Pytest
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**.py"
- Dockerfile
- "saleor/**"
- ".github/workflows/pytest.yml"
- pyproject.toml
- poetry.lock
push:
branches:
- main
- ci/*
paths:
- "**.py"
- Dockerfile
- "saleor/**"
- ".github/workflows/pytest.yml"
- pyproject.toml
- poetry.lock
env:
BENCH_PATH: ./queries-results.json
DATABASE_URL: "postgres://saleor:saleor@postgres:5432/saleor"
SECRET_KEY: ci-test
jobs:
build:
runs-on: ubuntu-latest
container: python:3.9
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: saleor
POSTGRES_USER: saleor
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get install -y libpq-dev
- name: Install and configure poetry
run: |
pip install poetry==1.7.0
- name: Cache the venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
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"
pre-commit run --all
if: ${{ always() }}
- name: Run unit tests
run: |
pytest \
-m "not e2e" \
--cov \
--cov-report= \
--junitxml=junit/test-results.xml \
--django-db-bench=${{ env.BENCH_PATH }}
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
# Publish coverage and test results
- uses: codecov/codecov-action@v3
- uses: actions/upload-artifact@v3
with:
name: pytest-results
path: junit/test-results.xml
if: ${{ always() }}
# Publish detected differences as comment
- uses: NyanKiyoshi/pytest-django-queries-ci-tools@v1
with:
query_raw_dump_path: ${{ env.BENCH_PATH }}
diff_endpoint: "https://dtab784j47g1o.cloudfront.net/default/saleor-db-queries-bot-diff"
diff_results_base_url: "https://dtab784j47g1o.cloudfront.net"
if: github.event_name == 'pull_request' && github.repository == 'saleor/saleor'
# Save results for future comparison against pull requests
- uses: NyanKiyoshi/pytest-django-queries-ci-tools@v1
with:
query_raw_dump_path: ${{ env.BENCH_PATH }}
upload_endpoint: ${{ secrets.QUERIES_UPLOAD_ENDPOINT_URL }}
upload_secret_key: ${{ secrets.QUERIES_UPLOAD_SECRET }}
if: github.event_name == 'push' && github.repository == 'saleor/saleor'