Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/pytz-2024.2
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos authored Nov 28, 2024
2 parents 3a7107c + 76d225d commit 73f67b2
Show file tree
Hide file tree
Showing 16 changed files with 218 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ 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
flake8:
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
Expand Down
64 changes: 42 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
push:
branches:
- master

paths-ignore:
- 'docs/**'
release:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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 }}
Expand Down
11 changes: 11 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
72 changes: 41 additions & 31 deletions geotrek/api/templates/mobile/sync_mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
});
Expand All @@ -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'),
Expand All @@ -87,33 +88,42 @@

window.setInterval(function(){
get_sync_infos();
}, 500);
}, 1000);
});
</script>
<link rel="stylesheet" href="{% static 'trekking/css/sync_trek.css' %}" />
<link rel="stylesheet" href="{% static 'common/css/sync.css' %}" />
{% endblock extrahead %}

{% block toolbar %}
{% endblock toolbar %}

{% block mainpanel %}

<div id="sync-div" class="col-12 col-sm-3">
<h3>{% trans "Mobile sync" %}</h3>
<div class="progress progress-striped active">
<div id="progress-value" class="bar" style="width: 0%;"></div>
<span id="progress-text"></span>
</div>
{% block mainform %}
{% crispy form form.helper %}
{% endblock mainform %}
<div id="sync-div" class="col-12 col-md-6 offset-md-3">
<div class="card">
<div class="card-header">
<h3>{% trans "Mobile sync" %}</h3>
</div>

<div class="card-body">
<div class="progress">
<div class="progress-bar progress-bar-striped" style="width: 0;" id="progress-bar" role="progressbar"></div>
</div>
<div id="exception-message" style="display: none;" class="alert alert-danger">
</div>
</div>
<div class="card-footer">
{% block mainform %}
{% crispy form form.helper %}
{% endblock mainform %}
</div>
</div>
</div>

<div id="exception-message" style="display: none;">
</div>

<div class="modal fade" id="confirm-submit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<!-- boostrap 2 modal confirmation -->
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand Down
2 changes: 0 additions & 2 deletions geotrek/common/static/common/css/import.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
}

#progress-bars div.alert {
margin-left: 45px;
display: none;
}

#progress-bars div.description {
margin-left: 45px;
}

#progress-bars span.parser{
Expand Down
File renamed without changes.
Loading

0 comments on commit 73f67b2

Please sign in to comment.