image: "python:3.5" variables: # GestioCOF settings DJANGO_SETTINGS_MODULE: "cof.settings.prod" DBHOST: "postgres" REDIS_HOST: "redis" REDIS_PASSWD: "dummy" # Cached packages PIP_CACHE_DIR: "$CI_PROJECT_DIR/vendor/pip" # postgres service configuration POSTGRES_PASSWORD: "4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4" POSTGRES_USER: "cof_gestion" POSTGRES_DB: "cof_gestion" # psql password authentication PGPASSWORD: $POSTGRES_PASSWORD test: stage: test before_script: - mkdir -p vendor/{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"/' cof/settings/secret_example.py > cof/settings/secret.py - sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' cof/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 -r requirements.txt coverage tblib - python --version script: - coverage run manage.py test --parallel after_script: - coverage report services: - postgres:9.6 - redis:latest cache: key: test paths: - vendor/ # For GitLab CI to get coverage from build. # Keep this disabled for now, as it may kill GitLab... # coverage: '/TOTAL.*\s(\d+\.\d+)\%$/' linters: image: python:3.6 stage: test before_script: - mkdir -p vendor/pip - pip install --upgrade black isort flake8 script: - black --check . - isort --recursive --check-only --diff bda bds cof events gestioncof kfet petitscours provisioning shared utils # Print errors only - flake8 --exit-zero bda bds cof events gestioncof kfet petitscours provisioning shared utils cache: key: linters paths: - vendor/