Skip to content

Commit 3eae919

Browse files
committed
move to github actions
1 parent 1598f59 commit 3eae919

5 files changed

Lines changed: 85 additions & 86 deletions

File tree

.github/workflows/test.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: ${{ matrix.variant}} py=${{ matrix.python-version }} dj=${{ matrix.django-version }} drf=${{ matrix.drf-version }}
8+
runs-on: ubuntu-20.04
9+
env:
10+
TEST_VARIANT: ${{ matrix.variant }}
11+
strategy:
12+
matrix:
13+
variant: [default, spatialite, postgis]
14+
python-version: [3.9]
15+
django-version: [2.2.17, 3.1.5]
16+
drf-version: [3.12.2]
17+
include:
18+
- python-version: 3.9
19+
django-version: 3.1.5
20+
drf-version: 3.11.2
21+
variant: default
22+
- python-version: 3.9
23+
django-version: 3.1.5
24+
drf-version: 3.12.2
25+
variant: nonroot
26+
- python-version: 3.8
27+
django-version: 3.1.5
28+
drf-version: 3.12.2
29+
variant: default
30+
- python-version: 3.7
31+
django-version: 3.1.5
32+
drf-version: 3.12.2
33+
variant: default
34+
- python-version: 3.6
35+
django-version: 3.1.5
36+
drf-version: 3.12.2
37+
variant: default
38+
steps:
39+
- uses: actions/checkout@v2
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v2
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
python -m pip install flake8 pytest wheel
48+
python -m pip install django==${{ matrix.django-version }}
49+
python -m pip install djangorestframework==${{ matrix.drf-version }}
50+
python -m pip install .
51+
- name: Lint with flake8
52+
run: |
53+
# stop the build if there are Python syntax errors or undefined names
54+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
55+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
56+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
57+
- name: Set up SpatiaLite
58+
if: ${{ matrix.variant == 'spatialite' }}
59+
run: sudo apt install libsqlite3-mod-spatialite gdal-bin
60+
- name: Set up PostgreSQL
61+
if: ${{ matrix.variant == 'postgis' }}
62+
run: |
63+
sudo apt install postgresql-13-postgis-3
64+
# postgresql is already installed on image
65+
sudo systemctl start postgresql.service
66+
sudo -u postgres createuser --superuser $USER
67+
createdb wqdb_test
68+
psql wqdb_test -c "CREATE EXTENSION postgis;"
69+
python -m pip install psycopg2-binary
70+
- name: Test with unittest
71+
run: python setup.py test

.travis.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

runtests.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def find_wq_packages(submodule):
8383
long_description_content_type="text/markdown",
8484
install_requires=[
8585
'Django>=1.11,<4.0',
86-
'djangorestframework>=3.8.0,<3.12',
86+
'djangorestframework>=3.8.0,<3.13',
8787
'django-mustache',
8888
'html-json-forms',
8989
'natural-keys>=1.6.0',

tests/settings.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,24 @@
2424
'tests.naturalkey_app',
2525
)
2626

27-
WITH_GIS = os.environ.get("WITH_GIS")
27+
VARIANT = os.environ.get("TEST_VARIANT")
28+
29+
if VARIANT in ("postgis", "spatialite"):
30+
WITH_GIS = True
31+
else:
32+
WITH_GIS = False
33+
34+
if VARIANT == "nonroot":
35+
WITH_NONROOT = True
36+
else:
37+
WITH_NONROOT = False
2838

2939
if WITH_GIS:
3040
INSTALLED_APPS += ('tests.gis_app',)
3141

3242

33-
WITH_NONROOT = os.environ.get("WITH_NONROOT")
34-
3543

36-
if os.environ.get('PSYCOPG2'):
44+
if VARIANT in ("postgis", "postgres"):
3745
if WITH_GIS:
3846
engine = 'django.contrib.gis.db.backends.postgis'
3947
else:
@@ -42,7 +50,7 @@
4250
'default': {
4351
'ENGINE': engine,
4452
'NAME': 'wqdb_test',
45-
'USER': 'postgres',
53+
'USER': os.environ.get('USER'),
4654
}
4755
}
4856
else:

0 commit comments

Comments
 (0)