diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 3fbe11e265..f7dfe99190 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -22,7 +22,7 @@ jobs: python-version: ['3.8'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: ./.github/actions/python-cache-requirements diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 72ec66ce47..fd520b4ad0 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -21,7 +21,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/python-cache-requirements with: requirements: docs/requirements.txt diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 758254c7f1..327c4f9311 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: name: Checking SRID in migrations files runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | test $(ls geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID | wc -l) -eq 0 @@ -24,7 +24,7 @@ jobs: name: Checking Flake8 rules runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/python-cache-requirements with: requirements: dev-requirements.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 462145d8eb..507089e266 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ on: push: branches: - master + paths-ignore: - 'docs/**' release: @@ -42,10 +43,13 @@ jobs: name: Python Unittests runs-on: ubuntu-latest container: makinacorpus/geodjango:${{ matrix.os }} + + permissions: + packages: write # required to publish docker image strategy: matrix: - os: ['bionic-3.8', 'focal-3.8', 'jammy-3.10'] + os: ['focal-3.8', 'jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -72,8 +76,8 @@ jobs: - 6379:6379 steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: | ./venv @@ -114,13 +118,7 @@ jobs: libvips apt-get install -y --no-install-recommends postgis - - name: Install python venv for bionic - if: ${{ matrix.os == 'bionic-3.8'}} - run: | - python3.8 -m venv ./venv - - name: Install python venv - if: ${{ matrix.os != 'bionic-3.8'}} run: | python3 -m venv ./venv @@ -158,7 +156,6 @@ 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 }} @@ -426,16 +423,18 @@ jobs: name: Publish (on release only) runs-on: ubuntu-latest needs: [ test, e2e_docker_image, build_deb, e2e_deb_20_04 ] - if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + if: ${{ github.event_name != 'pull_request' }} steps: - uses: actions/checkout@v4 - name: Download 18.04 debian artifact uses: actions/download-artifact@v4 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} with: name: bionic - name: Download 20.04 debian artifact uses: actions/download-artifact@v4 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} with: name: focal @@ -450,25 +449,44 @@ jobs: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Publish Docker image (v2 and latest) - run: | - if [[ "${{ github.ref }}" == *"dev"* ]]; then - export DOCKER_TAG=dev - else - docker tag geotrek:latest geotrekce/admin:$(cat VERSION) - docker push geotrekce/admin:$(cat VERSION) - export DOCKER_TAG=latest - fi - docker tag geotrek:latest geotrekce/admin:$DOCKER_TAG - docker push geotrekce/admin:$DOCKER_TAG + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + geotrekce/admin + ghcr.io/geotrekce/geotrek-admin + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + push: true + provenance: mode=max + sbom: true + builder: ${{ steps.buildx.outputs.name }} + tags: ${{ steps.meta.outputs.tags }} + file: ./docker/Dockerfile - name: Install SSH key uses: shimataro/ssh-key-action@v2 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} with: key: ${{ secrets.SSH_PRIVATE_KEY }} known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} - name: Publish debian packages + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} run: | if [[ "${{ github.ref }}" == *"dev"* ]]; then export DEB_COMPONENT=dev @@ -486,11 +504,13 @@ jobs: fi - name: Download 22.04 debian artifact + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} uses: actions/download-artifact@v4 with: name: jammy - name: Attach debian packages as release binaries + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} uses: skx/github-action-publish-binaries@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 8620518639..a54e197eed 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,17 @@ ARG BASE_IMAGE=jammy FROM ubuntu:${BASE_IMAGE} AS base +# add labels +LABEL org.opencontainers.image.authors="Makina Corpus" +LABEL org.opencontainers.image.source="https://github.com/GeotrekCE/Geotrek-admin/" +LABEL org.opencontainers.image.documentation="https://geotrek.readthedocs.io/" +LABEL org.opencontainers.image.vendor="Makina Corpus" +LABEL org.opencontainers.image.licenses="BSD-2-Clause" +LABEL org.opencontainers.image.url="https://geotrek.fr" +LABEL org.opencontainers.image.title="Geotrek-admin" +LABEL org.opencontainers.image.description="Manage and promote your trails and tourist content and activities." + + ENV PYTHONBUFFERED=1 ENV DEBIAN_FRONTEND=noninteractive ENV ENV=prod diff --git a/docs/changelog.rst b/docs/changelog.rst index 35f3e095f4..06f38eb866 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,6 +8,8 @@ CHANGELOG **Improvements** - Remove overriding of SchemaRandonneeParser's filetype_name attribute (#4022) +- Improve sync mobile and import views with current bootstrap style. +- Docker image is now mirrored on github registry **Bug fixes** @@ -950,7 +952,7 @@ In preparation for HD Views developments (PR #3298) !!!! Clear cache after update. You can do this by going to admin panel, "clearcache" section, then delete default / fat and api_v2 !!!! -**Improvements** +**Improvments** - Cache API v2 Detail endpoints and themes list endpoint - Sensitive areas are now computed with buffered geometries with settings SENSITIVE_AREA_INTERSECTION_MARGIN. Use ST_INTERSECTS on it is faster. diff --git a/docs/requirements.txt b/docs/requirements.txt index aa6c7d7239..389ddfac2b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -82,7 +82,7 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -tornado==6.4.1 +tornado==6.4.2 # via livereload typing-extensions==4.12.2 # via diff --git a/geotrek/api/templates/mobile/sync_mobile.html b/geotrek/api/templates/mobile/sync_mobile.html index f689781660..9b6425e0dd 100644 --- a/geotrek/api/templates/mobile/sync_mobile.html +++ b/geotrek/api/templates/mobile/sync_mobile.html @@ -32,29 +32,29 @@ has_progress = true; disable_sync_button(false); - $('#progress-value').show(); - $("#progress-value").removeClass('bar-danger'); - $("#progress-value").parent().addClass("active"); + $("#progress-bar").removeClass('bg-danger'); + $("#progress-bar").parent().addClass("active"); if (this.result.current) { - $("#progress-value").css("width", this.result.current+'%'); + $("#progress-bar").css("width", this.result.current + '%'); - if (this.result.current == 100){ - $("#progress-value").parent().removeClass("active"); - $("#progress-value").addClass('bar-success'); - } + if (this.result.current == 100) { + $("#progress-bar").parent().removeClass("active"); + $("#progress-bar").addClass('bg-success'); + } } if (this.result.infos) { - $("#progress-text").text(this.result.infos); - } + $("#progress-bar").text(this.result.infos); + } } else { if (this.status == 'FAILURE'){ // case of exception in task - $("#progress-text").text("{% trans 'An error occured' %}"); - $('#exception-message').text(this.result.exc_type + ' : ' + this.result.exc_message) - $("#progress-value").addClass('bar-danger'); - $("#progress-value").parent().removeClass("active"); + $("#progress-bar").text("{% trans 'An error occured' %}"); + $('#exception-message').text(this.result.exc_type + ' : ' + this.result.exc_message) + $('#exception-message').show(); + $("#progress-bar").addClass('bg-danger'); + $("#progress-value").parent().removeClass("active"); } } }); @@ -70,11 +70,12 @@ get_sync_infos(); $('#btn-confirm')[0].addEventListener('click', function(evt) { - $("#progress-value").css("width", '0%'); - $("#progress-text").text(''); - $("#progress-value").parent().addClass("active"); - $("#progress-value").removeClass('bar-success'); - $("#progress-value").removeClass('bar-danger'); + $('#exception-message').hide(); + $("#progress-bar").css("width", '0%'); + $("#progress-bar").text(''); + $("#progress-bar").parent().addClass("active"); + $("#progress-bar").removeClass('bg-success'); + $("#progress-bar").removeClass('bg-danger'); $.post( $('#form-sync').attr('action'), @@ -87,10 +88,10 @@ window.setInterval(function(){ get_sync_infos(); - }, 500); + }, 1000); }); - + {% endblock extrahead %} {% block toolbar %} @@ -98,22 +99,31 @@ {% block mainpanel %} -
-

{% trans "Mobile sync" %}

-
-
- -
- {% block mainform %} - {% crispy form form.helper %} - {% endblock mainform %} +
+
+
+

{% trans "Mobile sync" %}

+
+ +
+
+
+
+ +
+ +