41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
services:
|
|
- postgres:latest
|
|
- redis:latest
|
|
|
|
variables:
|
|
# GestioCOF settings
|
|
DJANGO_SETTINGS_MODULE: "gestioCOF.settings.prod"
|
|
DBHOST: "postgres"
|
|
REDIS_HOST: "redis"
|
|
REDIS_PASSWD: "dummy"
|
|
|
|
# Cached packages
|
|
PYTHONPATH: "$CI_PROJECT_DIR/vendor/python"
|
|
|
|
# postgres service configuration
|
|
POSTGRES_PASSWORD: "4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4"
|
|
POSTGRES_USER: "cof_gestion"
|
|
POSTGRES_DB: "cof_gestion"
|
|
|
|
# psql password authentication
|
|
PGPASSWORD: $POSTGRES_PASSWORD
|
|
|
|
cache:
|
|
paths:
|
|
- vendor/python
|
|
- vendor/pip
|
|
- vendor/apt
|
|
|
|
before_script:
|
|
- mkdir -p vendor/{python,pip,apt}
|
|
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client
|
|
- sed -E 's/^REDIS_HOST.*/REDIS_HOST = "redis"/' gestioCOF/settings/secret_example.py > gestioCOF/settings/secret.py
|
|
- sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' gestioCOF/settings/secret.py
|
|
# Remove the old test database if it has not been done yet
|
|
- psql --username=$POSTGRES_USER --host=$DBHOST -c "DROP DATABASE IF EXISTS test_$POSTGRES_DB"
|
|
- pip install --upgrade --cache-dir vendor/pip -t vendor/python -r requirements.txt
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- python manage.py test
|