From 678ba29bb15f0f4eed7f1ecab12a6d306961e7bb Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 10 Mar 2023 10:41:47 +0000
Subject: [PATCH] CI: Run unit tests via gitlab CI

---
 .ci/unit_tests.sh | 16 ++++++++++++++++
 .gitlab-ci.yml    | 20 ++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 .ci/unit_tests.sh
 create mode 100644 .gitlab-ci.yml

diff --git a/.ci/unit_tests.sh b/.ci/unit_tests.sh
new file mode 100644
index 0000000..384b352
--- /dev/null
+++ b/.ci/unit_tests.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+conda create                                                      \
+      -c https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/ \
+      -c conda-forge                                              \
+      -p ./test.env                                               \
+      "python=${PYTHON_VERSION}"                                  \
+      pytest                                                      \
+      coverage                                                    \
+      pytest-cov
+
+source activate ./test.env
+
+pip install --no-deps -e .
+
+pytest
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7df784e
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,20 @@
+stages:
+ - test
+
+
+.test: &test_template
+  stage: test
+  image: continuumio/miniconda3
+  tags:
+    - docker
+  except:
+    - tags
+    - merge_requests
+  script:
+    - bash ./.ci/unit_tests.sh
+
+
+test:3.11:
+  variables:
+    PYTHON_VERSION : "3.11"
+  <<: *test_template
-- 
GitLab