-
-
Notifications
You must be signed in to change notification settings - Fork 13
78 lines (71 loc) · 2.57 KB
/
python-test.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
66
67
68
69
70
71
72
73
74
75
76
77
78
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit tests
on:
push:
branches: [ master ]
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.11']
django-version: ['3.2.*', '4.2.*']
psycopg: ['psycopg2-binary']
postgis-image: ['postgis/postgis:10-2.5', 'postgis/postgis:11-2.5', 'postgis/postgis:latest']
exclude:
- postgis-image: 'postgis/postgis:11-2.5'
django-version: '3.2.*' # test only with 10-2.5 and latest
- python-version: '3.7'
django-version: '4.2.*' # Django 4.2 supports only python >= 3.8
- postgis-image: 'postgis/postgis:10-2.5'
django-version: '4.2.*' # Django 4.2 supports only postgres >= 12
- postgis-image: 'postgis/postgis:11-2.5'
django-version: '4.2.*' # Django 4.2 supports only postgres >= 12
include:
- postgis-image: 'postgis/postgis:latest'
django-version: '4.2.*'
python-version: '3.11'
psycopg: ['psycopg-binary']
services:
postgres:
image: ${{ matrix.postgis-image }}
env:
POSTGRES_PASSWORD: travis_ci_test
POSTGRES_USER: travis_ci_test
POSTGRES_DB: travis_ci_test
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get -yq install libproj-dev binutils gdal-bin
python3 -m pip install --upgrade pip setuptools wheel
pip install .[dev] -U
if [[ ${{ matrix.django-version }} == dev ]]; then
pip install -e git+https://github.com/django/django@master#egg=django;
else
pip install Django==${{ matrix.django-version }} -U;
fi
if [[ ${{ matrix.psycopg }} == psycopg-binary ]]; then
pip uninstall psycopg2-binary;
else
pip install psycopg2-binary -U;
fi
- name: Run migrations
run: |
python3 ./manage.py makemigrations --check
python3 ./manage.py migrate
- name: Test with coverage
run: |
coverage run ./manage.py test
- name: Coverage upload
run: |
pip install codecov
codecov