Skip to content

Commit

Permalink
Merge branch 'master' into biodivsports-public-detail-view
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos authored Feb 1, 2023
2 parents 3b97a2d + d72a2d3 commit 980c0ab
Show file tree
Hide file tree
Showing 275 changed files with 4,713 additions and 826 deletions.
2 changes: 1 addition & 1 deletion .env-dev.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ENV=dev
SERVER_NAME=geotrek.local
SERVER_NAME=geotrek.localhost
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=geotrek
Expand Down
25 changes: 25 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

function dockercompose {
# use docker-compose then fallback to new docker compose
docker-compose "$@"
docker compose "$@"
}

echo "Check dependency graph and fix requirements"

dockercompose run -T --rm web bash -c "pip-compile -q && pip-compile requirements-dev.in"



echo "run Flake8..."

dockercompose run -T --rm web flake8 geotrek
status=$?

if test $status -eq 1
then
exit $status
else
echo "Flake8 check is ok..."
fi
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
ignore:
- dependency-name: "django"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ] # only allow auto update on django bug and security fixes
77 changes: 77 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Check deps

on:
pull_request:
paths:
- setup.py
- requirements.txt
- requirements-dev.in
- requirements-dev.txt
- .github/workflows/dependencies.yml

env:
DEBIAN_FRONTEND: noninteractive

permissions:
contents: write

jobs:
quality:
name: Checking dependency graph
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-20.04']
python-version: ['3.8']

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.wheel_dir
key: pip-${{ matrix.python-version }}
restore-keys: |
pip-${{ matrix.python-version }}
- name: Install dependencies
run: |
pip3 wheel --wheel-dir=~/.wheel_dir pip wheel setuptools
pip3 install --find-links=~/.wheel_dir --upgrade pip wheel setuptools
pip3 wheel --wheel-dir=~/.wheel_dir pip-tools -c requirements-dev.txt
pip3 install --find-links=~/.wheel_dir --upgrade pip-tools -c requirements-dev.txt
- name: Check dependency graph
run: |
pip-compile -q
pip-compile -q requirements-dev.in
- name: Verify dependency graph is ok
uses: tj-actions/verify-changed-files@v13
id: verify-changed-files
with:
files: |
requirements.txt
requirements-dev.txt
- name: Validating graph
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.actor != 'dependabot[bot]'
run: |
echo "Dependency file(s) changed: ${{ steps.verify-changed-files.outputs.changed_files }}"
core.setFailed('Please add your new dependencies in setup.py and/or requirements-dev.in then run pip-compile to add them in requirements. (see docs/contribute/development)')
- name: Dependabot commit dependencies
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.actor == 'dependabot[bot]' }}
with:
commit_message: Apply dependencies update by dependabot
4 changes: 2 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
- name: Documentation
run: |
cd docs/
pip install -r ./requirements.txt
make html
pip install -r ./requirements.txt -U
make html SPHINXOPTS="-W"
43 changes: 31 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
name: Linting

on:
push:
pull_request:
paths:
- 'geotrek/**'
- '.github/workflows/lint.yml'

env:
DEBIAN_FRONTEND: noninteractive

jobs:
flake8:
name: Check code styling
runs-on: ubuntu-18.04
name: Checking Flake8 rules
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-20.04']
python-version: ['3.8']

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- uses: actions/checkout@v3

- name: Not evaluated values in migration files
run: |
test $(ls geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID | wc -l) -eq 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8 # lint with minimal version supported (3.8 in 18.04)
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.wheel_dir
key: pip-${{ matrix.python-version }}
restore-keys: |
pip-${{ matrix.python-version }}
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install flake8
pip3 wheel --wheel-dir=~/.wheel_dir flake8 -c requirements-dev.txt
pip3 install --find-links=~/.wheel_dir --upgrade flake8 -c requirements-dev.txt
- name: Flake8
run: |
flake8 geotrek
- name: Not evaluated values in migration files
run: |
test $(ls geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID | wc -l) -eq 0
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ jobs:
~/.cache/pip
~/.wheel_dir
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
key: pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}
pip-${{ matrix.python-version }}
- name: Install System dependencies
run: |
Expand Down Expand Up @@ -118,9 +118,12 @@ jobs:
- name: Install python dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
pip3 wheel --wheel-dir=~/.wheel_dir pip wheel setuptools
pip3 install --find-links=~/.wheel_dir --upgrade pip wheel setuptools
pip3 wheel --wheel-dir=~/.wheel_dir -r requirements.txt
pip3 wheel --wheel-dir=~/.wheel_dir -r requirements-dev.txt
pip3 install --find-links=~/.wheel_dir -r requirements.txt
pip3 install --find-links=~/.wheel_dir -r requirements-dev.txt
- name: Create test required directories
run: |
Expand Down
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENV CUSTOM_SETTINGS_FILE="/opt/geotrek-admin/var/conf/custom.py"

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
# Install postgis because raster2pgsl is required by manage.py loaddem
RUN apt-get update -qq && apt-get install -y -qq \
unzip \
Expand All @@ -42,16 +42,19 @@ RUN apt-get update -qq && apt-get install -y -qq \
apt-get install -y --no-install-recommends postgis && \
apt-get clean all && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/*

COPY requirements.txt requirements.txt
USER geotrek
RUN python3 -m venv /opt/venv
RUN /opt/venv/bin/pip install -U pip setuptools wheel
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
COPY requirements-dev.txt requirements-dev.txt
RUN /opt/venv/bin/pip install --no-cache-dir -r requirements-dev.txt -U

COPY geotrek/ geotrek/
COPY manage.py manage.py
COPY VERSION VERSION
COPY setup.cfg setup.cfg
COPY docker/* /usr/local/bin/
COPY --chown=geotrek:geotrek geotrek/ geotrek/
COPY --chown=geotrek:geotrek manage.py manage.py
COPY --chown=geotrek:geotrek VERSION VERSION
COPY --chown=geotrek:geotrek setup.cfg setup.cfg
COPY --chown=geotrek:geotrek docker/* /usr/local/bin/

ENTRYPOINT ["/bin/sh", "-e", "/usr/local/bin/entrypoint.sh"]
EXPOSE 8000
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ build-no-cache:
serve:
docker-compose up

deps:
docker-compose run --rm web bash -c "pip-compile -q && pip-compile -q requirements-dev.in"

flake8:
docker-compose run --rm web flake8 geotrek

messages:
docker-compose run --rm web ./manage.py makemessages -a --no-location

Expand Down
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ Documentation
* `Installation and configuration instructions <http://geotrek.readthedocs.org>`_
* Help us translate `on Weblate <https://weblate.makina-corpus.net/>`_


Contribution
------------

* `Contributing guide <https://geotrek.readthedocs.io/en/master/CONTRIBUTING.html>`_
* `Development documentation <https://geotrek.readthedocs.io/en/master/contribute/development.html>`_


License
-------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.94.0+dev
2.96.0+dev
12 changes: 10 additions & 2 deletions conf/nginx.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ server {
access_log /var/log/nginx/geotrek_access.log;
error_log /var/log/nginx/geotrek_error.log;

client_max_body_size 10M;
client_max_body_size 200M;

location /static {
expires 1d;
Expand All @@ -36,7 +36,15 @@ server {
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, OPTIONS";
root /opt/geotrek-admin/var/mobile/;
try_files /$http_accept_language/$1 /nolang/$1 =404;
try_files /${DOLLAR}http_accept_language/$1 /nolang/$1 =404;
gzip on;
gzip_types text/text text/plain text/xml text/css application/x-javascript application/javascript application/json;
include mime.types;
types {
application/json geojson;
application/gpx+xml gpx;
application/x-font-ttf ttf;
}
}

location /media {
Expand Down
2 changes: 1 addition & 1 deletion cypress/cypress.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"fixturesFolder": false,
"fixturesFolder": "fixtures",
"supportFile": "support",
"integrationFolder": "integration",
"pluginsFile": false,
Expand Down
Binary file added cypress/fixtures/images/tile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions cypress/integration/nav_create_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('Create path', () => {
beforeEach(() => {
cy.setCookie('django_language', 'en');
Cypress.Cookies.preserveOnce('sessionid', 'csrftoken');
cy.intercept("https://*.tile.opentopomap.org/*/*/*.png", {fixture: "images/tile.png"})
});

it('Create path', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/nav_create_signage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Create signage', () => {
beforeEach(() => {
cy.setCookie('django_language', 'en');
Cypress.Cookies.preserveOnce('sessionid', 'csrftoken');
cy.intercept("https://*.tile.opentopomap.org/*/*/*.png", {fixture: "images/tile.png"})
});

it('Create signage', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/nav_create_trek.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Create trek', () => {
beforeEach(() => {
Cypress.Cookies.preserveOnce('sessionid', 'csrftoken');
cy.setCookie('django_language', 'en');
cy.intercept("https://*.tile.opentopomap.org/*/*/*.png", {fixture: "images/tile.png"})
});

it('Create trek', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/nav_reports_workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('Nav reports workflow', () => {
beforeEach(() => {
Cypress.Cookies.preserveOnce('sessionid', 'csrftoken');
cy.setCookie('django_language', 'en');
cy.intercept("https://*.tile.opentopomap.org/*/*/*.png", {fixture: "images/tile.png"})
});

it('Handles resolved intervention reports', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/nav_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('Nav tabs properties/attachments', () => {
beforeEach(() => {
Cypress.Cookies.preserveOnce('sessionid', 'csrftoken');
cy.setCookie('django_language', 'en');
cy.intercept("https://*.tile.opentopomap.org/*/*/*.png", {fixture: "images/tile.png"})
});

it('Use tabs', () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/nav_tourism.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('Create tourism event', () => {
beforeEach(() => {
cy.setCookie('django_language', 'en');
Cypress.Cookies.preserveOnce('sessionid', 'csrftoken');
cy.intercept("https://*.tile.opentopomap.org/*/*/*.png", {fixture: "images/tile.png"})
});

it('Should dynamicly show/hide cancellation reason', () => {
Expand Down
18 changes: 15 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
geotrek-admin (2.94.0+dev) UNRELEASED; urgency=medium
geotrek-admin (2.96.0+dev) UNRELEASED; urgency=medium

*
*

-- Marc-Antoine Dupré <[email protected]> Mon, 12 Dec 2022 19:01:52 +0100
-- Timothée de Montety <[email protected]> Wed, 01 Feb 2023 10:01:12 +0100

geotrek-admin (2.96.0) RELEASED; urgency=medium

* New package release

-- Timothée de Montety <[email protected]> Tue, 01 Feb 2023 09:58:52 +0100

geotrek-admin (2.95.0) RELEASED; urgency=medium

* New package release

-- Timothée de Montety <[email protected]> Tue, 24 Jan 2023 11:18:52 +0100

geotrek-admin (2.94.0) RELEASED; urgency=medium

Expand Down
2 changes: 2 additions & 0 deletions debian/dirs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/opt/geotrek-admin/var/conf/extra_static
/opt/geotrek-admin/var/log
/opt/geotrek-admin/var/cache/sessions
/opt/geotrek-admin/var/cache/api_v2
/opt/geotrek-admin/var/cache/fat
/opt/geotrek-admin/var/media/upload
/opt/geotrek-admin/var/pid
/opt/geotrek-admin/var/mobile
Loading

0 comments on commit 980c0ab

Please sign in to comment.