2020-05-08 12:47:03 +02:00
|
|
|
image: "python:3.7"
|
2018-08-05 18:34:05 +02:00
|
|
|
|
2016-11-13 11:29:28 +01:00
|
|
|
variables:
|
|
|
|
# GestioCOF settings
|
2017-09-12 00:14:52 +02:00
|
|
|
DBHOST: "postgres"
|
2016-11-13 11:29:28 +01:00
|
|
|
REDIS_HOST: "redis"
|
2017-10-10 15:26:14 +02:00
|
|
|
REDIS_PASSWD: "dummy"
|
2016-11-13 11:29:28 +01:00
|
|
|
|
|
|
|
# Cached packages
|
2018-10-06 03:09:01 +02:00
|
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/vendor/pip"
|
2016-11-13 11:29:28 +01:00
|
|
|
|
2017-09-12 00:14:52 +02:00
|
|
|
# postgres service configuration
|
|
|
|
POSTGRES_PASSWORD: "4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4"
|
|
|
|
POSTGRES_USER: "cof_gestion"
|
|
|
|
POSTGRES_DB: "cof_gestion"
|
2016-11-13 11:29:28 +01:00
|
|
|
|
2017-09-30 02:39:45 +02:00
|
|
|
# psql password authentication
|
|
|
|
PGPASSWORD: $POSTGRES_PASSWORD
|
|
|
|
|
2021-02-18 17:30:28 +01:00
|
|
|
# apps to check migrations for
|
2021-02-18 17:41:52 +01:00
|
|
|
MIGRATION_APPS: "bda bds cofcms clubs events gestioncof kfet kfetauth kfetcms open petitscours shared"
|
2021-02-18 17:30:28 +01:00
|
|
|
|
2020-05-09 17:52:12 +02:00
|
|
|
.test_template:
|
2018-10-06 03:14:49 +02:00
|
|
|
before_script:
|
|
|
|
- mkdir -p vendor/{pip,apt}
|
2020-06-20 17:49:56 +02:00
|
|
|
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev
|
2021-02-07 17:19:46 +01:00
|
|
|
- sed -E 's/^REDIS_HOST.*/REDIS_HOST = "redis"/' gestioasso/settings/secret_example.py > gestioasso/settings/secret.py
|
|
|
|
- sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' gestioasso/settings/secret.py
|
2018-10-06 03:14:49 +02:00
|
|
|
# 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"
|
2019-11-22 15:22:21 +01:00
|
|
|
- pip install --upgrade -r requirements-prod.txt coverage tblib
|
2018-10-06 03:14:49 +02:00
|
|
|
- python --version
|
|
|
|
after_script:
|
2018-10-01 13:47:52 +02:00
|
|
|
- coverage report
|
2018-10-21 12:13:03 +02:00
|
|
|
services:
|
2020-05-08 12:47:03 +02:00
|
|
|
- postgres:11.7
|
2018-10-21 12:13:03 +02:00
|
|
|
- redis:latest
|
2018-10-06 03:14:49 +02:00
|
|
|
cache:
|
|
|
|
key: test
|
|
|
|
paths:
|
|
|
|
- vendor/
|
|
|
|
# For GitLab CI to get coverage from build.
|
2018-10-06 15:45:32 +02:00
|
|
|
# Keep this disabled for now, as it may kill GitLab...
|
2018-10-05 23:16:06 +02:00
|
|
|
# coverage: '/TOTAL.*\s(\d+\.\d+)\%$/'
|
2018-10-06 03:14:49 +02:00
|
|
|
|
2022-06-30 10:00:29 +02:00
|
|
|
kfettest:
|
|
|
|
stage: test
|
|
|
|
extends: .test_template
|
|
|
|
variables:
|
|
|
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod"
|
|
|
|
script:
|
|
|
|
- coverage run manage.py kfet
|
|
|
|
|
2020-05-09 17:52:12 +02:00
|
|
|
coftest:
|
|
|
|
stage: test
|
|
|
|
extends: .test_template
|
|
|
|
variables:
|
2021-02-07 17:19:46 +01:00
|
|
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod"
|
2020-05-14 23:38:06 +02:00
|
|
|
script:
|
2022-06-30 10:00:29 +02:00
|
|
|
- coverage run manage.py test gestioncof bda petitscours shared --parallel
|
2020-05-09 17:52:12 +02:00
|
|
|
|
|
|
|
bdstest:
|
|
|
|
stage: test
|
|
|
|
extends: .test_template
|
|
|
|
variables:
|
2021-02-07 17:19:46 +01:00
|
|
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.bds_prod"
|
2020-05-14 23:38:06 +02:00
|
|
|
script:
|
|
|
|
- coverage run manage.py test bds clubs events --parallel
|
2020-05-09 17:52:12 +02:00
|
|
|
|
2018-10-06 03:14:49 +02:00
|
|
|
linters:
|
|
|
|
stage: test
|
|
|
|
before_script:
|
|
|
|
- mkdir -p vendor/pip
|
|
|
|
- pip install --upgrade black isort flake8
|
|
|
|
script:
|
|
|
|
- black --check .
|
2020-07-04 13:30:54 +02:00
|
|
|
- isort --check --diff .
|
2018-10-06 03:14:49 +02:00
|
|
|
# Print errors only
|
2021-02-07 17:19:46 +01:00
|
|
|
- flake8 --exit-zero bda bds clubs gestioasso events gestioncof kfet petitscours provisioning shared
|
2018-10-06 03:14:49 +02:00
|
|
|
cache:
|
|
|
|
key: linters
|
|
|
|
paths:
|
|
|
|
- vendor/
|
2019-10-06 20:34:04 +02:00
|
|
|
|
|
|
|
# Check whether there are some missing migrations.
|
2020-06-28 18:58:45 +02:00
|
|
|
migration_checks:
|
|
|
|
stage: test
|
|
|
|
variables:
|
2021-02-07 17:19:46 +01:00
|
|
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.local"
|
2019-10-06 20:34:04 +02:00
|
|
|
before_script:
|
|
|
|
- mkdir -p vendor/{pip,apt}
|
2020-06-20 17:49:56 +02:00
|
|
|
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev
|
2021-02-07 17:19:46 +01:00
|
|
|
- cp gestioasso/settings/secret_example.py gestioasso/settings/secret.py
|
2020-06-28 18:58:45 +02:00
|
|
|
- pip install --upgrade -r requirements-devel.txt
|
2019-10-06 20:34:04 +02:00
|
|
|
- python --version
|
2021-02-18 17:30:28 +01:00
|
|
|
script: python manage.py makemigrations --dry-run --check $MIGRATION_APPS
|
2019-10-06 20:34:04 +02:00
|
|
|
services:
|
|
|
|
# this should not be necessary…
|
2020-05-08 12:47:03 +02:00
|
|
|
- postgres:11.7
|
2019-10-06 20:34:04 +02:00
|
|
|
cache:
|
|
|
|
key: migration_checks
|
|
|
|
paths:
|
|
|
|
- vendor/
|