Skip to content

Commit e36f824

Browse files
authored
Merge pull request #949 from SamR1/ci-update-postgres-version
CI - add support for PostgreSQL 18
2 parents 60ecaae + 4ffcfef commit e36f824

File tree

8 files changed

+140
-83
lines changed

8 files changed

+140
-83
lines changed

.github/workflows/.e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
container: python:${{ inputs.python-version }}
2121
services:
2222
postgres:
23-
image: postgis/postgis:${{ inputs.postgres-version }}-${{ inputs.postgis-version }}
23+
image: postgis/postgis:${{ inputs.postgres-version }}-${{ inputs.postgis-version }}-alpine
2424
env:
2525
POSTGRES_DB: fittrackee_test
2626
POSTGRES_USER: fittrackee

.github/workflows/.tests-and-publish-python.yml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ env:
3838
jobs:
3939
python:
4040
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
41-
name: python ${{ matrix.python-version }} (postgresql 17 - postgis 3.5)
41+
name: python ${{ matrix.python-version }} (postgis 17-3.5)
4242
runs-on: ubuntu-latest
4343
container: python:${{ matrix.python-version }}
4444
services:
4545
postgres:
46-
image: postgis/postgis:17-3.5
46+
image: postgis/postgis:17-3.5-alpine
4747
env:
4848
POSTGRES_PASSWORD: postgres
4949
options: >-
@@ -100,12 +100,12 @@ jobs:
100100
# needs cffi 2+ for Python 3.14 support
101101
# python-next:
102102
# if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
103-
# name: python 3.14-rc (postgresql 17)
103+
# name: python 3.14-rc (postgis 17-3.5)
104104
# runs-on: ubuntu-latest
105105
# container: python:3.14-rc
106106
# services:
107107
# postgres:
108-
# image: postgres:17
108+
# image: postgis/postgis:17-3.5-alpine
109109
# env:
110110
# POSTGRES_PASSWORD: postgres
111111
# options: >-
@@ -130,14 +130,14 @@ jobs:
130130
# - name: Pytest
131131
# run: pytest fittrackee -n auto --maxprocesses=2 -p no:warnings --maxfail=1
132132

133-
postgresql:
133+
postgis:
134134
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
135-
name: postgresql/postgis ${{ matrix.psql-version }} (python 3.10)
135+
name: postgis ${{ matrix.psql-version }} (python 3.10)
136136
runs-on: ubuntu-latest
137137
container: python:3.10
138138
services:
139139
postgres:
140-
image: postgis/postgis:${{ matrix.psql-version }}
140+
image: postgis/postgis:${{ matrix.psql-version }}-alpine
141141
env:
142142
POSTGRES_PASSWORD: postgres
143143
options: >-
@@ -147,7 +147,40 @@ jobs:
147147
--health-retries 5
148148
strategy:
149149
matrix:
150-
psql-version: [ "13-3.5", "14-3.5", "15-3.5", "16-3.5", "17-3.4", "17-3.6-alpine", "18rc1-3.6-alpine" ]
150+
psql-version: [ "13-3.5", "14-3.5", "15-3.5", "16-3.5", "17-3.4", "17-3.6", "18-3.6" ]
151+
steps:
152+
153+
- uses: actions/checkout@v4
154+
155+
- name: Install Poetry and Dependencies
156+
run: |
157+
python -m pip install --upgrade pip
158+
pip install --quiet poetry
159+
poetry config virtualenvs.create false
160+
poetry install --no-interaction --quiet
161+
162+
- name: Create test databases
163+
run: python db/create_ci_test_db.py
164+
165+
- name: Pytest
166+
run: pytest fittrackee -n auto --maxprocesses=2 -p no:warnings --maxfail=1
167+
168+
169+
arm:
170+
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
171+
name: postgis 17-3.5 on arm platform (python 3.13)
172+
runs-on: ubuntu-24.04-arm
173+
container: python:3.13
174+
services:
175+
postgres:
176+
image: imresamu/postgis:17-3.5-alpine
177+
env:
178+
POSTGRES_PASSWORD: postgres
179+
options: >-
180+
--health-cmd pg_isready
181+
--health-interval 10s
182+
--health-timeout 5s
183+
--health-retries 5
151184
steps:
152185

153186
- uses: actions/checkout@v4
@@ -173,7 +206,7 @@ jobs:
173206
container: python:3.13
174207
services:
175208
postgres:
176-
image: postgis/postgis:17-3.5
209+
image: postgis/postgis:17-3.5-alpine
177210
env:
178211
POSTGRES_DB: fittrackee_test
179212
POSTGRES_USER: fittrackee
@@ -278,7 +311,7 @@ jobs:
278311
publish-to-pypi:
279312
if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v')
280313
name: Publish Python distribution to PyPI
281-
needs: ["postgresql", "end2end", "end2end_package", "end2end_package_update"]
314+
needs: ["postgis", "arm", "end2end", "end2end_package", "end2end_package_update"]
282315
runs-on: ubuntu-latest
283316
environment:
284317
name: pypi
@@ -341,7 +374,7 @@ jobs:
341374
push_to_registries:
342375
if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v')
343376
name: Push Docker image to multiple registries
344-
needs: ["postgresql", "end2end", "end2end_package", "end2end_package_update"]
377+
needs: ["postgis", "arm", "end2end", "end2end_package", "end2end_package_update"]
345378
runs-on: ubuntu-latest
346379
permissions:
347380
contents: read

.github/workflows/.tests-javascript.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
container: python:3.13
6363
services:
6464
postgres:
65-
image: postgis/postgis:17-3.5
65+
image: postgis/postgis:17-3.5-alpine
6666
env:
6767
POSTGRES_DB: fittrackee_test
6868
POSTGRES_USER: fittrackee

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![Vue Version](https://img.shields.io/badge/vue-3.5-brightgreen.svg)](https://v3.vuejs.org/)
1010
[![code formatter: prettier](https://img.shields.io/badge/code%20formatter-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
1111
[![Typescript Version](https://img.shields.io/npm/types/typescript)](https://www.typescriptlang.org/)
12-
[![PostgreSQL version](https://img.shields.io/badge/PostgreSQL-13_|_14_|_15_|_16_|_17-336791)](https://www.postgresql.org/)
12+
[![PostgreSQL version](https://img.shields.io/badge/PostgreSQL-13_|_14_|_15_|_16_|_17_|_18-336791)](https://www.postgresql.org/) [![PostgreSQL version](https://img.shields.io/badge/PostGIS-3.4_|_3.5_|_3.6-5b7b9f)](https://postgis.net/)
1313
[![PyPI version](https://img.shields.io/pypi/v/fittrackee?logo=pypi)](https://pypi.org/project/fittrackee/) [![docker image version](https://img.shields.io/docker/v/fittrackee/fittrackee?logo=docker)](https://hub.docker.com/r/fittrackee/fittrackee)
1414
[![Coverage Status](https://coveralls.io/repos/github/SamR1/FitTrackee/badge.svg?branch=master)](https://coveralls.io/github/SamR1/FitTrackee?branch=master)<sup><sup>1</sup></sup> [![pipeline status](https://github.com/SamR1/FitTrackee/actions/workflows/.tests-and-publish-python.yml/badge.svg)](https://github.com/SamR1/FitTrackee/actions/workflows/.tests-and-publish-python.yml)
1515
[![pipeline status](https://github.com/SamR1/FitTrackee/actions/workflows/.tests-javascript.yml/badge.svg)](https://github.com/SamR1/FitTrackee/actions/workflows/.tests-javascript.yml)

docker-compose-dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
services:
1111
fittrackee-db:
1212
container_name: fittrackee-db
13+
# Note: there is no official image for PostGIS on ARM CPUs yet.
14+
# The workaround is to build PostGIS image locally.
1315
image: postgis/postgis:17-3.5-alpine
1416
ports:
1517
- "5435:5432"

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
services:
1111
fittrackee-db:
1212
container_name: fittrackee-db
13+
# Always backup the database before FitTrackee upgrade when the new version
14+
# includes database migrations.
15+
#
16+
# Please refer to the PostgreSQL and PostGIS documentation before upgrading
17+
# image version.
18+
#
19+
# Warning: there is no official image for PostGIS on ARM CPUs yet, see:
20+
# https://github.com/postgis/docker-postgis/issues/216
21+
# The workaround is to build PostGIS image locally.
1322
image: postgis/postgis:17-3.5-alpine
1423
env_file:
1524
- .env
Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,75 @@
11
import pytest
2+
from shapely import Polygon
23

34

45
@pytest.fixture()
5-
def paris_with_10km_buffer() -> str:
6-
return (
7-
"POLYGON ((2.362431123843492 48.85348618457388, "
8-
"2.362376683159058 48.85260412906315, "
9-
"2.3621914976517617 48.851729841960484, "
10-
"2.361877357400467 48.85087174253842, "
11-
"2.3614372939000803 48.85003809376014, "
12-
"2.3608755506302987 48.84923692274121, "
13-
"2.3601975419801815 48.84847594349699, "
14-
"2.359409800932117 48.84776248271795, "
15-
"2.3585199160156343 48.847103409284585, "
16-
"2.357536458143191 48.84650506819859, "
17-
"2.3564688980357236 48.845973219562836, "
18-
"2.3553275150343875 48.84551298319479, "
19-
"2.3541232981759137 48.84512878940347, "
20-
"2.352867840481537 48.84482433640062, "
21-
"2.3515732274729673 48.844602554753436, "
22-
"2.350251920982787 48.844465579218486, "
23-
"2.348916639370555 48.84441472822586, "
24-
"2.3475802352893482 48.84445049120967, "
25-
"2.3462555721702842 48.844572523905505, "
26-
"2.3449554006044746 48.84477965166013, "
27-
"2.3436922358027883 48.845069880721375, "
28-
"2.342478237303791 48.84544041740063, "
29-
"2.3413250920792525 48.845887694924905, "
30-
"2.3402439021549983 48.84640740772136, "
31-
"2.3392450778227274 48.84699455280758, "
32-
"2.338338237466221 48.84764347789083, "
33-
"2.3375321149634742 48.848347935716944, "
34-
"2.3368344755552615 48.849101144148385, "
35-
"2.3362520409910985 48.849895851396326, "
36-
"2.3357904246761776 48.850724405781705, "
37-
"2.3354540774484014 48.85157882935648, "
38-
"2.3352462445139537 48.85245089467849, "
39-
"2.335168933963819 48.85333220400302, "
40-
"2.3352228971832982 48.85421427012996, "
41-
"2.335407621352846 48.85508859812885, "
42-
"2.3357213341225465 48.855946767155544, "
43-
"2.336161020425368 48.856780511571976, "
44-
"2.336722451277105 48.8575818005873, "
45-
"2.3374002242947487 48.85834291565157, "
46-
"2.338187815551136 48.85905652485485, "
47-
"2.339077642273151 48.85971575361278, "
48-
"2.3400611357847176 48.86031425095466, "
49-
"2.3411288239953136 48.86084625077276, "
50-
"2.3422704226408513 48.861306627439774, "
51-
"2.3434749343975185 48.86169094525505, "
52-
"2.3447307549113074 48.8619955012407, "
53-
"2.3460257847175616 48.86221736087195, "
54-
"2.3473475459663953 48.86235438639535, "
55-
"2.348683302822128 48.862405257459756, "
56-
"2.350020184368339 48.862369483859744, "
57-
"2.3513453088251945 48.86224741026767, "
58-
"2.352645907872629 48.862040212908404, "
59-
"2.353909449871892 48.861749888209, "
60-
"2.355123760788927 48.861379233533334, "
61-
"2.356277141645912 48.86093182018901, "
62-
"2.3573584813618034 48.86041195896831, "
63-
"2.358357363888493 48.85982465855751, "
64-
"2.359264168605826 48.85917557721837, "
65-
"2.3600701630054024 48.858470968209936, "
66-
"2.3607675867693834 48.85771761947954, "
67-
"2.361349726435341 48.85692278820765, "
68-
"2.3618109799308575 48.85609413083947, "
69-
"2.362146910360975 48.85523962928065, "
70-
"2.3623542885368094 48.85436751397021, "
71-
"2.362431123843492 48.85348618457388))"
6+
def paris_with_10km_buffer() -> Polygon:
7+
return Polygon(
8+
(
9+
(2.362431123843492, 48.85348618457388),
10+
(2.362376683159058, 48.85260412906315),
11+
(2.3621914976517617, 48.851729841960484),
12+
(2.361877357400467, 48.85087174253842),
13+
(2.3614372939000803, 48.85003809376014),
14+
(2.3608755506302987, 48.84923692274121),
15+
(2.3601975419801815, 48.84847594349699),
16+
(2.359409800932117, 48.84776248271795),
17+
(2.3585199160156343, 48.847103409284585),
18+
(2.357536458143191, 48.84650506819859),
19+
(2.3564688980357236, 48.845973219562836),
20+
(2.3553275150343875, 48.84551298319479),
21+
(2.3541232981759137, 48.84512878940347),
22+
(2.352867840481537, 48.84482433640062),
23+
(2.3515732274729673, 48.844602554753436),
24+
(2.350251920982787, 48.844465579218486),
25+
(2.348916639370555, 48.84441472822586),
26+
(2.3475802352893482, 48.84445049120967),
27+
(2.3462555721702842, 48.844572523905505),
28+
(2.3449554006044746, 48.84477965166013),
29+
(2.3436922358027883, 48.845069880721375),
30+
(2.342478237303791, 48.84544041740063),
31+
(2.3413250920792525, 48.845887694924905),
32+
(2.3402439021549983, 48.84640740772136),
33+
(2.3392450778227274, 48.84699455280758),
34+
(2.338338237466221, 48.84764347789083),
35+
(2.3375321149634742, 48.848347935716944),
36+
(2.3368344755552615, 48.849101144148385),
37+
(2.3362520409910985, 48.849895851396326),
38+
(2.3357904246761776, 48.850724405781705),
39+
(2.3354540774484014, 48.85157882935648),
40+
(2.3352462445139537, 48.85245089467849),
41+
(2.335168933963819, 48.85333220400302),
42+
(2.3352228971832982, 48.85421427012996),
43+
(2.335407621352846, 48.85508859812885),
44+
(2.3357213341225465, 48.855946767155544),
45+
(2.336161020425368, 48.856780511571976),
46+
(2.336722451277105, 48.8575818005873),
47+
(2.3374002242947487, 48.85834291565157),
48+
(2.338187815551136, 48.85905652485485),
49+
(2.339077642273151, 48.85971575361278),
50+
(2.3400611357847176, 48.86031425095466),
51+
(2.3411288239953136, 48.86084625077276),
52+
(2.3422704226408513, 48.861306627439774),
53+
(2.3434749343975185, 48.86169094525505),
54+
(2.3447307549113074, 48.8619955012407),
55+
(2.3460257847175616, 48.86221736087195),
56+
(2.3473475459663953, 48.86235438639535),
57+
(2.348683302822128, 48.862405257459756),
58+
(2.350020184368339, 48.862369483859744),
59+
(2.3513453088251945, 48.86224741026767),
60+
(2.352645907872629, 48.862040212908404),
61+
(2.353909449871892, 48.861749888209),
62+
(2.355123760788927, 48.861379233533334),
63+
(2.356277141645912, 48.86093182018901),
64+
(2.3573584813618034, 48.86041195896831),
65+
(2.358357363888493, 48.85982465855751),
66+
(2.359264168605826, 48.85917557721837),
67+
(2.3600701630054024, 48.858470968209936),
68+
(2.3607675867693834, 48.85771761947954),
69+
(2.361349726435341, 48.85692278820765),
70+
(2.3618109799308575, 48.85609413083947),
71+
(2.362146910360975, 48.85523962928065),
72+
(2.3623542885368094, 48.85436751397021),
73+
(2.362431123843492, 48.85348618457388),
74+
)
7275
)

fittrackee/tests/workouts/test_utils/test_geometry.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from typing import TYPE_CHECKING
22

33
import pytest
4+
import shapely.wkt
5+
from shapely import set_precision
46

57
from fittrackee.workouts.exceptions import (
68
InvalidCoordinatesException,
@@ -17,6 +19,7 @@
1719

1820
if TYPE_CHECKING:
1921
from flask import Flask
22+
from shapely import Polygon
2023

2124
from fittrackee.users.models import User
2225
from fittrackee.workouts.models import Sport, Workout, WorkoutSegment
@@ -511,12 +514,19 @@ def test_it_raises_exception_when_coordinates_are_invalid(
511514

512515
@pytest.mark.parametrize("input_radius", ["1", "1.0"])
513516
def test_it_returns_buffered_polygon_with_4326_srid(
514-
self, app: "Flask", paris_with_10km_buffer: str, input_radius: str
517+
self,
518+
app: "Flask",
519+
paris_with_10km_buffer: "Polygon",
520+
input_radius: str,
515521
) -> None:
516522
paris_coordinates = "48.85341,2.3488"
517523

518524
buffer = get_buffered_location(paris_coordinates, input_radius)
519525

520526
srid, geometry = buffer.split(";")
521527
assert srid == "SRID=4326"
522-
assert geometry == paris_with_10km_buffer
528+
# to handle rounding differences on different platforms
529+
precision = 1e-10
530+
assert str(
531+
set_precision(shapely.wkt.loads(geometry), precision)
532+
) == str(set_precision(paris_with_10km_buffer, precision))

0 commit comments

Comments
 (0)