From a0e850896747e39bc158609c056b8f90c54c2fcd Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 18 Feb 2020 15:31:14 +0100
Subject: [PATCH] [ci] Added gui stage.

---
 .gitlab-ci.yml                        |  3 +++
 scripts/ci/extends/test-artifacts.yml | 10 ++++++++++
 scripts/ci/jobs/build-win.yml         | 21 +++++----------------
 scripts/ci/jobs/build.yml             | 16 ++++------------
 scripts/ci/jobs/gui.yml               | 26 ++++++++++++++++++++++++++
 5 files changed, 48 insertions(+), 28 deletions(-)
 create mode 100644 scripts/ci/extends/test-artifacts.yml
 create mode 100644 scripts/ci/jobs/gui.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b0e77c43339..f169ebbec1e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,7 @@ stages:
   - pre-checks
   - test
   - checks
+  - gui
   - package
 
 variables:
@@ -12,9 +13,11 @@ variables:
 include:
   - local: '/scripts/ci/extends/container-maker-setup.yml'
   - local: '/scripts/ci/extends/vs2019-environment.yml'
+  - local: '/scripts/ci/extends/test-artifacts.yml'
   - local: '/scripts/ci/jobs/pre-commit.yml'
   - local: '/scripts/ci/jobs/build_image.yml'
   - local: '/scripts/ci/jobs/build.yml'
   - local: '/scripts/ci/jobs/build-win.yml'
   - local: '/scripts/ci/jobs/checks.yml'
   - local: '/scripts/ci/jobs/container.yml'
+  - local: '/scripts/ci/jobs/gui.yml'
diff --git a/scripts/ci/extends/test-artifacts.yml b/scripts/ci/extends/test-artifacts.yml
new file mode 100644
index 00000000000..d00efc23960
--- /dev/null
+++ b/scripts/ci/extends/test-artifacts.yml
@@ -0,0 +1,10 @@
+.test-artifacts:
+  artifacts:
+    paths:
+      - $BUILD_DIR/Tests/ctest.xml
+      - $BUILD_DIR/Tests/testrunner.xml
+      - $BUILD_DIR/make.output
+    expire_in: 1 week
+    reports:
+      junit:
+        - $BUILD_DIR/Tests/testrunner.xml
diff --git a/scripts/ci/jobs/build-win.yml b/scripts/ci/jobs/build-win.yml
index d9f5b7afa27..f27edf8c4f0 100644
--- a/scripts/ci/jobs/build-win.yml
+++ b/scripts/ci/jobs/build-win.yml
@@ -4,7 +4,9 @@ build win:
     - windows
   variables:
     BUILD_DIR: "build-win"
-  extends: .vs2019-environment
+  extends:
+    - .vs2019-environment
+    - .test-artifacts
 
   script:
     - mkdir -p $BUILD_DIR
@@ -13,21 +15,8 @@ build win:
       cmake .. -G Ninja `
         -DCMAKE_BUILD_TYPE=Release `
         -DOGS_BUILD_PROCESSES=GroundwaterFlow `
-        -DOGS_USE_PYTHON=ON `
-        -DOGS_BUILD_GUI=ON `
-        -DOGS_BUILD_UTILS=ON `
-        -DOGS_BUILD_SWMM=ON `
-        -DOGS_USE_NETCDF=ON
+        -DOGS_USE_PYTHON=ON
+    - cmake --build .
     - cmake --build . --target tests
     - cmake --build . --target ctest
     - cp Testing/**/Test.xml Tests/ctest.xml
-    - cmake --build .
-
-  artifacts:
-    paths:
-      - $BUILD_DIR/Tests/ctest.xml
-      - $BUILD_DIR/Tests/testrunner.xml
-    expire_in: 1 week
-    reports:
-      junit:
-        - $BUILD_DIR/Tests/testrunner.xml
diff --git a/scripts/ci/jobs/build.yml b/scripts/ci/jobs/build.yml
index 2fe53f8e3b0..f7adb9cfff4 100644
--- a/scripts/ci/jobs/build.yml
+++ b/scripts/ci/jobs/build.yml
@@ -18,16 +18,18 @@ build docs:
 build:
   stage: test
   variables:
+    BUILD_DIR: "build"
     CCACHE_DIR: "$CI_PROJECT_DIR/.ccache"
   image:
     name: $CONTAINER_GCC_IMAGE
   cache:
     paths:
       - .ccache
+  extends: .test-artifacts
 
   before_script:
-    - mkdir -p build
-    - cd build
+    - mkdir -p $BUILD_DIR
+    - cd $BUILD_DIR
 
   script:
     - cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DOGS_USE_CONAN=OFF -DOGS_BUILD_PROCESSES=GroundwaterFlow
@@ -35,13 +37,3 @@ build:
     - cmake --build . --target tests
     - cmake --build . --target ctest
     - cp Testing/**/Test.xml Tests/ctest.xml
-
-  artifacts:
-    paths:
-      - build/Tests/ctest.xml
-      - build/Tests/testrunner.xml
-      - build/make.output
-    expire_in: 1 week
-    reports:
-      junit:
-        - build/Tests/testrunner.xml
diff --git a/scripts/ci/jobs/gui.yml b/scripts/ci/jobs/gui.yml
new file mode 100644
index 00000000000..973443ab7fa
--- /dev/null
+++ b/scripts/ci/jobs/gui.yml
@@ -0,0 +1,26 @@
+gui win:
+  stage: gui
+  tags:
+    - windows
+  variables:
+    BUILD_DIR: "build-gui-win"
+  extends:
+    - .vs2019-environment
+    - .test-artifacts
+
+  script:
+    - mkdir -p $BUILD_DIR
+    - cd $BUILD_DIR
+    - |
+      cmake .. -G Ninja `
+        -DCMAKE_BUILD_TYPE=Release `
+        -DOGS_BUILD_PROCESSES=GroundwaterFlow `
+        -DOGS_USE_PYTHON=ON `
+        -DOGS_BUILD_GUI=ON `
+        -DOGS_BUILD_UTILS=ON `
+        -DOGS_BUILD_SWMM=ON `
+        -DOGS_USE_NETCDF=ON
+    - cmake --build . --target tests
+    - cmake --build . --target ctest
+    - cp Testing/**/Test.xml Tests/ctest.xml
+    - cmake --build .
-- 
GitLab