|
| 1 | +name: Run tests on postgres |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + test: |
| 6 | + services: |
| 7 | + postgres: |
| 8 | + image: postgres:12 |
| 9 | + env: |
| 10 | + POSTGRES_USER: user |
| 11 | + POSTGRES_PASSWORD: password |
| 12 | + POSTGRES_DB: postgres |
| 13 | + ports: |
| 14 | + - 5432:5432 |
| 15 | + options: >- |
| 16 | + --health-cmd pg_isready |
| 17 | + --health-interval 10s |
| 18 | + --health-timeout 5s |
| 19 | + --health-retries 5 |
| 20 | + runs-on: ubuntu-latest |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + python-version: |
| 25 | + - "3.7" |
| 26 | + - "3.8" |
| 27 | + - "3.9" |
| 28 | + - "3.10" |
| 29 | + django-version: |
| 30 | + - "3.2" |
| 31 | + - "4.0" |
| 32 | + - "4.1" |
| 33 | + drf-version: |
| 34 | + - "3.12" |
| 35 | + - "3.13" |
| 36 | + exclude: |
| 37 | + - python-version: "3.7" |
| 38 | + django-version: "4.0" |
| 39 | + - python-version: "3.7" |
| 40 | + django-version: "4.1" |
| 41 | + - drf-version: "3.12" |
| 42 | + django-version: "4.0" |
| 43 | + - drf-version: "3.12" |
| 44 | + django-version: "4.1" |
| 45 | + |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v3 |
| 48 | + |
| 49 | + - name: Set up Python ${{ matrix.python-version }} |
| 50 | + uses: actions/setup-python@v4 |
| 51 | + with: |
| 52 | + python-version: ${{ matrix.python-version }} |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + run: | |
| 56 | + python -m pip install --upgrade pip |
| 57 | + python -m pip install psycopg2-binary |
| 58 | +
|
| 59 | + - name: Install Django version |
| 60 | + run: | |
| 61 | + python -m pip install "Django==${{ matrix.django-version }}.*" |
| 62 | +
|
| 63 | + - name: Install DRF version |
| 64 | + run: | |
| 65 | + python -m pip install "djangorestframework==${{ matrix.drf-version }}.*" |
| 66 | +
|
| 67 | + - name: Python, Django and DRF versions |
| 68 | + run: | |
| 69 | + echo "Python ${{ matrix.python-version }} -> Django ${{ matrix.django-version }} -> DRF ${{ matrix.drf-version }}" |
| 70 | + python --version |
| 71 | + echo "Django: `django-admin --version`" |
| 72 | + echo "DRF: `pip show djangorestframework|grep Version|sed s/Version:\ //`" |
| 73 | +
|
| 74 | + - name: Setup environment |
| 75 | + run: | |
| 76 | + pip install -e . |
| 77 | + python setup.py install |
| 78 | +
|
| 79 | + - name: Run tests |
| 80 | + working-directory: ./tests |
| 81 | + run: python manage.py test --settings=settings_postgres |
0 commit comments