From 5f8e4870129809351911628a739d67d24c26dbd4 Mon Sep 17 00:00:00 2001
From: Bret Curtis <psi29a@gmail.com>
Date: Fri, 15 Oct 2021 22:40:26 +0200
Subject: [PATCH] Let's get testy! (#3172)

Let's try to get testing happening.
We also disable artefact building for now.
---
 .github/workflows/cmake.yml | 42 ++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index 54966fdfb0..d53d2380d4 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -26,25 +26,37 @@ jobs:
         key: ${{ matrix.os }}-${{ env.BUILD_TYPE }}
         max-size: 1000M
 
+    - name: Install gtest
+      run: |
+        export CONFIGURATION="Release"
+        export GOOGLETEST_DIR="."
+        export GENERATOR="Unix Makefiles"
+        export CC="gcc"
+        export CXX="g++"
+        sudo -E CI/build_googletest.sh
+
     - name: Configure
-      run: cmake -S . -B . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS='-Werror' -DCMAKE_CXX_FLAGS="-Werror -Wno-error=deprecated-declarations -Wno-error=nonnull -Wno-error=deprecated-copy"
+      run: cmake -S . -B . -DGTEST_ROOT="$(pwd)/googletest/build" -DGMOCK_ROOT="$(pwd)/googletest/build" -DBUILD_UNITTESTS=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS='-Werror' -DCMAKE_CXX_FLAGS="-Werror -Wno-error=deprecated-declarations -Wno-error=nonnull -Wno-error=deprecated-copy"
 
     - name: Build
       run: cmake --build . --config ${{env.BUILD_TYPE}} --parallel 3
  
-    - name: Install
-      shell: bash
-      run: cmake --install .
+    - name: Test
+      run: ./openmw_test_suite
+
+#    - name: Install
+#      shell: bash
+#      run: cmake --install .
       
-    - name: Create Artifact
-      shell: bash
-      working-directory: install
-      run: |
-        ls -laR
-        7z a ../build_artifact.7z .
+#    - name: Create Artifact
+#      shell: bash
+#      working-directory: install
+#      run: |
+#        ls -laR
+#        7z a ../build_artifact.7z .
         
-    - name: Upload Artifact
-      uses: actions/upload-artifact@v1
-      with:
-        path: ./build_artifact.7z
-        name: build_artifact.7z
+#    - name: Upload Artifact
+#      uses: actions/upload-artifact@v1
+#      with:
+#        path: ./build_artifact.7z
+#        name: build_artifact.7z