From 262eade2c0f0737e5007a9c35bd9c719aba2446e Mon Sep 17 00:00:00 2001
From: Mathias Chouet <mathias.chouet@irstea.fr>
Date: Tue, 3 Sep 2019 11:29:24 +0200
Subject: [PATCH] Set up Gitlab CI

---
 .gitlab-ci.yml     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 jalhyd_branch      |  2 +-
 package.json       |  2 +-
 protractor.conf.js |  2 +-
 4 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 000000000..7fb685d05
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,77 @@
+stages:
+  - jalhyd
+  - install
+  #- test
+  - build
+  - release-android
+  - release-linux
+
+variables:
+  LC_ALL: C.UTF-8
+
+cache:
+  paths:
+    - node_modules/
+
+jalhyd:
+  stage: jalhyd
+  only:
+    - tags
+    - schedules
+    - web
+  script:
+    - export JALHYD_BRANCH=`cat jalhyd_branch`
+    - echo "Branche JalHyd - $JALHYD_BRANCH"
+    - cd ..
+    - rm -rf jalhyd
+    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.irstea.fr/cassiopee/jalhyd.git
+    - cd jalhyd
+    - git checkout "$JALHYD_BRANCH"
+    - npm install
+    - npm run build
+
+install:
+  stage: install
+  only:
+    - tags
+    - schedules
+    - web
+  script:
+    - rm -rf node_modules
+    - npm install
+
+build:
+  stage: build
+  only:
+    - tags
+    - schedules
+    - web
+  script:
+    - npm run build
+
+# test:
+#   stage: test
+#   only:
+#     - tags
+#     - schedules
+#     - web
+#   script:
+#     - npm run e2e
+
+release-android:
+  stage: release-android
+  only:
+    - tags
+    - schedules
+    - web
+  script:
+    - npm run release-android
+
+release-linux:
+  stage: release-linux
+  only:
+    - tags
+    - schedules
+    - web
+  script:
+    - npm run release-linux
diff --git a/jalhyd_branch b/jalhyd_branch
index c9cd8896a..1f7391f92 100644
--- a/jalhyd_branch
+++ b/jalhyd_branch
@@ -1 +1 @@
-128-reorganisation-du-stockage-des-resultats-dans-le-nub
+master
diff --git a/package.json b/package.json
index 2fd54de46..23a826e81 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
   "scripts": {
     "ng": "cd . && \"node_modules/.bin/ng\"",
     "lint": "npm run ng -- lint",
-    "e2e": "npm run ng -- e2e",
+    "e2e": "npm run preprocess && npm run ng -- e2e",
     "e2equick": "npm run ng -- e2e --dev-server-target=",
     "mkdocs": "node scripts/mkdocs-preprocess.js && node scripts/python3.js -m mkdocs build",
     "preprocess": "node scripts/preprocessors.js && npm run mkdocs",
diff --git a/protractor.conf.js b/protractor.conf.js
index 4c1db58bb..6c546c716 100644
--- a/protractor.conf.js
+++ b/protractor.conf.js
@@ -16,7 +16,7 @@ exports.config = {
   capabilities: {
     browserName: 'chrome',
     chromeOptions: {
-      // args: [ "--headless", "--window-size=1024x768" ],
+      args: [ "--headless", "--window-size=1024x768" ],
       prefs: {
         download: {
             prompt_for_download: false, 
-- 
GitLab