From 5de80ada7c169d531380be23c7bf4f1ff954aeff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Tue, 26 Jun 2018 12:57:18 +0000 Subject: [PATCH] Test using CI mysql services --- .gitlab-ci.yml | 33 ++++++++++++++++++++++++--------- install_re2o.sh | 9 ++++----- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e775a1fb..b8020b7f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,31 @@ --- +services: + - mysql:latest + +variables: + MYSQL_DATABASE: re2o + MYSQL_ROOT_PASSWORD: re2o + image: debian:stretch stages: - - lint + - build - tests + - lint + + +build: + stage: build + variables: + LANG: 'en_US.UTF-8' + LC_ALL: 'en_US.UTF-8' + LANGUAGE: 'en_US.UTF-8' + script: + - apt-get -qq update + - DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales + - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 + - ./install_re2o.sh ci-setup + - cat re2o/settings_local.py + lint: stage: lint @@ -11,9 +34,6 @@ lint: LC_ALL: 'en_US.UTF-8' LANGUAGE: 'en_US.UTF-8' script: - - apt-get -qq update - - DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales python3-django python3-pylint-django - - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 - pylint3 --load-plugins pylint_django cotisations machines re2o logs topologie preferences search users || if [ $? -ne 1 ]; then exit 0; else exit 1; fi @@ -24,9 +44,4 @@ tests: LC_ALL: 'en_US.UTF-8' LANGUAGE: 'en_US.UTF-8' script: - - apt-get -qq update - - DEBIAN_FRONTEND=noninteractive apt-get -qq install -y locales - - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 - - ./install_re2o.sh auto-setup - - cat re2o/settings_local.py - python3 manage.py test diff --git a/install_re2o.sh b/install_re2o.sh index 0202139b..eee50ea2 100755 --- a/install_re2o.sh +++ b/install_re2o.sh @@ -766,8 +766,8 @@ main_function() { echo " LDAP" echo " * the domain extension to use for the LDAP structure" echo " in LDAP notation" - echo " * {auto-setup} ---- Automatic setup with default values, use this for quick" - echo " but entire setup." + echo " * {ci-setup} ------ Automatic setup with default values, this command is" + echo " used for building the gitlab CI." echo "" else subcmd="$1" @@ -837,11 +837,10 @@ main_function() { fi ;; - auto-setup ) + ci-setup ) install_requirements - install_database 1 1 re2o re2o re2o install_ldap 1 re2o "dc=example,dc=net" - write_settings_file 1 "127.0.0.1" re2o re2o re2o \ + write_settings_file 1 mysql re2o root re2o \ "cn=admin,dc=example,dc=net" 2 re2o localhost "dc=example,dc=net" \ "mailserver.example.net" 25 "example.net" "re2o.example.net" update_django