From b300b8bc12d29ea20ae154da030fd1d7fb398011 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oliv=C3=A9r=20FACKLAM?= <oliver.facklam@polytechnique.edu>
Date: Sat, 30 Mar 2019 00:32:35 +0100
Subject: [PATCH] [Gitlab CI] Set up tests

---
 .gitlab-ci.yml | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 114de2e..01b970d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,9 @@ services:
   - postgres
 
 variables:
+  POSTGRES_DB: sigma_staging
+  POSTGRES_USER: sigma
+  POSTGRES_PASSWORD: "sigma_pw"
 
 # This folder is cached between builds
 cache:
@@ -24,8 +27,6 @@ stages:
 # Install dependencies, compile the bundle.js,
 build:transpile:
   stage: build
-  before_script:
-    - export NODE_ENV=staging
   script:
     - npm ci 
     - npm run build
@@ -33,9 +34,15 @@ build:transpile:
     paths:
       - build/
 
-tests:
+tests:mocha:
   stage: tests
   script:
+    - npm ci
     - echo '{"dn":"dn", "passwd":"passwd"}' >> ldap_credentials.json
-    - npm i
+    - export TARGET_ENV=staging
+    - export DB_HOST=postgres
+    - cd db
+    - knex migrate:latest --env staging
+    - knex seed:run --env staging
+    - cd ..
     - npm run test
\ No newline at end of file
-- 
GitLab