From f359e1e74126d17af36d6babce74db34eedcdf33 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 19 Feb 2020 15:35:55 +0100
Subject: [PATCH] [ci] Added mac build.

---
 .gitlab-ci.yml                |  3 +++
 scripts/ci/jobs/build-mac.yml | 22 ++++++++++++++++++++++
 scripts/ci/jobs/checks.yml    | 15 +++++++++------
 3 files changed, 34 insertions(+), 6 deletions(-)
 create mode 100644 scripts/ci/jobs/build-mac.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f169ebbec1e..2327dc0b967 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,13 +11,16 @@ variables:
   PRECOMMIT_IMAGE: $CI_REGISTRY_IMAGE/pre-commit
 
 include:
+  # extends
   - local: '/scripts/ci/extends/container-maker-setup.yml'
   - local: '/scripts/ci/extends/vs2019-environment.yml'
   - local: '/scripts/ci/extends/test-artifacts.yml'
+  # jobs
   - 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/build-mac.yml'
   - local: '/scripts/ci/jobs/checks.yml'
   - local: '/scripts/ci/jobs/container.yml'
   - local: '/scripts/ci/jobs/gui.yml'
diff --git a/scripts/ci/jobs/build-mac.yml b/scripts/ci/jobs/build-mac.yml
new file mode 100644
index 00000000000..c7f6683dd55
--- /dev/null
+++ b/scripts/ci/jobs/build-mac.yml
@@ -0,0 +1,22 @@
+build mac:
+  stage: test
+  tags:
+    - mac
+  variables:
+    BUILD_DIR: "build-mac"
+    CCACHE_DIR: "$CI_PROJECT_DIR/.ccache"
+  cache:
+    paths:
+      - .ccache
+  extends: .test-artifacts
+
+  before_script:
+    - mkdir -p $BUILD_DIR
+    - cd $BUILD_DIR
+
+  script:
+    - cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DOGS_BUILD_PROCESSES=GroundwaterFlow
+    - cmake --build . > >(tee make.output)
+    - cmake --build . --target tests
+    - cmake --build . --target ctest
+    - cp Testing/**/Test.xml Tests/ctest.xml
diff --git a/scripts/ci/jobs/checks.yml b/scripts/ci/jobs/checks.yml
index 0861dddda4a..92152a48a9f 100644
--- a/scripts/ci/jobs/checks.yml
+++ b/scripts/ci/jobs/checks.yml
@@ -6,12 +6,15 @@ compiler warnings:
   dependencies:
     - build
     - build win
+    - build mac
   script:
     - exit_code=0
     - cd build
-    - "if [[ $(cat make.output | grep warning -i) ]]; then echo 'There were compiler warnings:'; cat make.output | grep warning -i; exit_code=1; fi"
+    - "if [[ $(cat make.output | grep warning -i) ]]; then echo 'There were GCC compiler warnings:'; cat make.output | grep warning -i; exit_code=1; fi"
     - cd ../build-win
-    - "if [[ $(cat make.output | grep ': warning' -i) ]]; then echo 'There were compiler warnings:'; cat make.output | grep ': warning' -i; exit_code=1; fi"
+    - "if [[ $(cat make.output | grep ': warning' -i) ]]; then echo 'There were MSVC compiler warnings:'; cat make.output | grep ': warning' -i; exit_code=1; fi"
+    - cd ../build-mac
+    - "if [[ $(cat make.output | grep warning -i) ]]; then echo 'There were Clang (macOS) compiler warnings:'; cat make.output | grep warning -i; exit_code=1; fi"
     - exit $exit_code
 
 
@@ -23,16 +26,16 @@ ctest results:
     - singularity
   dependencies:
     - build
-    - "build win"
+    - build win
+    - build mac
   script:
     - singularity run docker://$XUNIT_TO_JUNIT_IMAGE -s:./build/Tests/ctest.xml > build/ctest-junit.xml
     - singularity run docker://$XUNIT_TO_JUNIT_IMAGE -s:./build-win/Tests/ctest.xml > build-win/ctest-junit.xml
+    - singularity run docker://$XUNIT_TO_JUNIT_IMAGE -s:./build-win/Tests/ctest.xml > build-mac/ctest-junit.xml
   artifacts:
-    paths:
-      - build/ctest-junit.xml
-      - build-win/ctest-junit.xml
     expire_in: 1 week
     reports:
       junit:
         - build/ctest-junit.xml
         - build-win/ctest-junit.xml
+        - build-mac/ctest-junit.xml
-- 
GitLab