[ci] Add support for Github Actions
This runs the tests for different python versions, with different working sets, and also run a linter.
This commit is contained in:
parent
bef217bd3c
commit
51c3ee3ce4
7 changed files with 130 additions and 22 deletions
69
.github/workflows/test-docs.yml
vendored
Normal file
69
.github/workflows/test-docs.yml
vendored
Normal file
|
@ -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
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -4,10 +4,12 @@ umap/settings/local/*
|
||||||
docs/_build
|
docs/_build
|
||||||
umap/remote_static
|
umap/remote_static
|
||||||
tmp/*
|
tmp/*
|
||||||
node_modules/*
|
|
||||||
umap/static/umap/vendors
|
umap/static/umap/vendors
|
||||||
site/*
|
site/*
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
|
node_modules
|
||||||
|
umap.conf
|
||||||
|
data
|
||||||
|
|
||||||
### Python ###
|
### Python ###
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
|
|
24
Makefile
24
Makefile
|
@ -10,13 +10,21 @@ develop: ## Install the test and dev dependencies
|
||||||
python3 -m pip install -e .[test,dev]
|
python3 -m pip install -e .[test,dev]
|
||||||
playwright install
|
playwright install
|
||||||
|
|
||||||
.PHONY: pretty-templates
|
.PHONY: format
|
||||||
pretty-templates: ## Prettify template files
|
format: ## Format the code and templates files
|
||||||
djlint umap/templates --reformat
|
djlint umap/templates --reformat &&\
|
||||||
|
isort --profile black . &&\
|
||||||
|
ruff format --target-version=py38 .
|
||||||
|
|
||||||
.PHONY: lint-templates
|
.PHONY: lint
|
||||||
lint-templates: ## Lint template files
|
lint: ## Lint the code and template files
|
||||||
djlint umap/templates --lint
|
djlint umap/templates --lint &&\
|
||||||
|
isort --check --profile black . &&\
|
||||||
|
ruff format --check --target-version=py38 . &&\
|
||||||
|
vermin --no-tips --violations -t=3.8- .
|
||||||
|
|
||||||
|
docs: ## Compile the docs
|
||||||
|
mkdocs build
|
||||||
|
|
||||||
.PHONY: version
|
.PHONY: version
|
||||||
version: ## Display the current version
|
version: ## Display the current version
|
||||||
|
@ -47,10 +55,10 @@ publish: ## Publish the Python package to Pypi
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
test:
|
test:
|
||||||
py.test -xv umap/tests/
|
pytest -xv umap/tests/
|
||||||
|
|
||||||
test-integration:
|
test-integration:
|
||||||
py.test -xv umap/tests/integration/
|
pytest -xv umap/tests/integration/
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f dist/*
|
rm -f dist/*
|
||||||
|
|
25
package-lock.json
generated
25
package-lock.json
generated
|
@ -10,6 +10,7 @@
|
||||||
"license": "WTFPL",
|
"license": "WTFPL",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tmcw/togeojson": "^5.8.0",
|
"@tmcw/togeojson": "^5.8.0",
|
||||||
|
"colorbrewer": "^1.5.6",
|
||||||
"csv2geojson": "5.1.1",
|
"csv2geojson": "5.1.1",
|
||||||
"dompurify": "^3.0.3",
|
"dompurify": "^3.0.3",
|
||||||
"georsstogeojson": "^0.1.0",
|
"georsstogeojson": "^0.1.0",
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
"leaflet.path.drag": "0.0.6",
|
"leaflet.path.drag": "0.0.6",
|
||||||
"leaflet.photon": "0.8.0",
|
"leaflet.photon": "0.8.0",
|
||||||
"osmtogeojson": "^3.0.0-beta.3",
|
"osmtogeojson": "^3.0.0-beta.3",
|
||||||
|
"simple-statistics": "^7.8.3",
|
||||||
"togpx": "^0.5.4",
|
"togpx": "^0.5.4",
|
||||||
"tokml": "0.4.0"
|
"tokml": "0.4.0"
|
||||||
},
|
},
|
||||||
|
@ -494,6 +496,11 @@
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/colorbrewer": {
|
||||||
|
"version": "1.5.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/colorbrewer/-/colorbrewer-1.5.6.tgz",
|
||||||
|
"integrity": "sha512-fONg2pGXyID8zNgKHBlagW8sb/AMShGzj4rRJfz5biZ7iuHQZYquSCLE/Co1oSQFmt/vvwjyezJCejQl7FG/tg=="
|
||||||
|
},
|
||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
@ -2122,6 +2129,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
||||||
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
|
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
|
||||||
},
|
},
|
||||||
|
"node_modules/simple-statistics": {
|
||||||
|
"version": "7.8.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/simple-statistics/-/simple-statistics-7.8.3.tgz",
|
||||||
|
"integrity": "sha512-JFvMY00t6SBGtwMuJ+nqgsx9ylkMiJ5JlK9bkj8AdvniIe5615wWQYkKHXe84XtSuc40G/tlrPu0A5/NlJvv8A==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/sinon": {
|
"node_modules/sinon": {
|
||||||
"version": "15.1.0",
|
"version": "15.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.1.0.tgz",
|
||||||
|
@ -2898,6 +2913,11 @@
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"colorbrewer": {
|
||||||
|
"version": "1.5.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/colorbrewer/-/colorbrewer-1.5.6.tgz",
|
||||||
|
"integrity": "sha512-fONg2pGXyID8zNgKHBlagW8sb/AMShGzj4rRJfz5biZ7iuHQZYquSCLE/Co1oSQFmt/vvwjyezJCejQl7FG/tg=="
|
||||||
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
@ -4143,6 +4163,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
||||||
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
|
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
|
||||||
},
|
},
|
||||||
|
"simple-statistics": {
|
||||||
|
"version": "7.8.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/simple-statistics/-/simple-statistics-7.8.3.tgz",
|
||||||
|
"integrity": "sha512-JFvMY00t6SBGtwMuJ+nqgsx9ylkMiJ5JlK9bkj8AdvniIe5615wWQYkKHXe84XtSuc40G/tlrPu0A5/NlJvv8A=="
|
||||||
|
},
|
||||||
"sinon": {
|
"sinon": {
|
||||||
"version": "15.1.0",
|
"version": "15.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.1.0.tgz",
|
||||||
|
|
|
@ -23,13 +23,11 @@ classifiers = [
|
||||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
"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.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Django>=4.1",
|
"Django>=4.1",
|
||||||
|
@ -47,16 +45,20 @@ dependencies = [
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
"hatch==1.7.0",
|
"hatch==1.7.0",
|
||||||
"black==23.3.0",
|
"ruff==0.1.6",
|
||||||
"djlint==1.31.0",
|
"djlint==1.31.0",
|
||||||
"mkdocs==1.5.2",
|
"mkdocs==1.5.2",
|
||||||
|
"vermin==1.5.2",
|
||||||
|
"pymdown-extensions==10.4",
|
||||||
|
"isort==5.12",
|
||||||
]
|
]
|
||||||
test = [
|
test = [
|
||||||
"factory-boy==3.2.1",
|
"factory-boy==3.2.1",
|
||||||
"playwright==1.38.0",
|
"playwright>=1.39,<2",
|
||||||
"pytest==6.2.5",
|
"pytest==6.2.5",
|
||||||
"pytest-django==4.5.2",
|
"pytest-django==4.5.2",
|
||||||
"pytest-playwright==0.4.2",
|
"pytest-playwright>=0.4.3,<1",
|
||||||
|
"pytest-xdist>=3.5.0,<4",
|
||||||
|
|
||||||
]
|
]
|
||||||
docker = [
|
docker = [
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[pytest]
|
[pytest]
|
||||||
DJANGO_SETTINGS_MODULE=umap.tests.settings
|
DJANGO_SETTINGS_MODULE=umap.tests.settings
|
||||||
addopts = --pdbcls=IPython.terminal.debugger:Pdb --no-migrations
|
addopts = --pdbcls=IPython.terminal.debugger:Pdb --no-migrations --numprocesses auto
|
||||||
|
|
|
@ -5,15 +5,17 @@ from umap.settings.base import * # pylint: disable=W0614,W0401
|
||||||
SECRET_KEY = "justfortests"
|
SECRET_KEY = "justfortests"
|
||||||
COMPRESS_ENABLED = False
|
COMPRESS_ENABLED = False
|
||||||
FROM_EMAIL = "test@test.org"
|
FROM_EMAIL = "test@test.org"
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
|
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||||
|
|
||||||
if "TRAVIS" in os.environ:
|
if os.environ.get("GITHUB_ACTIONS", False) == "true":
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.contrib.gis.db.backends.postgis",
|
"ENGINE": "django.contrib.gis.db.backends.postgis",
|
||||||
"NAME": "umap",
|
"NAME": "postgres",
|
||||||
"PORT": 5433,
|
"USER": "postgres",
|
||||||
"USER": "travis",
|
"HOST": "localhost",
|
||||||
|
"PORT": 5432,
|
||||||
|
"PASSWORD": "postgres",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue