forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (53 loc) · 1.72 KB
/
test-migrations-compatibility.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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