Skip to content

Commit

Permalink
[chores] Formatted code, updated CI configuration
Browse files Browse the repository at this point in the history
Use PostgreSQL 15 for testing
  • Loading branch information
pandafy committed Aug 12, 2024
1 parent 110abaa commit d39f889
Show file tree
Hide file tree
Showing 15 changed files with 213 additions and 113 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ updates:
interval: "monthly"
commit-message:
prefix: "[deps] "
- package-ecosystem: "github-actions" # Check for GitHub Actions updates
directory: "/"
schedule:
interval: "monthly" # Check for updates weekly
commit-message:
prefix: "[ci] "
46 changes: 22 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

services:
postgres:
image: postgis/postgis:10-2.5
image: postgis/postgis:15-3.4-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
Expand Down Expand Up @@ -72,54 +72,52 @@ jobs:
- python: 3.9
TOXENV: py39-django40-djangorestframework313
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python ${{ matrix.env.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.env.python }}
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin -y
- name: Install python dependencies
- name: Install Dependencies
run: |
sudo apt -qq update
sudo apt -qq -y install binutils libproj-dev gdal-bin
pip install -U pip wheel setuptools
pip install -U -r requirements-test.txt
pip install tox docutils pygments twine
- name: Tests
run: |
tox -e ${{ matrix.env.TOXENV }}
coverage combine
coverage xml
env:
POSTGRES_HOST: localhost

- name: Upload Coverage
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: |
python-${{ matrix.env.env }}
COVERALLS_PARALLEL: true
uses: coverallsapp/github-action@v2
with:
parallel: true
format: cobertura
flag-name: python-${{ matrix.env.env }}
github-token: ${{ secrets.GITHUB_TOKEN }}


- name: QA checks
run: |
pip install "importlib-metadata<5.0" # remove when flake8 is upgraded
./run-qa-checks
coveralls:
name: Finish Coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
211 changes: 147 additions & 64 deletions CHANGES.rst

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Contributing
============

Thanks for your interest! We love contributions, so please feel free to fix bugs, improve things, provide documentation. Just `follow the
guidelines <https://github.com/openwisp/django-rest-framework-gis#contributing>`_ and submit a PR.
Thanks for your interest! We love contributions, so please feel free to
fix bugs, improve things, provide documentation. Just `follow the
guidelines
<https://github.com/openwisp/django-rest-framework-gis#contributing>`_ and
submit a PR.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ services:
command: sh -c "pip install -e . && python ./tests/manage.py test tests/django_restframework_gis_tests && ./run-qa-checks"

postgres:
image: mdillon/postgis:10-alpine
image: postgis/postgis:15-3.4-alpine
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: django_restframework_gis
ports:
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
Expand Down
9 changes: 6 additions & 3 deletions performance_tests.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Average of 5 measurements for python2 and python3.

Launch the performance test with::
Launch the performance test with:

::

cd tests
./manage.py test --keepdb django_restframework_gis_tests.test_performance

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

0.9.2
=====
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.coverage.run]
source = ["rest_framework_gis"]
parallel = true
concurrency = ["multiprocessing"]
omit = [
"rest_framework_gis/__init__.py",
"*/tests/*",
"*/migrations/*",
]

[tool.docstrfmt]
extend_exclude = ["**/*.py", "README.rst"]

[tool.isort]
known_third_party = ["django", "rest_framework"]
default_section = "THIRDPARTY"
line_length = 88
multi_line_output = 3
use_parentheses = true
include_trailing_comma = true
force_grid_wrap = 0

3 changes: 1 addition & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ psycopg2~=2.8.0
django-filter>=2.0
contexttimer
# QA checks
openwisp-utils[qa]~=1.0.5
packaging~=20.4
openwisp-utils[qa] @ https://github.com/openwisp/openwisp-utils/tarball/master
2 changes: 1 addition & 1 deletion rest_framework_gis/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def to_internal_value(self, value):
value = json.dumps(value)
try:
return GEOSGeometry(value)
except (GEOSException):
except GEOSException:
raise ValidationError(
_(
'Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'
Expand Down
7 changes: 0 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@ max-line-length = 110
# W504: line break after or after operator
# W605: invalid escape sequence
ignore = W605, W503, W504

[isort]
multi_line_output=3
use_parentheses=True
include_trailing_comma=True
force_grid_wrap=0
line_length=88
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('django_restframework_gis_tests', '0001_initial'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('django_restframework_gis_tests', '0003_schema_models'),
]
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ setenv =
DRFG_TEST_RUNNER=./tests/manage.py test
pytest: DRFG_TEST_RUNNER=-m pytest
commands =
coverage run --source=rest_framework_gis {env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests}
travis: - coveralls
coverage run {env:DRFG_TEST_RUNNER} {posargs:tests/django_restframework_gis_tests}

deps =
django22: Django~=2.2.0
Expand Down

0 comments on commit d39f889

Please sign in to comment.