Merge pull request #40 from YunoHost-Apps/dev

Dev
This commit is contained in:
Jens Diemer 2023-04-04 14:28:41 +02:00 committed by GitHub
commit 9edb4d78af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 68 additions and 26 deletions

View file

@ -1,4 +1,4 @@
# see http://editorconfig.org
# see https://editorconfig.org
root = true
[*]
@ -17,4 +17,4 @@ indent_style = tab
insert_final_newline = false
[*.yml]
indent_style = tab
indent_size = 2

View file

@ -1,5 +1,5 @@
#
# Move to pyproject.toml after: https://gitlab.com/pycqa/flake8/-/issues/428
# Move to pyproject.toml after: https://github.com/PyCQA/flake8/issues/234
#
[flake8]
exclude = .*, dist, htmlcov, local_test

View file

@ -1,6 +1,8 @@
name: YunoHost apps package linter
on:
# Allow to manually trigger the workflow
workflow_dispatch:
push:
branches:
- main
@ -12,21 +14,25 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# https://github.com/marketplace/actions/checkout
with:
fetch-depth: 0
- uses: actions/cache@v2
- uses: actions/cache@v3
# https://github.com/marketplace/actions/cache
with:
path: ~/.cache/
key: dot-cache-files
- name: 'Install dependencies'
run: |
pip install toml
- name: 'Clone YunoHost apps package linter'
run: |
git clone --depth=1 https://github.com/YunoHost/package_linter ~/package_linter
- name: 'Install requirements'
run: |
pip3 install toml
- name: 'Run linter'
run: |
~/package_linter/package_linter.py .

View file

@ -1,6 +1,8 @@
name: pytest
on:
# Allow to manually trigger the workflow
workflow_dispatch:
push:
branches:
- master
@ -12,22 +14,29 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python-version: ["3.11", "3.10", "3.9"]
env:
PYTHONUNBUFFERED: 1
PYTHONWARNINGS: always
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# https://github.com/marketplace/actions/checkout
with:
fetch-depth: 0
- name: 'fetch master'
- name: 'fetch master and testing (for Darker/Black)'
run: |
git fetch origin master
git fetch origin testing
- name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v2
with:
python-version: '${{ matrix.python-version }}'
- uses: actions/cache@v2
- uses: actions/cache@v3
# https://github.com/marketplace/actions/cache
with:
path: ~/.cache/
key: dot-cache-files
@ -50,7 +59,8 @@ jobs:
make safety
- name: 'Upload coverage report'
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
# https://github.com/marketplace/actions/codecov
with:
fail_ci_if_error: false
verbose: true

4
.gitignore vendored
View file

@ -3,12 +3,10 @@
!.editorconfig
!.flake8
!.gitignore
!.safety-policy.yml
!/doc/screenshots/.gitkeep
__pycache__
secret.txt
/local_test/
/coverage.json
/coverage.xml
/htmlcov/

View file

@ -34,7 +34,7 @@ This package for YunoHost used [django-yunohost-integration](https://github.com/
More screenshots are here: [jedie.github.io/tree/master/screenshots/django-for-runners](https://github.com/jedie/jedie.github.io/tree/master/screenshots/django-for-runners/README.creole)
**Shipped version:** 0.17.3~ynh2
**Shipped version:** 0.17.3~ynh3
## Screenshots

View file

@ -34,7 +34,7 @@ This package for YunoHost used [django-yunohost-integration](https://github.com/
More screenshots are here: [jedie.github.io/tree/master/screenshots/django-for-runners](https://github.com/jedie/jedie.github.io/tree/master/screenshots/django-for-runners/README.creole)
**Version incluse :** 0.17.3~ynh2
**Version incluse :** 0.17.3~ynh3
## Captures décran

View file

@ -54,15 +54,22 @@ YNH_SETUP_USER = 'setup_user.setup_project_user'
SECRET_KEY = __get_or_create_secret(FINALPATH / 'secret.txt') # /opt/yunohost/$app/secret.txt
if 'axes' not in INSTALLED_APPS:
INSTALLED_APPS.append('axes') # https://github.com/jazzband/django-axes
INSTALLED_APPS.append('django_yunohost_integration.apps.YunohostIntegrationConfig')
MIDDLEWARE.insert(
MIDDLEWARE.index('django.contrib.auth.middleware.AuthenticationMiddleware') + 1,
# login a user via HTTP_REMOTE_USER header from SSOwat:
'django_yunohost_integration.sso_auth.auth_middleware.SSOwatRemoteUserMiddleware',
)
# AxesMiddleware should be the last middleware:
MIDDLEWARE.append('axes.middleware.AxesMiddleware')
if 'axes.middleware.AxesMiddleware' not in MIDDLEWARE:
# AxesMiddleware should be the last middleware:
MIDDLEWARE.append('axes.middleware.AxesMiddleware')
# Keep ModelBackend around for per-user permissions and superuser
AUTHENTICATION_BACKENDS = (

View file

@ -5,7 +5,7 @@
"description": {
"en": "Store your GPX tracks of your running (or other sports activity)"
},
"version": "0.17.3~ynh2",
"version": "0.17.3~ynh3",
"url": "https://github.com/jedie/django-for-runners",
"upstream": {
"license": "GPL-3.0",

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "for_runners_ynh"
version = "0.17.3+ynh2"
version = "0.17.3+ynh3"
description = "YunoHost app package for https://github.com/jedie/django-for-runners"
authors = ["Jens Diemer <git@jensdiemer.de>"]
homepage = "https://github.com/YunoHost-Apps/django-for-runners_ynh"
@ -8,7 +8,7 @@ license = "GPL-3.0-or-later"
readme = 'README.md'
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/YunoHost-Apps/django-for-runners_ynh/issues"
"Bug Tracker" = "https://github.com/jedie/django-for-runners/issues"
[tool.poetry.dependencies]
python = ">=3.9,<4.0.0" # Stay with 3.9 until YunoHost used >=Debian 11 (Bullseye)
@ -149,6 +149,9 @@ initial_revision = "2281f4b"
initial_date = 2023-04-02T17:40:58+02:00
cookiecutter_template = "https://github.com/jedie/cookiecutter_templates/"
cookiecutter_directory = "yunohost_django_package"
applied_migrations = [
"183124a", # 2023-04-04T12:26:15+02:00
]
[manageprojects.cookiecutter_context.cookiecutter]
project_name = "django-for-runners"
@ -157,11 +160,14 @@ github_username = "jedie"
author_email = "git@jensdiemer.de"
upstream_pkg_name = "django_for_runners"
upstream_url = "https://github.com/jedie/django-for-runners"
upstream_pkg_app_name = "for_runners"
upstream_pkg_project_name = "for_runners_project"
ynh_app_pkg_name = "for_runners_ynh"
ynh_app_url = "https://github.com/YunoHost-Apps/django-for-runners_ynh"
bug_tracker_url = "https://github.com/jedie/django-for-runners/issues"
upstream_version = "0.0.1"
ynh_version = "1"
upstream_version = "0.17.3"
ynh_version = "+ynh3"
package_description = "YunoHost app package for https://github.com/jedie/django-for-runners"
license = "GPL-3.0-or-later"
_template = "https://github.com/jedie/cookiecutter_templates/"

View file

@ -3,6 +3,7 @@ import os
import shutil
import subprocess
from pathlib import Path
from unittest import TestCase
try:
@ -140,3 +141,17 @@ def test_check_code_style():
_call_make('lint')
except subprocess.CalledProcessError as err:
raise AssertionError(f'Linting error:\n{"-"*100}\n{err.stdout}\n{"-"*100}')
class ConfigPanelTestCase(TestCase):
def test_config_panel_toml(self):
config_panel_path = PACKAGE_ROOT / 'config_panel.toml'
assert_is_file(config_panel_path)
cfg = tomllib.loads(config_panel_path.read_text(encoding='UTF-8'))
self.assertEqual(cfg['version'], '1.0')
self.assertEqual(
set(cfg['main']['config'].keys()),
{'name', 'default_from_email', 'admin_email', 'debug_enabled', 'log_level'},
)