From 2ac33d6470b39007ee5500505dd42d4de3e37aae Mon Sep 17 00:00:00 2001
From: Thomas Clavier <tom@tcweb.org>
Date: Wed, 26 Oct 2022 17:33:56 +0200
Subject: [PATCH] Enable CI/CD

---
 .gitlab-ci.yml | 18 ++++++++++++++++++
 pom.xml        | 13 +++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..8b1602f
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,18 @@
+stages:
+  - 🧪 test
+
+variables:
+  MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
+
+cache:
+  paths:
+    - ./.m2/
+
+test:
+  stage: 🧪 test
+  image: maven:3-jdk-11
+  coverage: '/Total.*?([0-9]{1,3})%/'
+  script:
+    - mvn $MAVEN_OPTS test jacoco:report
+    - cat target/site/jacoco/index.html
+
diff --git a/pom.xml b/pom.xml
index 9e1b49f..73cdb33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,6 +26,19 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>3.0.0-M5</version>
             </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>0.8.4</version>
+                <executions>
+                    <execution>
+                        <id>prepare-agent</id>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <dependencies>
-- 
GitLab