Run unit tests in CI
This commit is contained in:
parent
1af6e7cab6
commit
84b9788a55
2 changed files with 19 additions and 1 deletions
10
.build.yml
10
.build.yml
|
@ -1,13 +1,23 @@
|
|||
image: archlinux
|
||||
packages:
|
||||
- docker
|
||||
- python-pip
|
||||
- python-virtualenv
|
||||
sources:
|
||||
- https://git.sr.ht/~crocmagnon/blog
|
||||
secrets:
|
||||
- 2da6ddc6-3d12-4306-a1e4-8268c6194386
|
||||
- 29bc352f-0807-46e9-a4ef-2f869f94afa3
|
||||
- 5c948915-48c2-4542-8fc1-a5676f4d7126
|
||||
environment:
|
||||
TESTING: true
|
||||
tasks:
|
||||
- test: |
|
||||
python --version
|
||||
cd blog
|
||||
virtualenv venv
|
||||
venv/bin/python -m pip install -r requirements.txt -r requirements-dev.txt --progress-bar off
|
||||
venv/bin/python -m pytest
|
||||
- setup_docker: |
|
||||
chmod +x ./blog/docker/setup-docker
|
||||
./blog/docker/setup-docker
|
||||
|
|
|
@ -26,6 +26,7 @@ SECRET_KEY = os.getenv(
|
|||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = os.getenv("DEBUG", "true").lower() == "true"
|
||||
TESTING = os.getenv("TESTING", "true").lower() == "true"
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
"localhost",
|
||||
|
@ -130,7 +131,14 @@ USE_TZ = True
|
|||
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = BASE_DIR / "static"
|
||||
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
|
||||
if TESTING:
|
||||
# ManifestStaticFilesStorage requires collectstatic to be run
|
||||
# and collectstatic is not run for tests
|
||||
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
|
||||
else:
|
||||
STATICFILES_STORAGE = (
|
||||
"django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
|
||||
)
|
||||
|
||||
AUTH_USER_MODEL = "articles.User"
|
||||
|
||||
|
|
Reference in a new issue