Skip to content

Commit 32be8c0

Browse files
committed
[chores] Formatted code, updated CI configuration
Use PostgreSQL 15 for testing
1 parent 110abaa commit 32be8c0

15 files changed

+221
-116
lines changed

.coveragerc

-3
This file was deleted.

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ updates:
1111
interval: "monthly"
1212
commit-message:
1313
prefix: "[deps] "
14+
- package-ecosystem: "github-actions" # Check for GitHub Actions updates
15+
directory: "/"
16+
schedule:
17+
interval: "monthly" # Check for updates weekly
18+
commit-message:
19+
prefix: "[ci] "

.github/workflows/ci.yml

+30-27
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
services:
1818
postgres:
19-
image: postgis/postgis:10-2.5
19+
image: postgis/postgis:15-3.4-alpine
2020
env:
2121
POSTGRES_PASSWORD: postgres
2222
POSTGRES_USER: postgres
@@ -72,54 +72,57 @@ jobs:
7272
- python: 3.9
7373
TOXENV: py39-django40-djangorestframework313
7474
steps:
75-
- uses: actions/checkout@v2
75+
- uses: actions/checkout@v4
7676
with:
7777
ref: ${{ github.event.pull_request.head.sha }}
7878

7979
- name: Set up Python ${{ matrix.env.python }}
80-
uses: actions/setup-python@v2
80+
uses: actions/setup-python@v5
8181
with:
8282
python-version: ${{ matrix.env.python }}
83+
cache: 'pip'
84+
cache-dependency-path: |
85+
**/requirements*.txt
8386
84-
- name: Install system packages
85-
run: |
86-
sudo apt-get update
87-
sudo apt-get install binutils libproj-dev gdal-bin -y
88-
89-
- name: Install python dependencies
87+
- name: Install Dependencies
88+
id: deps
9089
run: |
90+
sudo apt -qq update
91+
sudo apt -qq -y install binutils libproj-dev gdal-bin
9192
pip install -U pip wheel setuptools
9293
pip install -U -r requirements-test.txt
9394
pip install tox docutils pygments twine
9495
96+
- name: QA checks
97+
run: |
98+
./run-qa-checks
99+
95100
- name: Tests
101+
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
96102
run: |
97103
tox -e ${{ matrix.env.TOXENV }}
104+
coverage combine
105+
coverage xml
98106
env:
99107
POSTGRES_HOST: localhost
100108

101109
- name: Upload Coverage
102-
run: coveralls --service=github
103-
env:
104-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105-
COVERALLS_FLAG_NAME: |
106-
python-${{ matrix.env.env }}
107-
COVERALLS_PARALLEL: true
110+
if: ${{ success() }}
111+
uses: coverallsapp/github-action@v2
112+
with:
113+
parallel: true
114+
format: cobertura
115+
flag-name: python-${{ matrix.env.env }}
116+
github-token: ${{ secrets.GITHUB_TOKEN }}
117+
118+
108119

109-
- name: QA checks
110-
run: |
111-
pip install "importlib-metadata<5.0" # remove when flake8 is upgraded
112-
./run-qa-checks
113120

114121
coveralls:
115-
name: Finish Coveralls
116122
needs: build
117123
runs-on: ubuntu-latest
118-
container: python:3-slim
119124
steps:
120-
- name: Finished
121-
run: |
122-
pip3 install --upgrade coveralls
123-
coveralls --finish
124-
env:
125-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
- name: Coveralls Finished
126+
uses: coverallsapp/github-action@v2
127+
with:
128+
parallel-finished: true

CHANGES.rst

+147-64
Large diffs are not rendered by default.

CONTRIBUTING.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Contributing
22
============
33

4-
Thanks for your interest! We love contributions, so please feel free to fix bugs, improve things, provide documentation. Just `follow the
5-
guidelines <https://github.com/openwisp/django-rest-framework-gis#contributing>`_ and submit a PR.
4+
Thanks for your interest! We love contributions, so please feel free to
5+
fix bugs, improve things, provide documentation. Just `follow the
6+
guidelines
7+
<https://github.com/openwisp/django-rest-framework-gis#contributing>`_ and
8+
submit a PR.

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ services:
2020
command: sh -c "pip install -e . && python ./tests/manage.py test tests/django_restframework_gis_tests && ./run-qa-checks"
2121

2222
postgres:
23-
image: mdillon/postgis:10-alpine
23+
image: postgis/postgis:15-3.4-alpine
2424
environment:
2525
POSTGRES_PASSWORD: postgres
2626
POSTGRES_USER: postgres
2727
POSTGRES_DB: django_restframework_gis
28-
ports:
28+
ports:
2929
- 5432:5432
3030
volumes:
3131
- postgres_data:/var/lib/postgresql/data

performance_tests.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
Average of 5 measurements for python2 and python3.
22

3-
Launch the performance test with::
3+
Launch the performance test with:
4+
5+
::
46

57
cd tests
68
./manage.py test --keepdb django_restframework_gis_tests.test_performance
79

8-
For more information regarding how the measurement is performed read the code in
9-
`test_performance.py <https://github.com/openwisp/django-rest-framework-gis/blob/master/tests/django_restframework_gis_tests/test_performance.py>`__.
10+
For more information regarding how the measurement is performed read the
11+
code in `test_performance.py
12+
<https://github.com/openwisp/django-rest-framework-gis/blob/master/tests/django_restframework_gis_tests/test_performance.py>`__.
1013

1114
0.9.2
1215
=====

pyproject.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[tool.coverage.run]
2+
source = ["rest_framework_gis"]
3+
parallel = true
4+
concurrency = ["multiprocessing"]
5+
omit = [
6+
"rest_framework_gis/__init__.py",
7+
"*/tests/*",
8+
"*/migrations/*",
9+
]
10+
11+
[tool.docstrfmt]
12+
extend_exclude = ["**/*.py", "README.rst"]
13+
14+
[tool.isort]
15+
known_third_party = ["django", "rest_framework"]
16+
default_section = "THIRDPARTY"
17+
line_length = 88
18+
multi_line_output = 3
19+
use_parentheses = true
20+
include_trailing_comma = true
21+
force_grid_wrap = 0
22+

requirements-test.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ psycopg2~=2.8.0
22
django-filter>=2.0
33
contexttimer
44
# QA checks
5-
openwisp-utils[qa]~=1.0.5
6-
packaging~=20.4
5+
openwisp-utils[qa] @ https://github.com/openwisp/openwisp-utils/tarball/master

rest_framework_gis/fields.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def to_internal_value(self, value):
6565
value = json.dumps(value)
6666
try:
6767
return GEOSGeometry(value)
68-
except (GEOSException):
68+
except GEOSException:
6969
raise ValidationError(
7070
_(
7171
'Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'

setup.cfg

-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,3 @@ max-line-length = 110
99
# W504: line break after or after operator
1010
# W605: invalid escape sequence
1111
ignore = W605, W503, W504
12-
13-
[isort]
14-
multi_line_output=3
15-
use_parentheses=True
16-
include_trailing_comma=True
17-
force_grid_wrap=0
18-
line_length=88

tests/django_restframework_gis_tests/migrations/0001_initial.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class Migration(migrations.Migration):
10-
1110
initial = True
1211

1312
dependencies = []

tests/django_restframework_gis_tests/migrations/0002_nullable.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
dependencies = [
109
('django_restframework_gis_tests', '0001_initial'),
1110
]

tests/django_restframework_gis_tests/migrations/0004_auto_20240228_2357.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
dependencies = [
109
('django_restframework_gis_tests', '0003_schema_models'),
1110
]

tox.ini

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ setenv =
1313
DRFG_TEST_RUNNER=./tests/manage.py test
1414
pytest: DRFG_TEST_RUNNER=-m pytest
1515
commands =
16-
coverage run --source=rest_framework_gis {env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests}
17-
travis: - coveralls
16+
coverage run {env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests}
1817

1918
deps =
2019
django22: Django~=2.2.0

0 commit comments

Comments
 (0)