From 7b351db093f18a2549247a645eca0d4d4d23244f Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 12:05:01 +0200 Subject: [PATCH 01/46] test with python 3.10 --- .github/workflows/test.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 36dd80c108..bd27e03bea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,8 @@ jobs: strategy: matrix: - os: ['bionic-3.8', 'focal-3.8'] - python-version: ['3.8'] + os: ['jammy-3.10'] + python-version: ['3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -115,7 +115,7 @@ jobs: - name: Install python dependencies run: | - python3.8 -m venv ./venv + python3.10 -m venv ./venv ./venv/bin/pip3 install --upgrade pip wheel setuptools -c requirements.txt -c dev-requirements.txt ./venv/bin/pip3 install -r requirements.txt -U ./venv/bin/pip3 install -r dev-requirements.txt -U @@ -161,8 +161,8 @@ jobs: needs: [ test ] strategy: matrix: - os: ['focal-3.8'] - python-version: ['3.8'] + os: ['jammy-3.10'] + python-version: ['3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -243,6 +243,28 @@ jobs: path: | /home/runner/work/Geotrek-admin/*.deb + build_deb_22_04: + name: Build 22.04 package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Prepare debian 22.04 versioning + run: | + sed -i 's/+dev/.ubuntu22.04~dev'$GITHUB_RUN_ID'/' debian/changelog + sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu22.04\2) focal;/' debian/changelog + + - name: Building package debian 22.04 + run: | + DISTRO=ubuntu:jammy make build_deb + cp ./dpkg/*.deb /home/runner/work/Geotrek-admin/ + + - name: Archive package artifact + uses: actions/upload-artifact@v4 + with: + name: debian-22-04 + path: | + /home/runner/work/Geotrek-admin/*.deb + e2e_docker_image: name: Tests E2E docker runs-on: ubuntu-20.04 From e1446d58db4bfb2208eb2b2a4bde545818846d2a Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 12:15:24 +0200 Subject: [PATCH 02/46] test with python 3.10 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a8723c9e54..b258e44d3b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ async-timeout==4.0.3 # via redis attrs==24.2.0 # via fiona -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1;python_version<"3.10" # via # celery # django From fe6cf4ea019610a169bbe9588e6c220ff49e9210 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 12:19:19 +0200 Subject: [PATCH 03/46] test with python 3.10 --- dev-requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index de7b257152..bcc193557f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,7 +8,8 @@ asgiref==3.8.1 # via # -c requirements.txt # django -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1;python_version<"3.10" + # via # -c requirements.txt # django From d3a370f80432a809b0d7b33f4fee40f6afafa3e0 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 13:24:29 +0200 Subject: [PATCH 04/46] test with python 3.10 --- geotrek/common/parsers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geotrek/common/parsers.py b/geotrek/common/parsers.py index 45c03a6ec7..e5157f5f2a 100644 --- a/geotrek/common/parsers.py +++ b/geotrek/common/parsers.py @@ -13,7 +13,7 @@ import xlrd import xml.etree.ElementTree as ET from functools import reduce -from collections import Iterable +from collections.abc import Iterable from time import sleep from PIL import Image, UnidentifiedImageError From 202da10945fd86eae3253754de2eedd8322d9fb3 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 14:11:11 +0200 Subject: [PATCH 05/46] test with python 3.10 --- debian/conffiles | 8 ++++---- debian/control | 8 ++++---- debian/geotrek-admin.triggers | 3 +-- docker/Dockerfile.debian.builder | 3 +++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/debian/conffiles b/debian/conffiles index c8520f7bd7..14fdfa65c6 100644 --- a/debian/conffiles +++ b/debian/conffiles @@ -1,4 +1,4 @@ -opt/geotrek-admin/var/conf/env.in -opt/geotrek-admin/var/conf/nginx.conf.in -opt/geotrek-admin/var/conf/gunicorn-geotrek.conf.py.in -opt/geotrek-admin/var/conf/gunicorn-geotrek_api.conf.py.in +/opt/geotrek-admin/var/conf/env.in +/opt/geotrek-admin/var/conf/nginx.conf.in +/opt/geotrek-admin/var/conf/gunicorn-geotrek.conf.py.in +/opt/geotrek-admin/var/conf/gunicorn-geotrek_api.conf.py.in diff --git a/debian/control b/debian/control index e204839507..6e0772b938 100644 --- a/debian/control +++ b/debian/control @@ -10,9 +10,9 @@ Build-Depends: debhelper (>= 9), dh-virtualenv (>= 1.0), git, - python3.8 (>= 3.8), - python3.8-venv (>= 3.8), - python3.8-dev (>= 3.8), + python3.8 | python3.10, + python3.8-venv | python3.10-venv, + python3.8-dev | python3.10-dev, libgdal-dev (>= 2.2), libffi-dev (>= 3), libxml2-dev (>= 2.9.2), @@ -37,6 +37,6 @@ Depends: screamshotter (>= 2.0.9), screamshotter (<< 3.0.0), convertit, - python3.8 (>= 3.8), + python3.8 | python3.10, libvips Description: Manage and promote your trails and tourist content and activities. diff --git a/debian/geotrek-admin.triggers b/debian/geotrek-admin.triggers index 9410395a07..20ffdad4b5 100644 --- a/debian/geotrek-admin.triggers +++ b/debian/geotrek-admin.triggers @@ -1,9 +1,8 @@ # Register interest in Python interpreter changes; and # don't make the Python package dependent on the virtualenv package # processing (noawait) -interest-noawait /usr/bin/python3.5 -interest-noawait /usr/bin/python3.6 interest-noawait /usr/bin/python3.8 +interest-noawait /usr/bin/python3.10 # Also provide a symbolic trigger for all dh-virtualenv packages interest dh-virtualenv-interpreter-update diff --git a/docker/Dockerfile.debian.builder b/docker/Dockerfile.debian.builder index e33e743792..dd77f8a1ef 100644 --- a/docker/Dockerfile.debian.builder +++ b/docker/Dockerfile.debian.builder @@ -29,6 +29,9 @@ RUN env DEBIAN_FRONTEND=noninteractive mk-build-deps --install --tool='apt-get - COPY . ./ WORKDIR /dpkg-build +RUN if test "$(lsb_release -cs)" = 'jammy' ; then \ + sed -i 's/python3.8/python3.10/g' debian/rules; fi + RUN sed -i -re "1s/..UNRELEASED/.ubuntu$(lsb_release -rs)) $(lsb_release -cs)/" debian/changelog \ && chmod a-x debian/geotrek.* \ && dpkg-buildpackage -us -uc -b && mkdir -p /dpkg && cp -pl /geotrek[-_]* /dpkg \ From 1327f379070defecb4ec022acfc22e84da46d520 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 15:43:39 +0200 Subject: [PATCH 06/46] test with python 3.10 --- .github/workflows/test.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd27e03bea..9085295e29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,7 @@ jobs: strategy: matrix: - os: ['jammy-3.10'] - python-version: ['3.10'] + os: ['focal-3.8', jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -79,10 +78,10 @@ jobs: path: | ./venv - key: pip-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} + key: pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} restore-keys: | - pip-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} - pip-${{ matrix.python-version }}-${{ matrix.os }} + pip-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} + pip-${{ matrix.os }} - name: Prepare test env run: | @@ -115,7 +114,7 @@ jobs: - name: Install python dependencies run: | - python3.10 -m venv ./venv + python3 -m venv ./venv ./venv/bin/pip3 install --upgrade pip wheel setuptools -c requirements.txt -c dev-requirements.txt ./venv/bin/pip3 install -r requirements.txt -U ./venv/bin/pip3 install -r dev-requirements.txt -U @@ -150,7 +149,6 @@ jobs: - name: Save coverage uses: actions/upload-artifact@v4 - if: ${{ matrix.os != 'bionic-3.8' }} with: name: coverage_${{ matrix.os }}_${{ matrix.tests-env }} path: coverage.xml @@ -161,8 +159,7 @@ jobs: needs: [ test ] strategy: matrix: - os: ['jammy-3.10'] - python-version: ['3.10'] + os: ['focal-3.8', jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -170,7 +167,7 @@ jobs: OS: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: coverage_${{ matrix.os }}_${{ matrix.tests-env }} From bc4cfb1ee971a450039b52d18ab68e807c58385d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 15:47:56 +0200 Subject: [PATCH 07/46] test with python 3.10 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9085295e29..fab0d8f357 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,7 +45,7 @@ jobs: strategy: matrix: - os: ['focal-3.8', jammy-3.10'] + os: ['focal-3.8', 'jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -159,7 +159,7 @@ jobs: needs: [ test ] strategy: matrix: - os: ['focal-3.8', jammy-3.10'] + os: ['focal-3.8', 'jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: From 21db038551a81b148a71d9c929e89de423228d7b Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 17:20:58 +0200 Subject: [PATCH 08/46] fix dependencies --- dev-requirements.txt | 3 +-- requirements.txt | 3 ++- setup.py | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index bcc193557f..d75269bdc2 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,8 +8,7 @@ asgiref==3.8.1 # via # -c requirements.txt # django -backports-zoneinfo==0.2.1;python_version<"3.10" - +backports-zoneinfo==0.2.1 ; python_version < "3.10" # via # -c requirements.txt # django diff --git a/requirements.txt b/requirements.txt index b258e44d3b..043f24c0bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,11 +14,12 @@ async-timeout==4.0.3 # via redis attrs==24.2.0 # via fiona -backports-zoneinfo==0.2.1;python_version<"3.10" +backports-zoneinfo==0.2.1 ; python_version < "3.10" # via # celery # django # djangorestframework + # geotrek (setup.py) # kombu beautifulsoup4==4.12.3 # via mapentity diff --git a/setup.py b/setup.py index 34fca1b696..b34032010c 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ def run(self): scripts=['manage.py'], install_requires=[ 'Django==4.2.*', + 'backports-zoneinfo;python_version<"3.10"', # not directly needed but required to make it worked with 3.10 'mapentity', 'chardet', 'cairosvg', From b09082860cff2b419f1a15d8a74eca0673b7613d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 17:26:03 +0200 Subject: [PATCH 09/46] Docker file to python3.10 --- docker/Dockerfile | 50 +++++++++++++++++------------------- docker/scripts/entrypoint.sh | 3 --- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a4238717e4..a9aa3c85ea 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:focal as base - -ENV PYTHONBUFFERED 1 -ENV DEBIAN_FRONTEND noninteractive -ENV ENV prod -ENV SERVER_NAME "localhost" -# If POSTGRES_HOST is empty, entrypoint will set it to the IP of the docker host in the container -ENV POSTGRES_HOST "" -ENV POSTGRES_PORT "5432" -ENV POSTGRES_USER "geotrek" -ENV POSTGRES_PASSWORD "geotrek" -ENV POSTGRES_DB "geotrekdb" -ENV REDIS_HOST "redis" -ENV CONVERSION_HOST "convertit" -ENV CAPTURE_HOST "screamshotter" -ENV CUSTOM_SETTINGS_FILE "/opt/geotrek-admin/var/conf/custom.py" -ENV TZ UTC +FROM ubuntu:jammy AS base + +ENV PYTHONBUFFERED=1 +ENV DEBIAN_FRONTEND=noninteractive +ENV ENV=prod +ENV SERVER_NAME="localhost" +ENV POSTGRES_HOST="host.docker.internal" +ENV POSTGRES_PORT="5432" +ENV POSTGRES_USER="geotrek" +ENV POSTGRES_DB="geotrekdb" +ENV REDIS_HOST="redis" +ENV CONVERSION_HOST="convertit" +ENV CAPTURE_HOST="screamshotter" +ENV CUSTOM_SETTINGS_FILE="/opt/geotrek-admin/var/conf/custom.py" +ENV TZ=UTC WORKDIR /opt/geotrek-admin RUN mkdir -p /opt/geotrek-admin/var/log /opt/geotrek-admin/var/cache @@ -22,7 +20,7 @@ RUN adduser geotrek --disabled-password && chown geotrek:geotrek -R /opt # Install postgis because raster2pgsl is required by manage.py loaddem RUN apt-get update -qq && apt-get install -y -qq \ - python3.8 \ + python3.10 \ ca-certificates \ gettext \ postgresql-client \ @@ -33,7 +31,6 @@ RUN apt-get update -qq && apt-get install -y -qq \ libproj-dev \ unzip \ less \ - iproute2 \ nano \ curl \ software-properties-common \ @@ -58,26 +55,27 @@ COPY --chown=geotrek:geotrek docker/scripts/* /usr/local/bin/ ENTRYPOINT ["/bin/sh", "-e", "/usr/local/bin/entrypoint.sh"] EXPOSE 8000 -FROM base as build +FROM base AS build USER root RUN apt-get update -qq && apt-get install -y -qq \ git \ - python3.8-dev \ - python3.8-venv \ + python3.10-dev \ + python3.10-venv \ build-essential \ libpq-dev &&\ apt-get clean all && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/* USER geotrek -RUN python3.8 -m venv /opt/venv +RUN python3.10 -m venv /opt/venv RUN /opt/venv/bin/pip install --no-cache-dir -U pip setuptools wheel COPY requirements.txt requirements.txt RUN /opt/venv/bin/pip install --no-cache-dir -r requirements.txt -U -FROM build as dev +FROM build AS dev +ENV ENV=dev COPY dev-requirements.txt dev-requirements.txt RUN /opt/venv/bin/pip install --no-cache-dir -r dev-requirements.txt COPY ./docs/requirements.txt doc-requirements.txt @@ -85,9 +83,7 @@ RUN /opt/venv/bin/pip install --no-cache-dir -r doc-requirements.txt CMD ["./manage.py", "runserver", "0.0.0.0:8000"] -FROM base as prod - -ENV ENV prod +FROM base AS prod COPY --chown=geotrek:geotrek --from=build /opt/venv /opt/venv COPY --chown=geotrek:geotrek geotrek/ geotrek/ diff --git a/docker/scripts/entrypoint.sh b/docker/scripts/entrypoint.sh index 964f343b61..9d87300adc 100755 --- a/docker/scripts/entrypoint.sh +++ b/docker/scripts/entrypoint.sh @@ -26,9 +26,6 @@ fi # Activate venv . /opt/venv/bin/activate -# Defaults POSTGRES_HOST to Docker host IP -export POSTGRES_HOST=${POSTGRES_HOST:-`ip route | grep default | sed 's/.* \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\) .*/\1/'`} - # Defaults SECRET_KEY to a random value SECRET_KEY_FILE=/opt/geotrek-admin/var/conf/secret_key if [ -z $SECRET_KEY ]; then From bcbfd5c3ecb4c123ec87cfc09b885fb77bc02b2f Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 18:31:17 +0200 Subject: [PATCH 10/46] Docker file to python3.10 --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index a9aa3c85ea..926148f8eb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,6 +35,7 @@ RUN apt-get update -qq && apt-get install -y -qq \ curl \ software-properties-common \ shared-mime-info \ + libmagic-mgc \ fonts-liberation \ libssl-dev \ libfreetype6-dev \ From ae60f7d0c6ae6212f1fdaf6162352747261f8b7b Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 20:50:00 +0200 Subject: [PATCH 11/46] Docker file to python3.10 --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 926148f8eb..714305ba25 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,7 +35,7 @@ RUN apt-get update -qq && apt-get install -y -qq \ curl \ software-properties-common \ shared-mime-info \ - libmagic-mgc \ + libmagic1 \ fonts-liberation \ libssl-dev \ libfreetype6-dev \ From 2ed5c129648b3782272cec6907b6b317e9fbfad1 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 21:06:11 +0200 Subject: [PATCH 12/46] fix tests --- geotrek/settings/env_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/geotrek/settings/env_tests.py b/geotrek/settings/env_tests.py index 0c3514bbe1..17af24a1ac 100644 --- a/geotrek/settings/env_tests.py +++ b/geotrek/settings/env_tests.py @@ -75,7 +75,8 @@ def __getitem__(self, item): MOBILE_TILES_PATH = TemporaryDirectory(dir=TMP_DIR).name # sync mobile tile path DATA_TEMP_DIR = TemporaryDirectory(dir=TMP_DIR).name # data temp dir use by django-large-image REDIS_URL = f"redis://{os.getenv('REDIS_HOST', 'localhost')}:{os.getenv('REDIS_PORT', '6379')}/1" # celery broker url -SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" +SESSION_ENGINE = "django.contrib.sessions.backends.file" +SESSION_FILE_PATH = TemporaryDirectory(dir=TMP_DIR).name PASSWORD_HASHERS = [ "django.contrib.auth.hashers.MD5PasswordHasher", ] From 2aae42436aaf346d9298f0bd23cf15e8b9c3ff9a Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 21:18:00 +0200 Subject: [PATCH 13/46] fix tests --- geotrek/settings/env_tests.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/geotrek/settings/env_tests.py b/geotrek/settings/env_tests.py index 17af24a1ac..600ef924c4 100644 --- a/geotrek/settings/env_tests.py +++ b/geotrek/settings/env_tests.py @@ -64,8 +64,8 @@ def __getitem__(self, item): if os.path.exists(TMP_DIR): shutil.rmtree(TMP_DIR) os.makedirs(TMP_DIR) -SESSIONS_DIR = os.path.join(TMP_DIR, 'sessions') -os.makedirs(SESSIONS_DIR) +SESSION_FILE_PATH = TemporaryDirectory(dir=TMP_DIR).name +os.makedirs(SESSION_FILE_PATH) LOGGING['loggers']['']['handlers'] = ('log_file', ) LOGGING['handlers']['log_file']['level'] = 'INFO' @@ -75,8 +75,7 @@ def __getitem__(self, item): MOBILE_TILES_PATH = TemporaryDirectory(dir=TMP_DIR).name # sync mobile tile path DATA_TEMP_DIR = TemporaryDirectory(dir=TMP_DIR).name # data temp dir use by django-large-image REDIS_URL = f"redis://{os.getenv('REDIS_HOST', 'localhost')}:{os.getenv('REDIS_PORT', '6379')}/1" # celery broker url -SESSION_ENGINE = "django.contrib.sessions.backends.file" -SESSION_FILE_PATH = TemporaryDirectory(dir=TMP_DIR).name +# SESSION_ENGINE = "django.contrib.sessions.backends.file" PASSWORD_HASHERS = [ "django.contrib.auth.hashers.MD5PasswordHasher", ] From ff1060caf6038b3276ec71c4756adfbae44c2658 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 3 Oct 2024 21:33:26 +0200 Subject: [PATCH 14/46] fix tests --- docker/Dockerfile | 1 + docker/scripts/entrypoint.sh | 2 ++ docs/changelog.rst | 1 + 3 files changed, 4 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 714305ba25..be08e66733 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -31,6 +31,7 @@ RUN apt-get update -qq && apt-get install -y -qq \ libproj-dev \ unzip \ less \ + iproute2 \ nano \ curl \ software-properties-common \ diff --git a/docker/scripts/entrypoint.sh b/docker/scripts/entrypoint.sh index 9d87300adc..1293c3dabe 100755 --- a/docker/scripts/entrypoint.sh +++ b/docker/scripts/entrypoint.sh @@ -26,6 +26,8 @@ fi # Activate venv . /opt/venv/bin/activate +export POSTGRES_HOST=${POSTGRES_HOST:-`ip route | grep default | sed 's/.* \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\) .*/\1/'`} + # Defaults SECRET_KEY to a random value SECRET_KEY_FILE=/opt/geotrek-admin/var/conf/secret_key if [ -z $SECRET_KEY ]; then diff --git a/docs/changelog.rst b/docs/changelog.rst index cd77951d72..996b1c67e2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ CHANGELOG **Maintenance** +- Docker image use now fully tested Ubuntu Jammy and python3.10 - Use new crispy form - Bump mapentity to 8.10.0. Mapentity login page has been improved, take care about your logo-login.png size. From 13b6c2afee8dd44539dfcdc569eb7666dfb7f03d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:29:16 +0200 Subject: [PATCH 15/46] support 3.12 --- .github/workflows/test.yml | 100 ++++++++++++------------------- debian/control | 8 +-- debian/rules | 1 - docker-compose.yml | 2 + docker/Dockerfile | 12 ++-- docker/Dockerfile.debian.builder | 5 +- requirements.txt | 4 +- 7 files changed, 56 insertions(+), 76 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fab0d8f357..70c292eaca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -196,71 +196,45 @@ jobs: with: image: "geotrek:latest" - build_deb_18_04: - name: Build 18.04 package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Prepare debian 18.04 versioning - run: | - grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' VERSION || sed -i 's/+dev/.ubuntu18.04~dev'$GITHUB_RUN_ID'/' debian/changelog - sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu18.04\2) bionic;/' debian/changelog - - - name: Building package debian 18.04 - run: | - DISTRO=ubuntu:bionic make build_deb - cp ./dpkg/*.deb /home/runner/work/Geotrek-admin/ - - - name: Archive package artifact - uses: actions/upload-artifact@v4 - with: - name: debian-18-04 - path: | - /home/runner/work/Geotrek-admin/*.deb - - build_deb_20_04: - name: Build 20.04 package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Prepare debian 20.04 versioning - run: | - sed -i 's/+dev/.ubuntu20.04~dev'$GITHUB_RUN_ID'/' debian/changelog - sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu20.04\2) focal;/' debian/changelog - - - name: Building package debian 18.04 - run: | - DISTRO=ubuntu:focal make build_deb - cp ./dpkg/*.deb /home/runner/work/Geotrek-admin/ + build_deb: + name: Build debian package + runs-on: ubuntu-lastest + matrix: + strategy: + os: ['ubuntu:bionic', 'ubuntu:focal', 'ubuntu:jammy', 'ubuntu:noble'] + include: + - os: 'bionic' + code: '18.04' + - os: 'focal' + code: '20.04' + - os: 'jammy' + code: '22.04' + - os: 'noble' + code: '24.04' + env: + OS: ${{ matrix.os }} + CODE: ${{ matrix.code }} + DISTRO: ubuntu:${{ matrix.os }} - - name: Archive package artifact - uses: actions/upload-artifact@v4 - with: - name: debian-20-04 - path: | - /home/runner/work/Geotrek-admin/*.deb + steps: + - uses: actions/checkout@v4 + - name: Prepare versioning + run: | + grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' VERSION || sed -i 's/+dev/.ubuntu$CODE~dev'$GITHUB_RUN_ID'/' debian/changelog + sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu$CODE\2) $OS;/' debian/changelog - build_deb_22_04: - name: Build 22.04 package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Prepare debian 22.04 versioning - run: | - sed -i 's/+dev/.ubuntu22.04~dev'$GITHUB_RUN_ID'/' debian/changelog - sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu22.04\2) focal;/' debian/changelog + - name: Building package + run: | + make build_deb + cp ./dpkg/*.deb /home/runner/work/Geotrek-admin/ - - name: Building package debian 22.04 - run: | - DISTRO=ubuntu:jammy make build_deb - cp ./dpkg/*.deb /home/runner/work/Geotrek-admin/ + - name: Archive package artifact + uses: actions/upload-artifact@v4 + with: + name: $DISTRO + path: | + /home/runner/work/Geotrek-admin/*.deb - - name: Archive package artifact - uses: actions/upload-artifact@v4 - with: - name: debian-22-04 - path: | - /home/runner/work/Geotrek-admin/*.deb e2e_docker_image: name: Tests E2E docker @@ -348,7 +322,7 @@ jobs: e2e_deb_20_04: name: Tests E2E 20.04 runs-on: ubuntu-20.04 - needs: [ build_deb_20_04 ] + needs: [ build_deb ] env: CYPRESS_BASE_URL: http://geotrek.local @@ -371,7 +345,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/download-artifact@v4 with: - name: debian-20-04 + name: 'ubuntu:focal' - name: Simulate install.sh procedure run: | diff --git a/debian/control b/debian/control index 6e0772b938..63cd445d3c 100644 --- a/debian/control +++ b/debian/control @@ -10,9 +10,9 @@ Build-Depends: debhelper (>= 9), dh-virtualenv (>= 1.0), git, - python3.8 | python3.10, - python3.8-venv | python3.10-venv, - python3.8-dev | python3.10-dev, + python3.8 | python3.10 | python3.12, + python3.8-venv | python3.10-venv | python3.12-venv, + python3.8-dev | python3.10-dev | python3.12-dev, libgdal-dev (>= 2.2), libffi-dev (>= 3), libxml2-dev (>= 2.9.2), @@ -37,6 +37,6 @@ Depends: screamshotter (>= 2.0.9), screamshotter (<< 3.0.0), convertit, - python3.8 | python3.10, + python3.8 | python3.10 | python3.12, libvips Description: Manage and promote your trails and tourist content and activities. diff --git a/debian/rules b/debian/rules index 6394839dd1..d59b80bdad 100755 --- a/debian/rules +++ b/debian/rules @@ -8,7 +8,6 @@ export DH_VIRTUALENV_INSTALL_ROOT=/opt override_dh_virtualenv: dh_virtualenv \ --python /usr/bin/python3.8 \ - --upgrade-pip \ --preinstall wheel \ --preinstall setuptools==69.2.0 \ --builtin-venv \ diff --git a/docker-compose.yml b/docker-compose.yml index 92fa06dbb9..1f1eea41e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,8 @@ x-images: context: . dockerfile: ./docker/Dockerfile target: dev + args: + BASE_IMAGE: focal user: ${UID:-1000}:${GID:-1000} env_file: - .env diff --git a/docker/Dockerfile b/docker/Dockerfile index be08e66733..1929c8dc9f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,6 @@ -FROM ubuntu:jammy AS base +ARG BASE_IMAGE=noble + +FROM ubuntu:${BASE_IMAGE} AS base ENV PYTHONBUFFERED=1 ENV DEBIAN_FRONTEND=noninteractive @@ -20,7 +22,7 @@ RUN adduser geotrek --disabled-password && chown geotrek:geotrek -R /opt # Install postgis because raster2pgsl is required by manage.py loaddem RUN apt-get update -qq && apt-get install -y -qq \ - python3.10 \ + python3 \ ca-certificates \ gettext \ postgresql-client \ @@ -63,14 +65,14 @@ USER root RUN apt-get update -qq && apt-get install -y -qq \ git \ - python3.10-dev \ - python3.10-venv \ + python3-dev \ + python3-venv \ build-essential \ libpq-dev &&\ apt-get clean all && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/* USER geotrek -RUN python3.10 -m venv /opt/venv +RUN python3 -m venv /opt/venv RUN /opt/venv/bin/pip install --no-cache-dir -U pip setuptools wheel COPY requirements.txt requirements.txt RUN /opt/venv/bin/pip install --no-cache-dir -r requirements.txt -U diff --git a/docker/Dockerfile.debian.builder b/docker/Dockerfile.debian.builder index dd77f8a1ef..69dd19c7c7 100644 --- a/docker/Dockerfile.debian.builder +++ b/docker/Dockerfile.debian.builder @@ -30,7 +30,10 @@ COPY . ./ WORKDIR /dpkg-build RUN if test "$(lsb_release -cs)" = 'jammy' ; then \ - sed -i 's/python3.8/python3.10/g' debian/rules; fi + sed -i 's/python3.8/python3.10/g' debian/rules; \ + elif test "$(lsb_release -cs)" = 'noble' ; then \ + sed -i 's/python3.8/python3.12/g' debian/rules; \ + fi RUN sed -i -re "1s/..UNRELEASED/.ubuntu$(lsb_release -rs)) $(lsb_release -cs)/" debian/changelog \ && chmod a-x debian/geotrek.* \ diff --git a/requirements.txt b/requirements.txt index 043f24c0bb..534af31c44 100644 --- a/requirements.txt +++ b/requirements.txt @@ -243,7 +243,7 @@ markupsafe==2.1.5 # via jinja2 mbutil==0.3.0 # via landez -numpy==1.23.4 +numpy==1.24.4 # via # large-image # large-image-source-vips @@ -327,7 +327,7 @@ rjsmin==1.2.1 # via django-compressor ruamel-yaml==0.18.6 # via drf-yasg -ruamel-yaml-clib==0.2.7 +ruamel-yaml-clib==0.2.8 # via ruamel-yaml sentry-sdk==2.14.0 # via geotrek (setup.py) From e4f105f0a929bafe1b71fd89abab1fa3e6c6e63a Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:33:51 +0200 Subject: [PATCH 16/46] support 3.12 --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70c292eaca..d0a4ca77f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -198,9 +198,9 @@ jobs: build_deb: name: Build debian package - runs-on: ubuntu-lastest - matrix: - strategy: + runs-on: ubuntu-latest + strategy: + matrix: os: ['ubuntu:bionic', 'ubuntu:focal', 'ubuntu:jammy', 'ubuntu:noble'] include: - os: 'bionic' From 7b9bebd674f87f494656125c9e445bb54b22209e Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:35:53 +0200 Subject: [PATCH 17/46] support 3.12 --- .github/workflows/test.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0a4ca77f6..6d025b4175 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -202,15 +202,15 @@ jobs: strategy: matrix: os: ['ubuntu:bionic', 'ubuntu:focal', 'ubuntu:jammy', 'ubuntu:noble'] - include: - - os: 'bionic' - code: '18.04' - - os: 'focal' - code: '20.04' - - os: 'jammy' - code: '22.04' - - os: 'noble' - code: '24.04' + include: + - os: 'bionic' + code: '18.04' + - os: 'focal' + code: '20.04' + - os: 'jammy' + code: '22.04' + - os: 'noble' + code: '24.04' env: OS: ${{ matrix.os }} CODE: ${{ matrix.code }} From e9cca052caf7c69ac3e47a59d269d375b126d971 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:39:22 +0200 Subject: [PATCH 18/46] fix ci --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d025b4175..9bf9d38e60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -403,7 +403,7 @@ jobs: deploy: name: Publish (on release only) runs-on: ubuntu-latest - needs: [ test, e2e_docker_image, build_deb_18_04, e2e_deb_20_04 ] + needs: [ test, e2e_docker_image, build_deb, e2e_deb_20_04 ] if: ${{ github.event_name == 'release' && github.event.action == 'created' }} steps: - uses: actions/checkout@v3 From 1c91e373a5244ce8c4508fba1734ad32a832bdb8 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:40:25 +0200 Subject: [PATCH 19/46] fix ci --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9bf9d38e60..ed18a212b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -201,7 +201,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: ['ubuntu:bionic', 'ubuntu:focal', 'ubuntu:jammy', 'ubuntu:noble'] + os: ['bionic', 'focal', 'jammy', 'noble'] include: - os: 'bionic' code: '18.04' From 9e6872583163fb03556a6ab2d406111a3c533b23 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:50:02 +0200 Subject: [PATCH 20/46] fix docker image --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1929c8dc9f..5b681504dd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,7 +18,7 @@ ENV TZ=UTC WORKDIR /opt/geotrek-admin RUN mkdir -p /opt/geotrek-admin/var/log /opt/geotrek-admin/var/cache -RUN adduser geotrek --disabled-password && chown geotrek:geotrek -R /opt +RUN useradd -M -s /bin/false geotrek && chown geotrek:geotrek -R /opt # Install postgis because raster2pgsl is required by manage.py loaddem RUN apt-get update -qq && apt-get install -y -qq \ From ba1d1ff30e58fb4901b966b144110dc6e978e446 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:55:42 +0200 Subject: [PATCH 21/46] fix docker image --- docker/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5b681504dd..9b5c6c516f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -27,7 +27,6 @@ RUN apt-get update -qq && apt-get install -y -qq \ gettext \ postgresql-client \ tzdata \ - netcat \ gdal-bin \ binutils \ libproj-dev \ @@ -44,8 +43,6 @@ RUN apt-get update -qq && apt-get install -y -qq \ libfreetype6-dev \ libxml2-dev \ libxslt-dev \ - libcairo2 \ - libpango1.0-0 \ libpangocairo-1.0-0 \ libgdk-pixbuf2.0-dev \ libffi-dev \ From 005cee7ca43b6c8a7fa1266aad918e4a11a4736a Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 11:59:50 +0200 Subject: [PATCH 22/46] fix ci --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed18a212b5..fdd522e8c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -220,8 +220,8 @@ jobs: - uses: actions/checkout@v4 - name: Prepare versioning run: | - grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' VERSION || sed -i 's/+dev/.ubuntu$CODE~dev'$GITHUB_RUN_ID'/' debian/changelog - sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu$CODE\2) $OS;/' debian/changelog + grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' VERSION || sed -i 's/+dev/.ubuntu'$CODE'~dev'$GITHUB_RUN_ID'/' debian/changelog + sed -i 's/geotrek-admin (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/geotrek-admin (\1.ubuntu'$CODE'\2) $OS;/' debian/changelog - name: Building package run: | From f7d0a09b9e1114a23765af3e59b14973fc091acc Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 12:16:01 +0200 Subject: [PATCH 23/46] fix ci --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index d59b80bdad..6394839dd1 100755 --- a/debian/rules +++ b/debian/rules @@ -8,6 +8,7 @@ export DH_VIRTUALENV_INSTALL_ROOT=/opt override_dh_virtualenv: dh_virtualenv \ --python /usr/bin/python3.8 \ + --upgrade-pip \ --preinstall wheel \ --preinstall setuptools==69.2.0 \ --builtin-venv \ From 8f0966c61bb78c6a0ed4573e8a4aa54475d62ee0 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 13:08:00 +0200 Subject: [PATCH 24/46] use only 3.10 --- .github/workflows/test.yml | 8 +++----- docker/Dockerfile | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fdd522e8c8..b11c356707 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -209,8 +209,7 @@ jobs: code: '20.04' - os: 'jammy' code: '22.04' - - os: 'noble' - code: '24.04' + env: OS: ${{ matrix.os }} CODE: ${{ matrix.code }} @@ -235,7 +234,6 @@ jobs: path: | /home/runner/work/Geotrek-admin/*.deb - e2e_docker_image: name: Tests E2E docker runs-on: ubuntu-20.04 @@ -410,7 +408,7 @@ jobs: - name: Download 18.04 debian artifact uses: actions/download-artifact@v4 with: - name: debian-18-04 + name: ubuntu:bionic - name: Download 20.04 debian artifact uses: actions/download-artifact@v4 with: @@ -418,7 +416,7 @@ jobs: - name: Download docker image uses: ishworkh/docker-image-artifact-download@v1 with: - image: "geotrek:latest" + image: ubuntu:focal - name: Attach debian packages as release binaries uses: skx/github-action-publish-binaries@master env: diff --git a/docker/Dockerfile b/docker/Dockerfile index 9b5c6c516f..0bf0139a0f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=noble +ARG BASE_IMAGE=jammy FROM ubuntu:${BASE_IMAGE} AS base From a4f70b947533830fe6e4a183018c75a7adcd82ae Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 4 Oct 2024 13:15:35 +0200 Subject: [PATCH 25/46] use only 3.10 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b11c356707..4e74095303 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -201,7 +201,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: ['bionic', 'focal', 'jammy', 'noble'] + os: ['bionic', 'focal', 'jammy'] include: - os: 'bionic' code: '18.04' From 3091e1cb397a0259f7a28b1e1776a3572c2e0cb3 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 7 Oct 2024 10:57:51 +0200 Subject: [PATCH 26/46] use only 3.10 --- .github/workflows/test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e74095303..927e3e56ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -230,7 +230,7 @@ jobs: - name: Archive package artifact uses: actions/upload-artifact@v4 with: - name: $DISTRO + name: ${{ matrix.os }} path: | /home/runner/work/Geotrek-admin/*.deb @@ -343,7 +343,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/download-artifact@v4 with: - name: 'ubuntu:focal' + name: 'focal' - name: Simulate install.sh procedure run: | @@ -398,6 +398,7 @@ jobs: path: | /home/runner/work/Geotrek-admin/Geotrek-admin/cypress/videos/*.mp4 /home/runner/work/Geotrek-admin/Geotrek-admin/cypress/screenshots/*.png + deploy: name: Publish (on release only) runs-on: ubuntu-latest @@ -408,7 +409,7 @@ jobs: - name: Download 18.04 debian artifact uses: actions/download-artifact@v4 with: - name: ubuntu:bionic + name: bionic - name: Download 20.04 debian artifact uses: actions/download-artifact@v4 with: @@ -416,7 +417,7 @@ jobs: - name: Download docker image uses: ishworkh/docker-image-artifact-download@v1 with: - image: ubuntu:focal + image: focal - name: Attach debian packages as release binaries uses: skx/github-action-publish-binaries@master env: From 70a470ca3fb86d8d03a37079103a884551e778bf Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 09:31:17 +0200 Subject: [PATCH 27/46] don't support 3.12 --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 63cd445d3c..f6d5bca241 100644 --- a/debian/control +++ b/debian/control @@ -37,6 +37,6 @@ Depends: screamshotter (>= 2.0.9), screamshotter (<< 3.0.0), convertit, - python3.8 | python3.10 | python3.12, + python3.8 | python3.10, libvips Description: Manage and promote your trails and tourist content and activities. From 5ba9d0d5f85e13ef6644cb1106617ea35241dc60 Mon Sep 17 00:00:00 2001 From: Jean-Etienne Castagnede Date: Tue, 8 Oct 2024 13:31:13 +0200 Subject: [PATCH 28/46] Apply suggestions from code review --- debian/control | 6 +++--- geotrek/settings/env_tests.py | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index f6d5bca241..6e0772b938 100644 --- a/debian/control +++ b/debian/control @@ -10,9 +10,9 @@ Build-Depends: debhelper (>= 9), dh-virtualenv (>= 1.0), git, - python3.8 | python3.10 | python3.12, - python3.8-venv | python3.10-venv | python3.12-venv, - python3.8-dev | python3.10-dev | python3.12-dev, + python3.8 | python3.10, + python3.8-venv | python3.10-venv, + python3.8-dev | python3.10-dev, libgdal-dev (>= 2.2), libffi-dev (>= 3), libxml2-dev (>= 2.9.2), diff --git a/geotrek/settings/env_tests.py b/geotrek/settings/env_tests.py index 600ef924c4..936f27117c 100644 --- a/geotrek/settings/env_tests.py +++ b/geotrek/settings/env_tests.py @@ -75,7 +75,6 @@ def __getitem__(self, item): MOBILE_TILES_PATH = TemporaryDirectory(dir=TMP_DIR).name # sync mobile tile path DATA_TEMP_DIR = TemporaryDirectory(dir=TMP_DIR).name # data temp dir use by django-large-image REDIS_URL = f"redis://{os.getenv('REDIS_HOST', 'localhost')}:{os.getenv('REDIS_PORT', '6379')}/1" # celery broker url -# SESSION_ENGINE = "django.contrib.sessions.backends.file" PASSWORD_HASHERS = [ "django.contrib.auth.hashers.MD5PasswordHasher", ] From badcc9bae3e11a4ddd5c81f043cdb1986022dc49 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 13:54:17 +0200 Subject: [PATCH 29/46] revert bionic tests --- .github/workflows/test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 927e3e56ce..0aeded1aea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,7 +45,7 @@ jobs: strategy: matrix: - os: ['focal-3.8', 'jammy-3.10'] + os: ['bionic-3.8', 'focal-3.8', 'jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -114,7 +114,11 @@ jobs: - name: Install python dependencies run: | - python3 -m venv ./venv + if [[ ${{ matrix.os }} == 'bionic-3.8' ]]; then + python3.8 -m venv ./venv; + else + python3 -m venv ./venv; + fi ./venv/bin/pip3 install --upgrade pip wheel setuptools -c requirements.txt -c dev-requirements.txt ./venv/bin/pip3 install -r requirements.txt -U ./venv/bin/pip3 install -r dev-requirements.txt -U From 59a40bbe1845245927dd39a7898b959c10395aa1 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:03:23 +0200 Subject: [PATCH 30/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0aeded1aea..3c2902148f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ${{ matrix.os }} == 'bionic-3.8' ]]; then + if [[ ${{ matrix.os }} == "bionic-3.8" ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; From 04baff68de650da8e93f13c059303bc64757f210 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:05:43 +0200 Subject: [PATCH 31/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c2902148f..73163b2153 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ${{ matrix.os }} == "bionic-3.8" ]]; then + if [[ ${{ matrix.os }} == bionic-3.8 ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; From 7f1c9e1b16469696a5b7877060d2bea1ddec3c03 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:09:29 +0200 Subject: [PATCH 32/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73163b2153..f78dcfafb7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ${{ matrix.os }} == bionic-3.8 ]]; then + if [[ ""${{ matrix.os }}"" == "bionic-3.8" ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; From 53a88a0775f491c8fdde99086538029fecdfa2e2 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:12:49 +0200 Subject: [PATCH 33/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f78dcfafb7..b7741a9d93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ""${{ matrix.os }}"" == "bionic-3.8" ]]; then + if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; From 27b8fc4074eb8946e09f92ee24ef5b25fe625084 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:19:23 +0200 Subject: [PATCH 34/46] revert bionic tests --- .github/workflows/test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7741a9d93..0674440dbc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,14 +114,13 @@ jobs: - name: Install python dependencies run: | - if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then + if [[ "$OS" == "bionic-3.8" ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; fi - ./venv/bin/pip3 install --upgrade pip wheel setuptools -c requirements.txt -c dev-requirements.txt - ./venv/bin/pip3 install -r requirements.txt -U - ./venv/bin/pip3 install -r dev-requirements.txt -U + ./venv/bin/pip3 install --upgrade pip wheel setuptools pip-tools -c requirements.txt -c dev-requirements.txt + ./venv/bin/pip-sync requirements.txt dev-requirements.txt -U - name: Create test required directories run: | From af1ab8b85419940b56a7c10896fdcbd63d82db2d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:22:20 +0200 Subject: [PATCH 35/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0674440dbc..66b119279c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ "$OS" == "bionic-3.8" ]]; then + if [[ "${OS}" == "bionic-3.8" ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; From f7a2ceeab2c6cb190d8d87f5d78e6ef489b2c6b3 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:25:50 +0200 Subject: [PATCH 36/46] revert bionic tests --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66b119279c..8958cd31cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,13 +114,13 @@ jobs: - name: Install python dependencies run: | - if [[ "${OS}" == "bionic-3.8" ]]; then + if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then python3.8 -m venv ./venv; else python3 -m venv ./venv; fi ./venv/bin/pip3 install --upgrade pip wheel setuptools pip-tools -c requirements.txt -c dev-requirements.txt - ./venv/bin/pip-sync requirements.txt dev-requirements.txt -U + ./venv/bin/pip-sync requirements.txt dev-requirements.txt - name: Create test required directories run: | From 0864cf5ae1f88b23b13fd7bbb125cf69e67de504 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:27:17 +0200 Subject: [PATCH 37/46] revert bionic tests --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8958cd31cf..0a8e9d3325 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -115,6 +115,7 @@ jobs: - name: Install python dependencies run: | if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then + echo "this is bionic !!!"; python3.8 -m venv ./venv; else python3 -m venv ./venv; From 40158607f4619e7e0fcd9de1d0438e7fbc74cc75 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:35:00 +0200 Subject: [PATCH 38/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a8e9d3325..c39110e061 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then + if [[ ${{ matrix.os }} == bionic-3.8 ]]; then echo "this is bionic !!!"; python3.8 -m venv ./venv; else From ec32ad95bea692c57263750363d1657c77c59803 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:35:19 +0200 Subject: [PATCH 39/46] revert bionic tests --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c39110e061..f6d6775235 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -118,6 +118,7 @@ jobs: echo "this is bionic !!!"; python3.8 -m venv ./venv; else + echo "this is not bionic !!!"; python3 -m venv ./venv; fi ./venv/bin/pip3 install --upgrade pip wheel setuptools pip-tools -c requirements.txt -c dev-requirements.txt From 9cfca9a64dd67372a55048201bec25ae3ab3b570 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:38:52 +0200 Subject: [PATCH 40/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f6d6775235..8899d13a33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ${{ matrix.os }} == bionic-3.8 ]]; then + if [[ ${{ matrix.os }} == bionic* ]]; then echo "this is bionic !!!"; python3.8 -m venv ./venv; else From d7e769409b853b6d4b605215ad08e9bd5bc50bd1 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:41:54 +0200 Subject: [PATCH 41/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8899d13a33..69fd02833c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ${{ matrix.os }} == bionic* ]]; then + if [[ "${{ matrix.os }}" == bionic* ]]; then echo "this is bionic !!!"; python3.8 -m venv ./venv; else From d5238166677872c85e2b70b3fcbfa16ec1c123b3 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:47:20 +0200 Subject: [PATCH 42/46] revert bionic tests --- .github/workflows/test.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 69fd02833c..4c9f2ec704 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,13 +114,12 @@ jobs: - name: Install python dependencies run: | - if [[ "${{ matrix.os }}" == bionic* ]]; then - echo "this is bionic !!!"; - python3.8 -m venv ./venv; + if [[ ${{ matrix.os }} == 'bionic-3.8' ]]; then + python3.8 -m venv ./venv else - echo "this is not bionic !!!"; - python3 -m venv ./venv; + python3 -m venv ./venv fi + ./venv/bin/pip3 install --upgrade pip wheel setuptools pip-tools -c requirements.txt -c dev-requirements.txt ./venv/bin/pip-sync requirements.txt dev-requirements.txt From 917c02652b2d0e32450415bd0308856c0945305a Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:51:39 +0200 Subject: [PATCH 43/46] revert bionic tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4c9f2ec704..a13c865cbc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,7 @@ jobs: - name: Install python dependencies run: | - if [[ ${{ matrix.os }} == 'bionic-3.8' ]]; then + if [[ '${{ matrix.os }}' == 'bionic*' ]]; then python3.8 -m venv ./venv else python3 -m venv ./venv From b94a5eadf7614cc41c02a7aff873373aa0d5e5da Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:52:28 +0200 Subject: [PATCH 44/46] revert bionic tests --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a13c865cbc..1a1c1ad147 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,6 +114,11 @@ jobs: - name: Install python dependencies run: | + if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then + echo "This is Bionic with Python 3.8" + else + echo "This is another OS version" + fi if [[ '${{ matrix.os }}' == 'bionic*' ]]; then python3.8 -m venv ./venv else From a0901ea1b5380d25169f1c18cf2b8b4163089db2 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 14:58:16 +0200 Subject: [PATCH 45/46] revert bionic tests --- .github/workflows/test.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a1c1ad147..8b31e266f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -112,19 +112,18 @@ jobs: libvips apt-get install -y --no-install-recommends postgis - - name: Install python dependencies + - name: Install python venv for bionic + if: ${{ matrix.os == 'bionic-3.8'}} run: | - if [[ "${{ matrix.os }}" == "bionic-3.8" ]]; then - echo "This is Bionic with Python 3.8" - else - echo "This is another OS version" - fi - if [[ '${{ matrix.os }}' == 'bionic*' ]]; then python3.8 -m venv ./venv - else + + - name: Install python venv + if: ${{ matrix.os != 'bionic-3.8'}} + run: | python3 -m venv ./venv - fi + - name: Install python dependencies + run: | ./venv/bin/pip3 install --upgrade pip wheel setuptools pip-tools -c requirements.txt -c dev-requirements.txt ./venv/bin/pip-sync requirements.txt dev-requirements.txt From f6209934d71c7013feca5863defa5f8a3a22a049 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 8 Oct 2024 15:06:50 +0200 Subject: [PATCH 46/46] revert bionic tests --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b31e266f9..ac063ea7d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -156,6 +156,7 @@ jobs: ./venv/bin/coverage xml -o coverage.xml - name: Save coverage + if: ${{ matrix.os != 'bionic-3.8'}} uses: actions/upload-artifact@v4 with: name: coverage_${{ matrix.os }}_${{ matrix.tests-env }}