mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Add a system check on CI to catch missing migrations
This commit is contained in:
parent
0e5316505b
commit
bed5c802df
|
@ -27,6 +27,7 @@ matrix:
|
||||||
- { python: "3.8", env: TOXENV=base }
|
- { python: "3.8", env: TOXENV=base }
|
||||||
- { python: "3.8", env: TOXENV=lint }
|
- { python: "3.8", env: TOXENV=lint }
|
||||||
- { python: "3.8", env: TOXENV=docs }
|
- { python: "3.8", env: TOXENV=docs }
|
||||||
|
- { python: "3.8", env: TOXENV=checks }
|
||||||
|
|
||||||
- python: "3.8"
|
- python: "3.8"
|
||||||
env: TOXENV=dist
|
env: TOXENV=dist
|
||||||
|
|
29
runchecks.py
Executable file
29
runchecks.py
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Basic script used to run django-admin checks in CI/tox."""
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
# Minimal settings required to check for migrations
|
||||||
|
settings.configure(
|
||||||
|
SECRET_KEY = "not very secret in checks either",
|
||||||
|
DATABASES = {
|
||||||
|
"default": {
|
||||||
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
|
"NAME": ":memory:"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
"rest_framework.authtoken"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
print("Running basic Django system checks")
|
||||||
|
execute_from_command_line(["manage.py", "check"])
|
||||||
|
|
||||||
|
print("Checking for missing Django migrations")
|
||||||
|
execute_from_command_line(["manage.py", "makemigrations", "--dry-run", "--verbosity=3", "--check"])
|
4
tox.ini
4
tox.ini
|
@ -46,6 +46,10 @@ deps =
|
||||||
-rrequirements/requirements-codestyle.txt
|
-rrequirements/requirements-codestyle.txt
|
||||||
-rrequirements/requirements-testing.txt
|
-rrequirements/requirements-testing.txt
|
||||||
|
|
||||||
|
[testenv:checks]
|
||||||
|
commands =
|
||||||
|
./runchecks.py
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
skip_install = true
|
skip_install = true
|
||||||
commands = mkdocs build
|
commands = mkdocs build
|
||||||
|
|
Loading…
Reference in New Issue
Block a user