From 929790ac975696b870485e461c915ca511009514 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <timm.fitschen@ds.mpg.de>
Date: Tue, 9 Oct 2018 16:41:49 +0200
Subject: [PATCH] DEV: added .gitlab-ci.yml

---
 .gitignore     |   1 +
 .gitlab-ci.yml | 156 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 157 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitignore b/.gitignore
index c3df0fe..9423022 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 # dot files
 .*
 !/.gitignore
+!/.gitlab-ci.yml
 
 # dumps
 *.dump.sql
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..50d119a
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,156 @@
+#
+# ** header v3.0
+# This file is a part of the CaosDB Project.
+#
+# Copyright (C) 2018 Research Group Biomedical Physics,
+# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# ** end header
+#
+stages:
+    - configure
+    - test
+    - setup
+    - clean
+
+###########################
+# configure
+###########################
+
+configure:mysql55:
+    stage: configure
+    tags: [ mysql55 ]
+    artifacts:
+        paths:
+            - .config.mysql55
+    script:
+        - printf "\n\n\n\n\n\n\n\n\n$MYSQL_USER_PASSWORD" > .user_input
+        - ./configure < .user_input
+        - test -f .config
+        - cp .config .config.mysql55
+
+configure:mariadb10.1:
+    stage: configure
+    tags: [ maria10.1 ]
+    artifacts:
+        paths:
+            - .config.mariadb10.1
+    script:
+        - printf "\n\n\n\n\ncaosdb-root\n\n\n\n$MYSQL_USER_PASSWORD" > .user_input
+        - ./configure < .user_input
+        - test -f .config
+        - cp .config .config.mariadb10.1
+
+
+##########################
+# test
+##########################
+
+# test the connection
+test:test-connection:mysql55:
+    stage: test
+    tags: [ mysql55 ]
+    dependencies: 
+        - configure:mysql55
+    script:
+        - cp .config.mysql55 .config
+        - make test-connection
+        
+test:test-connection:mariadb10.1:
+    stage: test
+    tags: [ maria10.1 ]
+    dependencies: 
+        - configure:mariadb10.1
+    script:
+        - cp .config.mariadb10.1 .config
+        - make test-connection
+
+#########################
+# setup
+#########################
+
+# install without patches and drop
+setup:install:mysql55:
+    stage: setup
+    tags: [ mysql55 ]
+    dependencies: 
+        - configure:mysql55
+    script:
+        - cp .config.mysql55 .config
+        - export $(sed -n '/DATABASE_NAME/p ' .config)
+        - make _install
+        - make drop-$DATABASE_NAME
+        
+setup:install:mariadb10.1:
+    stage: setup
+    tags: [ maria10.1 ]
+    dependencies: 
+        - configure:mariadb10.1
+    script:
+        - cp .config.mariadb10.1 .config
+        - export $(sed -n '/DATABASE_NAME/p ' .config)
+        - make _install
+        - make drop-$DATABASE_NAME
+
+# upgrade database with patches and drop
+setup:install_upgrade:mysql55:
+    stage: setup
+    tags: [ mysql55 ]
+    dependencies: 
+        - configure:mysql55
+    script:
+        - cp .config.mysql55 .config
+        - export $(sed -n '/DATABASE_NAME/p ' .config)
+        - make install
+        - make drop-$DATABASE_NAME
+        
+setup:install_upgrade:mariadb10.1:
+    stage: setup
+    tags: [ maria10.1 ]
+    dependencies: 
+        - configure:mariadb10.1
+    script:
+        - cp .config.mariadb10.1 .config
+        - export $(sed -n '/DATABASE_NAME/p ' .config)
+        - make install
+        - make drop-$DATABASE_NAME
+
+###############################
+# cleanup
+###############################
+
+# drop database
+clean:drop:mysql55:
+    stage: clean
+    when: always
+    tags: [ mysql55 ]
+    dependencies: 
+        - configure:mysql55
+    script:
+        - cp .config.mysql55 .config
+        - export $(sed -n '/DATABASE_NAME/p ' .config)
+        - if make _exists; then make drop-$DATABASE_NAME ; fi
+
+clean:drop:mariadb10.1:
+    stage: clean
+    when: always
+    tags: [ maria10.1 ]
+    dependencies: 
+        - configure:mariadb10.1
+    script:
+        - cp .config.mariadb10.1 .config
+        - export $(sed -n '/DATABASE_NAME/p ' .config)
+        - if make _exists; then make drop-$DATABASE_NAME ; fi
\ No newline at end of file
-- 
GitLab