From d788e1eb6ab80f583a6e7125eb90d82bc318435e Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wouter.deconinck@umanitoba.ca>
Date: Sat, 2 Oct 2021 00:56:34 +0000
Subject: [PATCH] cmake install locally and test npsim

---
 .gitlab-ci.yml | 15 +++++++++++++++
 bin/do_build   |  9 ++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d5c776e0..b5fb549d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,7 @@ image: eicweb.phy.anl.gov:4567/containers/eic_container/jug_dev:testing
 
 stages:
   - build
+  - test
   - container
   - deploy
 
@@ -25,10 +26,24 @@ compile:
   artifacts:
     when: always
     paths:
+      - install/
       - build/test_result_*.xml
     reports:
       junit: build/test_result_*.xml
 
+test_npsim:
+  extends: .eicweb
+  needs: ["compile"]
+  stage: test
+  script:
+    - mkdir -p test_files/
+    - LD_LIBRARY_PATH=install/lib:$LD_LIBRARY_PATH install/bin/npsim --compactFile examples/gem_tracker_disc.xml --enableGun --numberOfEvents 10 --outputFile test_files/test_npsim.root
+    - rootls -t test_files/test_npsim.root
+  artifacts:
+    expire_in: 3 days
+    paths: 
+      - test_files/
+
 docker_image:
   image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
   stage: container
diff --git a/bin/do_build b/bin/do_build
index 882b7ebf..a744dece 100755
--- a/bin/do_build
+++ b/bin/do_build
@@ -1,6 +1,5 @@
 #!/bin/bash
-mkdir build 
-cd build
-cmake -DCMAKE_CXX_STANDARD=17 .. 
-make -j30
-make test
+cmake -Bbuild -S. -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=install
+cmake --build build -j30
+cmake --build build --target test
+cmake --install build
-- 
GitLab