mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-04 12:51:50 +02:00
ci: Test sql migrations with sqlite backend
This commit is contained in:
parent
41118fda23
commit
7c2a426404
2 changed files with 20 additions and 1 deletions
|
@ -6,6 +6,7 @@ tests:
|
|||
image: python:3.11
|
||||
variables:
|
||||
DJANGO_SETTINGS_MODULE: "la_chariotte.settings"
|
||||
DB_ENGINE: "django.db.backends.postgresql"
|
||||
DB_NAME: "postgres"
|
||||
DB_USER: "postgres"
|
||||
DB_PASSWORD: "mysecretpassword"
|
||||
|
@ -30,3 +31,21 @@ tests:
|
|||
- git fetch origin develop ; diff-cover coverage.xml --fail-under=90 --compare-branch origin/develop --diff-range-notation '..'
|
||||
- echo "Tests done."
|
||||
|
||||
sqlite:
|
||||
stage: test
|
||||
image: python:3.11
|
||||
variables:
|
||||
DJANGO_SETTINGS_MODULE: "la_chariotte.settings"
|
||||
script:
|
||||
- export CACHE_PATH="/venvs/${CI_PROJECT_NAME}/$(date +week-%V-%Y)"
|
||||
- if [[ "$CI_COMMIT_BRANCH" == *"--no-cache"* ]] ; then export CACHE_PATH="/venvs/$CI_COMMIT_SHORT_SHA"; fi
|
||||
- echo "Creating virtual env..."
|
||||
- if [ ! -d $CACHE_PATH/venv ] ; then python3.11 -m venv $CACHE_PATH/venv ; fi
|
||||
- $CACHE_PATH/venv/bin/pip install --upgrade pip
|
||||
- echo "Virtual env created."
|
||||
- echo "Checking database migrations with sqlite..."
|
||||
- source $CACHE_PATH/venv/bin/activate
|
||||
- pip cache purge
|
||||
- pip install -e ".[dev]"
|
||||
- python3 manage.py migrate
|
||||
- echo "sqlite database migrations successful"
|
||||
|
|
|
@ -85,7 +85,7 @@ WSGI_APPLICATION = "la_chariotte.wsgi.application"
|
|||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"ENGINE": os.getenv("DB_ENGINE", "django.db.backends.sqlite3"),
|
||||
"NAME": os.getenv("DB_NAME", "chariotte.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue