-
-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate with Github CI #1413
Integrate with Github CI #1413
Changes from all commits
51c3ee3
1e9406c
35dc1ac
72b0bc4
aff0181
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Test & Docs | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
tests: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgis/postgis:12-2.5 | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
dependencies: [normal, minimal] | ||
database: [postgresql] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: '**/pyproject.toml' | ||
- name: Change dependencies to minimal supported versions | ||
run: sed -i -e '/requires-python/!s/>=/==/g; /requires-python/!s/~=.*==\(.*\)/==\1/g; /requires-python/!s/~=/==/g;' pyproject.toml | ||
if: matrix.dependencies == 'minimal' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install libgdal-dev | ||
python -m pip install --upgrade pip | ||
make develop installjs vendors | ||
- name: run tests | ||
run: make test | ||
env: | ||
DJANGO_SETTINGS_MODULE: 'umap.tests.settings' | ||
UMAP_SETTINGS: 'umap/tests/settings.py' | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install -e .[test,dev] | ||
|
||
- name: Run Lint | ||
run: make lint | ||
|
||
- name: Run Docs | ||
run: make docs |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,14 @@ classifiers = [ | |
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
dependencies = [ | ||
"Django>=4.1", | ||
"Django>=4.2,<5", | ||
"django-agnocomplete==2.2.0", | ||
"django-compressor==4.3.1", | ||
"django-environ==0.10.0", | ||
|
@@ -47,17 +45,20 @@ dependencies = [ | |
[project.optional-dependencies] | ||
dev = [ | ||
"hatch==1.7.0", | ||
"black==23.3.0", | ||
"ruff==0.1.6", | ||
"djlint==1.31.0", | ||
"mkdocs==1.5.2", | ||
"vermin==1.5.2", | ||
"pymdown-extensions==10.4", | ||
"isort==5.12", | ||
] | ||
test = [ | ||
"factory-boy==3.2.1", | ||
"playwright==1.38.0", | ||
"playwright>=1.39,<2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed to be able to support python 3.12. |
||
"pytest==6.2.5", | ||
"pytest-django==4.5.2", | ||
"pytest-playwright==0.4.2", | ||
|
||
"pytest-playwright>=0.4.3,<1", | ||
"pytest-xdist>=3.5.0,<4", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is useful to speedup the tests. |
||
] | ||
docker = [ | ||
"uwsgi==2.0.21", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[pytest] | ||
DJANGO_SETTINGS_MODULE=umap.tests.settings | ||
addopts = --pdbcls=IPython.terminal.debugger:Pdb --no-migrations | ||
addopts = --pdbcls=IPython.terminal.debugger:Pdb --no-migrations --numprocesses auto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
from agnocomplete.core import AgnocompleteModel | ||
from agnocomplete.register import register | ||
from django.conf import settings | ||
from django.contrib.auth import get_user_model | ||
|
||
|
||
from agnocomplete.register import register | ||
from agnocomplete.core import AgnocompleteModel | ||
|
||
|
||
@register | ||
class AutocompleteUser(AgnocompleteModel): | ||
model = get_user_model() | ||
fields = settings.USER_AUTOCOMPLETE_FIELDS | ||
|
||
def item(self, current_item): | ||
data = super().item(current_item) | ||
data['url'] = current_item.get_url() | ||
data["url"] = current_item.get_url() | ||
return data |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
from pathlib import Path | ||
|
||
from django.core.management.base import BaseCommand | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
from django.template.loader import render_to_string | ||
from django.utils.translation import to_locale | ||
|
||
ROOT = Path(settings.PROJECT_DIR) / 'static/umap/locale/' | ||
ROOT = Path(settings.PROJECT_DIR) / "static/umap/locale/" | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
self.verbosity = options['verbosity'] | ||
self.verbosity = options["verbosity"] | ||
for code, name in settings.LANGUAGES: | ||
code = to_locale(code) | ||
if self.verbosity > 0: | ||
print("Processing", name) | ||
path = ROOT / '{code}.json'.format(code=code) | ||
path = ROOT / "{code}.json".format(code=code) | ||
if not path.exists(): | ||
print(path, 'does not exist.', 'Skipping') | ||
print(path, "does not exist.", "Skipping") | ||
else: | ||
with path.open(encoding="utf-8") as f: | ||
if self.verbosity > 1: | ||
print("Found file", path) | ||
self.render(code, f.read()) | ||
|
||
def render(self, code, json): | ||
path = ROOT / '{code}.js'.format(code=code) | ||
path = ROOT / "{code}.js".format(code=code) | ||
with path.open("w", encoding="utf-8") as f: | ||
content = render_to_string('umap/locale.js', { | ||
"locale": json, | ||
"locale_code": code | ||
}) | ||
content = render_to_string( | ||
"umap/locale.js", {"locale": json, "locale_code": code} | ||
) | ||
if self.verbosity > 1: | ||
print("Exporting to", path) | ||
f.write(content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test suite fails otherwise with Django 4.1 (see #1426)