From 46ff25f858ddfabb32e7fa36e332603429cd31fb Mon Sep 17 00:00:00 2001
From: Ulf Seltmann <seltmann@ub.uni-leipzig.de>
Date: Tue, 17 Oct 2017 15:10:00 +0200
Subject: [PATCH] adds gitlab ci

---
 .gitlab-ci.yml | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
 docs/Readme.md |  3 +++
 package.json   |  4 +--
 3 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..45f4a7b
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,71 @@
+stages:
+- build_app
+- test_app
+- publish_app
+- build_image
+- publish_image
+
+variables:
+  npm_config_registry: https://docker.ub.intern.uni-leipzig.de/npm
+
+npm_install:
+  stage: build_app
+  image: node:8-alpine
+  script:
+  - npm install
+  - npm run build
+  cache:
+    key: "${CI_COMMIT_SHA}"
+    paths:
+    - node_modules
+    - dist
+    - public
+  tags:
+    - docker
+
+npm_ci:
+  stage: test_app
+  image: node:8-alpine
+  script:
+  - npm run ci
+  cache:
+    key: "${CI_COMMIT_SHA}"
+    paths:
+    - node_modules
+    - dist
+    - public
+  tags:
+    - docker
+
+npm_publish:
+  stage: publish_app
+  only:
+  - master
+  image: node:8-alpine
+  script:
+  - echo "//docker.ub.intern.uni-leipzig.de/:_authToken=${NPM_TOKEN}" > ~/.npmrc
+  - npm publish
+  cache:
+    key: "${CI_COMMIT_SHA}"
+    paths:
+    - node_modules
+    - dist
+    - public
+  tags:
+    - docker
+
+docker_build:
+  stage: build_image
+  only:
+  - master
+  image: docker:latest
+  services:
+  - docker:dind
+  script:
+  - docker login --username '${DOCKER_USER}' --password '${DOCKER_PASSWORD}'
+  - docker build --no-cache --pull -t ubleipzig/dacap:latest .
+  - docker tag ubleipzig/dacap:latest ubleipzig/dacap:${CI_PIPELINE_ID}
+  - docker push ubleipzig/dacap:${CI_PIPELINE_ID}
+  - docker push ubleipzig/dacap:latest
+  tags:
+    - docker
diff --git a/docs/Readme.md b/docs/Readme.md
index 9c36af5..1406608 100644
--- a/docs/Readme.md
+++ b/docs/Readme.md
@@ -2,6 +2,9 @@
 
 *Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough.
 
+[![pipeline status](https://git.sc.uni-leipzig.de/ubl/bdd_dev/dacap/badges/master/pipeline.svg)](https://git.sc.uni-leipzig.de/ubl/bdd_dev/dacap/commits/master)
+[![coverage report](https://git.sc.uni-leipzig.de/ubl/bdd_dev/dacap/badges/master/coverage.svg)](https://git.sc.uni-leipzig.de/ubl/bdd_dev/dacap/commits/master)
+
 ## Requirements
 
 * node >= v8.2.1
diff --git a/package.json b/package.json
index 5d52d46..c1f9254 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "dacap",
-  "version": "1.0.7",
+  "version": "1.0.9",
   "description": "proxies,compresses and caches api-requests",
   "main": "bin/dacap",
   "bin": {
@@ -16,7 +16,7 @@
     "inspect-watch": "tsc-watch --onSuccess 'node --inspect=0.0.0.0:9229 bin/dacap'",
     "inspect-brk-watch": "tsc-watch --onSuccess 'node --inspect-brk=0.0.0.0:9229 bin/dacap'",
     "test": "mocha",
-    "ci": "istanbul cover _mocha -- --no-colors --timeout 10000 --reporter mocha-jenkins-reporter",
+    "ci": "istanbul cover _mocha -- --timeout 10000",
     "build": "rm -rf dist public && tsc --declaration && webpack --config webpack.prod.js"
   },
   "author": "Ulf Seltmann <ulf.seltmann@uni-leipzig.de>",
-- 
GitLab