Skip to content
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

Run Django checks (inc. missing migrations) as part of CI #7558

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ matrix:
- { python: "3.8", env: TOXENV=base }
- { python: "3.8", env: TOXENV=lint }
- { python: "3.8", env: TOXENV=docs }
- { python: "3.8", env: TOXENV=checks }

- python: "3.8"
env: TOXENV=dist
Expand Down
29 changes: 29 additions & 0 deletions runchecks.py
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ deps =
-rrequirements/requirements-codestyle.txt
-rrequirements/requirements-testing.txt

[testenv:checks]
commands =
./runchecks.py

[testenv:docs]
skip_install = true
commands = mkdocs build
Expand Down