-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1413 from umap-project/almet/ci
- Loading branch information
Showing
47 changed files
with
595 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.