Skip to content

Test action

Test action #2

name: Test migrations compatibility
on:
pull_request:
branches: ["**"]
env:
DATABASE_URL: "postgres://saleor:saleor@postgres:5432/saleor"
SECRET_KEY: ci-test
jobs:
build:
if: ${{ ((github.event.action == 'labeled') && (github.event.label.name == 'test')) || ((github.event.action != 'labeled') && contains(github.event.pull_request.labels.*.name, 'test')) }}
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: |
python -m pip install poetry==1.7.0
- name: Cache the venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ~/.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
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
python -m poetry run python manage.py migrate
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github['head_ref'] }}-zero-downtime
- name: Run tests
run: |
export PYTEST_DB_URL=$DATABASE_URL
python -m poetry run pytest -n 0 --reuse-db