Skip to content

Commit

Permalink
Merge branch 'master' into 285-prepare-yearly-report
Browse files Browse the repository at this point in the history
  • Loading branch information
why-not-try-calmer authored Nov 17, 2023
2 parents 6515f2c + c083d2e commit e669965
Show file tree
Hide file tree
Showing 66 changed files with 2,574 additions and 2,197 deletions.
57 changes: 31 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
name: Docker
name: Lint, Check, Build, Test

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- '*'

pull_request:
branches:
- master
pull_request:

jobs:
test:
name: Test
runs-on: ubuntu-20.04

build_package_lint_check:
name: Build, package, lint, check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Install requirements
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- name: Setup, build, install
run: |
pip3 install -r requirements.txt
pip install build
python -m build .
pip install ./dist/comptages-0.1-py3-none-any.whl[check]
- name: Package
run: qgis-plugin-ci package 'test'
- name: Lint
run: black . --check

- name: Install QGIS
run: |
sudo apt update && sudo apt install -y qgis
# - name: Check
# run: pyright .

test:
name: Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Start docker stack
run: docker-compose up --build -d

- name: Wait a little bit
run: sleep 5

- name: Running migrations
run: python manage.py migrate

run: docker compose up db -d
- name: Running tests
run: |
python manage.py test comptages.test -v2
run: docker compose run qgis_tester
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ comptages/__pycache__/
.docker/tests/
.docker/tests/screenshot.png
.env
.vscode/settings.json
shell.nix
Pipfile
5 changes: 5 additions & 0 deletions Dockerfile-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM opengisch/qgis:3.28.0-jammy
RUN apt update && apt install iputils-ping glibc-tools libpq-dev python3-pip -y
COPY requirements.txt .
RUN pip3 install -r requirements.txt
WORKDIR /OpenComptage
11 changes: 6 additions & 5 deletions comptages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def prepare_django(default_db=None, **additional_settings):
# (i.e. the command is lauched from the QGIS python console), we
# use the one in the plugin settings
if not default_db:

from comptages.core.settings import Settings as PluginSettings

plugin_settings = PluginSettings()
default_db = {
"ENGINE": "django.contrib.gis.db.backends.postgis",
Expand All @@ -40,12 +40,12 @@ def prepare_django(default_db=None, **additional_settings):
additional_settings["SPATIALITE_LIBRARY_PATH"] = SPATIALITE_LIBRARY_PATH_ENV

django_settings.configure(
BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir),
BASE_DIR=os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir),
DATABASES={"default": default_db},
INSTALLED_APPS=('comptages.datamodel.apps.ComptagesConfig',),
INSTALLED_APPS=("comptages.datamodel.apps.ComptagesConfig",),
USE_TZ=True,
TIME_ZONE='Europe/Zurich',
SECRET_KEY='09n+dhzh+02+_#$!1+8h-&(s-wbda#0*2mrv@lx*y#&fzlv&l)',
TIME_ZONE="Europe/Zurich",
SECRET_KEY="09n+dhzh+02+_#$!1+8h-&(s-wbda#0*2mrv@lx*y#&fzlv&l)",
**additional_settings
)
django.setup()
Expand All @@ -59,4 +59,5 @@ def classFactory(iface):
"""
prepare_django()
from .comptages import Comptages

return Comptages(iface)
Loading

0 comments on commit e669965

Please sign in to comment.