From 393f1f76d2df92705319bc03fed04de007746512 Mon Sep 17 00:00:00 2001
From: Colin DAMON <cdamon@ippon.fr>
Date: Sat, 22 Aug 2020 20:39:23 +0200
Subject: [PATCH] Simple CI

---
 .gitlab-ci.yml          |  1 +
 .gitlab-common-ci.yml   | 25 ++++++++++++++++++++-----
 borestop/.gitlab-ci.yml | 11 +++++++++++
 3 files changed, 32 insertions(+), 5 deletions(-)
 create mode 100644 borestop/.gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0ef78a9a..6f36ee91 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,3 +8,4 @@ include:
   - local: "/string-calculator/.gitlab-ci.yml"
   - local: "/gilded-rose/.gitlab-ci.yml"
   - local: "/ugly-trivia/.gitlab-ci.yml"
+  - local: "/borestop/.gitlab-ci.yml"
diff --git a/.gitlab-common-ci.yml b/.gitlab-common-ci.yml
index 3715f7da..83a16b5f 100644
--- a/.gitlab-common-ci.yml
+++ b/.gitlab-common-ci.yml
@@ -5,10 +5,6 @@ variables:
 stages:
   - build
 
-cache:
-  paths:
-    - .m2/repository
-
 .java:
   image: maven:3.6.3-jdk-14
   stage: build
@@ -18,7 +14,6 @@ cache:
     - cd $PROJECT_FOLDER
   script:
     - mvn $MAVEN_CLI_OPTS clean package
-    - cat target/site/jacoco/index.html
     - awk -F"," '{ branches += $6 + $7; covered += $7 } END { print covered, "/", branches, "branches covered"; print 100*covered/branches, "%covered" }' target/site/jacoco/jacoco.csv
   artifacts:
     reports:
@@ -28,3 +23,23 @@ cache:
     name: "$PROJECT_FOLDER-report"
     expire_in: 1 day
   coverage: "/([^%]+) %covered/"
+
+.jhipster:
+  stage: build
+  image: jhipster/jhipster:v6.10.1
+  services:
+    - docker:19.03.8-dind
+  tags:
+    - docker
+  before_script:
+    - cd $PROJECT_FOLDER
+  script:
+    - ./mvnw -B -Pprod,swagger verify
+    - awk -F"," '{ branches += $6 + $7; covered += $7 } END { print covered, "/", branches, "branches covered"; print 100*covered/branches, "%covered" }' target/jacoco-aggregate/index.csv
+  artifacts:
+    reports:
+      junit: $PROJECT_FOLDER/target/test-results/TEST-*.xml
+    paths:
+      - $PROJECT_FOLDER/target/jacoco-aggregate
+    expire_in: 1 day
+  coverage: "/([^%]+) %covered/"
diff --git a/borestop/.gitlab-ci.yml b/borestop/.gitlab-ci.yml
new file mode 100644
index 00000000..d15d9c16
--- /dev/null
+++ b/borestop/.gitlab-ci.yml
@@ -0,0 +1,11 @@
+package-borestop:
+  variables:
+    PROJECT_FOLDER: 'borestop'
+  extends: .jhipster
+  only:
+    refs:
+      - master
+      - merge_requests
+    changes:
+      - '.gitlab-common-ci.yml'
+      - 'borestop/**/*'
-- 
GitLab