Merge branch '#51-#52-CI-SonarQube' into 'main'
Integration CI mit SonarQube Closes #51 and #52 See merge request team1/sandbox2!1
This commit is contained in:
@@ -1,21 +1,44 @@
|
|||||||
|
variables:
|
||||||
|
MVN_OPTS: >-
|
||||||
|
--batch-mode
|
||||||
|
--errors
|
||||||
|
--fail-at-end
|
||||||
|
--show-version
|
||||||
|
--no-transfer-progress
|
||||||
|
-DinstallAtEnd=true
|
||||||
|
-DdeployAtEnd=true
|
||||||
|
-Dsonar.host.url=https://sonar.fbe-adswen.rwu.de
|
||||||
|
-Dsonar.token=sqa_c39258caceb01d59515d6dfa9440a7b05cdd15f4
|
||||||
|
-Dhttps.protocols=TLSv1.2
|
||||||
|
-Dorg.slf4j.simpleLogger.showDateTime=true
|
||||||
|
-Djava.awt.headless=true
|
||||||
|
|
||||||
image: maven:3.9.1-eclipse-temurin-17
|
image: maven:3.9.1-eclipse-temurin-17
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
|
key: "$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
- .m2/repository
|
- .m2/repository
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- analyze
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- echo "Maven Build started..."
|
- echo "Starting Maven build..."
|
||||||
- "mvn compile"
|
- mvn $MVN_OPTS clean compile
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- echo "Maven Test started..."
|
- echo "Starting Maven Test..."
|
||||||
- "mvn test"
|
- mvn $MVN_OPTS test
|
||||||
|
|
||||||
|
analyze:
|
||||||
|
stage: analyze
|
||||||
|
script:
|
||||||
|
- echo "Starting Code Analysis..."
|
||||||
|
- mvn $MVN_OPTS verify sonar:sonar -Pcoverage
|
||||||
|
|||||||
44
Script/CI_SonarQube_CLI.sh
Normal file
44
Script/CI_SonarQube_CLI.sh
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
mvn \
|
||||||
|
--batch-mode \
|
||||||
|
--errors \
|
||||||
|
--fail-at-end \
|
||||||
|
--show-version \
|
||||||
|
--no-transfer-progress \
|
||||||
|
-DinstallAtEnd=true \
|
||||||
|
-DdeployAtEnd=true \
|
||||||
|
-Dsonar.host.url=https://sonar.fbe-adswen.rwu.de \
|
||||||
|
-Dsonar.token=sqa_c39258caceb01d59515d6dfa9440a7b05cdd15f4 \
|
||||||
|
-Dhttps.protocols=TLSv1.2 \
|
||||||
|
-Dorg.slf4j.simpleLogger.showDateTime=true \
|
||||||
|
-Djava.awt.headless=true \
|
||||||
|
clean compile
|
||||||
|
|
||||||
|
mvn \
|
||||||
|
--batch-mode \
|
||||||
|
--errors \
|
||||||
|
--fail-at-end \
|
||||||
|
--show-version \
|
||||||
|
--no-transfer-progress \
|
||||||
|
-DinstallAtEnd=true \
|
||||||
|
-DdeployAtEnd=true \
|
||||||
|
-Dsonar.host.url=https://sonar.fbe-adswen.rwu.de \
|
||||||
|
-Dsonar.token=sqa_c39258caceb01d59515d6dfa9440a7b05cdd15f4 \
|
||||||
|
-Dhttps.protocols=TLSv1.2 \
|
||||||
|
-Dorg.slf4j.simpleLogger.showDateTime=true \
|
||||||
|
-Djava.awt.headless=true \
|
||||||
|
test
|
||||||
|
|
||||||
|
mvn \
|
||||||
|
--batch-mode \
|
||||||
|
--errors \
|
||||||
|
--fail-at-end \
|
||||||
|
--show-version \
|
||||||
|
--no-transfer-progress \
|
||||||
|
-DinstallAtEnd=true \
|
||||||
|
-DdeployAtEnd=true \
|
||||||
|
-Dsonar.host.url=https://sonar.fbe-adswen.rwu.de \
|
||||||
|
-Dsonar.token=sqa_c39258caceb01d59515d6dfa9440a7b05cdd15f4 \
|
||||||
|
-Dhttps.protocols=TLSv1.2 \
|
||||||
|
-Dorg.slf4j.simpleLogger.showDateTime=true \
|
||||||
|
-Djava.awt.headless=true \
|
||||||
|
verify sonar:sonar -Pcoverage
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>de.rwu</groupId>
|
|
||||||
<artifactId>easydrop</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<name>easydrop</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.13.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mockito</groupId>
|
|
||||||
<artifactId>mockito-core</artifactId>
|
|
||||||
<version>5.3.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
|
||||||
<version>3.2.2</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>checkstyle-check</id>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<configuration>
|
|
||||||
<configLocation>google_checks.xml</configLocation>
|
|
||||||
<failOnViolation>true</failOnViolation>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>check</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.jacoco</groupId>
|
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
|
||||||
<version>0.8.10</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>prepare-agent</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>generate-code-coverage-report</id>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>report</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package de.rwu;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hello world!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class App
|
|
||||||
{
|
|
||||||
public static void main( String[] args )
|
|
||||||
{
|
|
||||||
System.out.println( "Hello World!" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package de.rwu;
|
|
||||||
|
|
||||||
public class DemoClass {
|
|
||||||
public String demoMethod() {
|
|
||||||
return "success!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package de.rwu;
|
|
||||||
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit test for simple App.
|
|
||||||
*/
|
|
||||||
public class AppTest
|
|
||||||
extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create the test case
|
|
||||||
*
|
|
||||||
* @param testName name of the test case
|
|
||||||
*/
|
|
||||||
public AppTest( String testName )
|
|
||||||
{
|
|
||||||
super( testName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the suite of tests being tested
|
|
||||||
*/
|
|
||||||
public static Test suite()
|
|
||||||
{
|
|
||||||
return new TestSuite( AppTest.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rigourous Test :-)
|
|
||||||
*/
|
|
||||||
public void testApp()
|
|
||||||
{
|
|
||||||
assertTrue( true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package de.rwu;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class DemoClassTest {
|
|
||||||
@Test
|
|
||||||
public void testDemoMethod() {
|
|
||||||
DemoClass demoClass = new DemoClass();
|
|
||||||
String result = demoClass.demoMethod();
|
|
||||||
assertEquals("success!", result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
106
pom.xml
Normal file
106
pom.xml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>de.rwu</groupId>
|
||||||
|
<artifactId>easydrop</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<version>0.1-SNAPSHOT</version>
|
||||||
|
<name>EasyDrop</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<version>5.3.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<version>3.2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>checkstyle-check</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<configuration>
|
||||||
|
<failOnViolation>true</failOnViolation>
|
||||||
|
<consoleOutput>true</consoleOutput>
|
||||||
|
<failsOnError>true</failsOnError>
|
||||||
|
<linkXRef>false</linkXRef>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<version>0.8.10</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>coverage</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<version>0.8.10</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>generate-code-coverage-report</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>report</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<reportSets>
|
||||||
|
<reportSet>
|
||||||
|
<reports>
|
||||||
|
<report>report</report>
|
||||||
|
</reports>
|
||||||
|
</reportSet>
|
||||||
|
</reportSets>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
</project>
|
||||||
16
src/main/java/de/rwu/easydrop/demo/DemoClass.java
Normal file
16
src/main/java/de/rwu/easydrop/demo/DemoClass.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package de.rwu.easydrop.demo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demo-Class.
|
||||||
|
*/
|
||||||
|
public final class DemoClass {
|
||||||
|
/**
|
||||||
|
* Demo-Method inverting a boolean.
|
||||||
|
*
|
||||||
|
* @param bool Input Boolean
|
||||||
|
* @return Inverted Boolean
|
||||||
|
*/
|
||||||
|
public boolean invertBool(final boolean bool) {
|
||||||
|
return !bool;
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/main/java/de/rwu/easydrop/demo/package-info.java
Normal file
6
src/main/java/de/rwu/easydrop/demo/package-info.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Dieses Paket beinhaltet ist zu Demo-Zwecken.
|
||||||
|
*
|
||||||
|
* @since 0.1-SNAPSHOT
|
||||||
|
*/
|
||||||
|
package de.rwu.easydrop.demo;
|
||||||
19
src/test/java/de/rwu/easydrop/demo/DemoClassTest.java
Normal file
19
src/test/java/de/rwu/easydrop/demo/DemoClassTest.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package de.rwu.easydrop.demo;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class DemoClassTest {
|
||||||
|
private final DemoClass demoClass = new DemoClass();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvertBoolTrue() {
|
||||||
|
assertEquals("Inverting true should return false", false, demoClass.invertBool(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvertBoolFalse() {
|
||||||
|
assertEquals("Inverting false should return true", true, demoClass.invertBool(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user