From a2cc81c5723f45aa439bba3707fd3c212b48b2c9 Mon Sep 17 00:00:00 2001
From: Yuxuan Shui <yshuiv7@gmail.com>
Date: Thu, 21 Mar 2019 20:22:10 +0000
Subject: [PATCH] Run unittest in CI

Also general CI config update

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
---
 .circleci/config.yml | 45 +++++++++++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 5d8af5ec..afc0e9a9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,8 +1,8 @@
-defaults: &defaults
-  docker:
-    - image: yshui/comptonci
-cached-checkout: &ccheckout
-just-build: &build
+executors:
+  e:
+    docker:
+      - image: yshui/comptonci
+    working_directory: "/tmp/workspace"
 
 version: 2.1
 commands:
@@ -27,10 +27,10 @@ commands:
             - ".git"
       - run:
           name: config
-          command: CC=<< parameters.cc >> meson << parameters.build-config >> --werror . build
+          command: CC=<< parameters.cc >> meson << parameters.build-config >> -Dunittest=true --werror . build
       - run:
           name: build
-          command: ninja -C build
+          command: ninja -vC build
   test-xvfb:
     steps:
       - run:
@@ -40,45 +40,57 @@ commands:
 
 jobs:
   basic:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           build-config: -Dbuild_docs=true
+      - persist_to_workspace:
+          root: .
+          paths:
+            - .
+  test:
+    executor: e
+    steps:
+      - attach_workspace:
+          at: /tmp/workspace
+      - run:
+          name: test
+          command: ninja -vC /tmp/workspace/build test
   minimal:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           build-config: -Dopengl=false -Ddbus=false -Dregex=false -Dconfig_file=false
   nogl:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           build-config: -Dopengl=false
   noregex:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           build-config: -Dregex=false
   clang_basic:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           cc: clang-6.0
           build-config:
   clang_minimal:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           cc: clang-6.0
           build-config: -Dopengl=false -Ddbus=false -Dregex=false -Dconfig_file=false
   clang_nogl:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           cc: clang-6.0
           build-config: -Dopengl=false
   clang_noregex:
-    <<: *defaults
+    executor: e
     steps:
       - build:
           cc: clang-6.0
@@ -93,6 +105,9 @@ workflows:
       - clang_minimal
       - nogl
       - clang_nogl
+      - test:
+          requires:
+            - basic
 #     - test-xvfb
 
 # vim: set sw=2 ts=8 et: