Skip to content

Commit

Permalink
Fix workflow after Ubuntu and Python upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
terhisalonen committed Jan 18, 2024
1 parent 2c60cf7 commit e66faa2
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 39 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:
tests:
strategy:
matrix:
python: ["3.5", "3.6", "3.8"]
runs-on: ubuntu-20.04
container: "python:${{matrix.python}}-slim-buster"
python: ["3.10"] #3.10
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004
# container: "python:${{matrix.python}}-slim-buster"
steps:
- uses: actions/checkout@v3

- name: Update apt-get sources
run: apt-get update
run: sudo apt-get update

- name: Install PostgreSQL, PostGIS and GDAL
run: >
apt-get install -y
sudo apt-get install -y
gdal-bin
python3-gdal
postgis
Expand All @@ -32,14 +32,14 @@ jobs:
build-essential
- name: Start PostgreSQL server
run: /etc/init.d/postgresql start
run: sudo /etc/init.d/postgresql start

- name: Allow root to create PostgreSQL databases
run: su - postgres -c "createuser --createdb root"
- name: Allow runner to create PostgreSQL databases
run: sudo su - postgres -c "createuser --createdb runner"

- name: Create PostGIS extension
run: >
su - postgres
sudo su - postgres
-c "psql template1 -c 'create extension postgis'"
- name: Install Tox and tox-gh-actions
Expand All @@ -52,7 +52,7 @@ jobs:
uses: codecov/codecov-action@v3

test-dockerization:
runs-on: ubuntu-22.04
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004
steps:
- uses: actions/checkout@v3

Expand All @@ -72,14 +72,14 @@ jobs:
strategy:
matrix:
toxenv: [style, requirements, sanitizer]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.5"
python-version: "3.10" #3.10

- name: Install GDAL
run: sudo apt-get install -y gdal-bin
Expand Down
3 changes: 1 addition & 2 deletions parkings/api/auth/drf_jwt_2fa_urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from django.urls import re_path

from drf_jwt_2fa import views

urlpatterns = [
re_path('^get-code/', views.obtain_code_token, name='get-code'),
re_path('^auth/', views.obtain_auth_token, name='auth'),
re_path('^refresh/', views.refresh_auth_token, name='refresh'),
re_path('^verify/', views.verify_auth_token, name='verify'),
]
]
1 change: 0 additions & 1 deletion parkings/api/enforcement/valid_permit_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def to_representation(self, instance):
return representation



class ValidPermitItemFilter(django_filters.rest_framework.FilterSet):
reg_num = django_filters.CharFilter(
label=_("Registration number"), method='filter_reg_num')
Expand Down
1 change: 1 addition & 0 deletions parkings/api/url_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.urls import include, re_path


def versioned_url(version, include_urls, regexp=r'^'):
return re_path(
'{regexp}{version}/'.format(regexp=regexp, version=version),
Expand Down
2 changes: 1 addition & 1 deletion parkings/models/parking_check.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf import settings
from django.contrib.gis.db import models as gis_models
from django.db.models import JSONField
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.db.models import JSONField
from django.utils.translation import gettext_lazy as _

from .constants import WGS84_SRID
Expand Down
2 changes: 1 addition & 1 deletion parkings/models/permit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from django.conf import settings
from django.contrib.gis.db import models as gis_models
from django.contrib.postgres.fields import JSONField
from django.core.serializers.json import DjangoJSONEncoder
from django.db import connections, models, router, transaction
from django.db.models import JSONField
from django.db.models.expressions import RawSQL
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
Expand Down
2 changes: 1 addition & 1 deletion parkings/tests/api/monitoring/test_valid_parking.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_list_endpoint_data(monitoring_api_client, parking):

def check_parking_feature_shape(parking_feature):
assert set(parking_feature.keys()) == {
'id', 'type','time_start', 'time_end', 'geometry', 'properties'}
'id', 'type', 'time_start', 'time_end', 'geometry', 'properties'}
assert parking_feature['type'] == 'Feature'
assert set(parking_feature['geometry'].keys()) == {
'type', 'coordinates'}
Expand Down
7 changes: 3 additions & 4 deletions parkkihubi/settings.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import os
from datetime import timedelta

import django
from django.utils.encoding import smart_str
from django.utils.translation import gettext, gettext_lazy
from environ import Env
from raven import fetch_git_sha
from raven.exceptions import InvalidGitRepository

# Prevent warning regarding
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

import django
from django.utils.translation import gettext_lazy
django.utils.translation.ugettext_lazy = gettext_lazy
from django.utils.translation import gettext
django.utils.translation.ugettext = gettext
from django.utils.encoding import smart_str
django.utils.encoding.smart_text = smart_str


Expand Down
2 changes: 1 addition & 1 deletion parkkihubi/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings
from django.urls import include, re_path
from django.contrib import admin
from django.urls import include, re_path

from parkings.api.auth import urls as auth_urls
from parkings.api.enforcement import urls as enforcement_urls
Expand Down
4 changes: 2 additions & 2 deletions post-update
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fi

# Update the backend
pip install -r requirements-pip.txt
pip install -r requirements-prequ.txt
prequ sync requirements.txt
# pip install -r requirements-prequ.txt
# prequ sync requirements.txt

./manage.py collectstatic --noinput

Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ python-dateutil==2.8.2
# freezegun
pyyaml==6.0.1
# via -r requirements-test.in
requests==2.24.0
requests==2.25.1
# via
# -c requirements-cov.txt
# requests-mock
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pyproj==3.3.0
# via
# -r requirements.in
# owslib
python-dateutil==2.8.1
python-dateutil==2.8.2
# via owslib
python-memcached==1.59
# via -r requirements.in
Expand All @@ -61,7 +61,7 @@ pytz==2023.3.post1
# -r requirements.in
# django
# owslib
pyyaml==5.3.1
pyyaml==6.0.1
# via
# database-sanitizer
# django-sanitized-dump
Expand All @@ -72,7 +72,7 @@ requests==2.25.1
# via
# -r requirements.in
# owslib
six==1.15.0
six==1.16.0
# via
# database-sanitizer
# django-sanitized-dump
Expand Down
6 changes: 5 additions & 1 deletion run-pytest
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ fi
"${docker_compose_exec[@]}" -e RUN_MIGRATIONS=0 app ./docker-entrypoint /bin/true

set +e
"${docker_compose_exec[@]}" app pytest "${misc_opts[@]}" "${opts[@]}"
output="$("${docker_compose_exec[@]}" app pytest "${misc_opts[@]}" "${opts[@]}" 2>&1)"
exit_code=$?
set -e

if [[ -n "$xml_file" ]]; then
"${docker_compose_exec[@]}" app cat /tmp/pytest_junit.xml > "$xml_file"
fi

if [ $exit_code -ne 0 ]; then
echo "$output"
fi

exit $exit_code
16 changes: 7 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{35,36,37,38},requirements,style
envlist = py310,requirements,style
skipsdist = True

[testenv]
Expand All @@ -12,28 +12,26 @@ setenv =
SECRET_KEY=topsecret123
commands =
pytest -ra -vvv --strict --doctest-modules \
--exitfirst \ # DEBUGGING ONLY
{posargs:--cov=. --cov-report=term --cov-report=xml}

[testenv:requirements]
basepython = python3.5
basepython = python3.10
deps =
-rrequirements-pip.txt
-rrequirements-prequ.txt
commands = prequ {posargs:check -v}
commands = pip {posargs:check}

[testenv:style]
basepython = python3.5
basepython = python3.10
deps = -rrequirements-style.txt
commands = flake8 {posargs:--enable=T}

[testenv:sanitizer]
basepython = python3.5
basepython = python3.10
deps = -rrequirements.txt
commands = ./manage.py check_sanitizerconfig

[gh-actions]
python =
3.5: py35
3.6: py36
3.8: py38
3.10: py310
problem_matcher = False

0 comments on commit e66faa2

Please sign in to comment.