Add Jenkinsfile
zdm/event-bus/pipeline/head This commit looks good Details

The Jenkinsfile performs packaging and testing on the project. When on
the develop branch, a SonarQube analysis is conducted.
This commit is contained in:
Kai S. K. Engelbart 2022-01-09 09:27:44 +01:00
parent 27d14a844d
commit 09d251a02a
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
2 changed files with 66 additions and 5 deletions

41
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,41 @@
pipeline {
agent any
options {
ansiColor('xterm')
}
stages {
stage('Build') {
steps {
sh 'mvn -DskipTests clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
post {
always {
junit '*/target/surefire-reports/*.xml'
publishCoverage adapters: [jacocoAdapter(mergeToOneReport: true, path: '*/target/site/jacoco/jacoco.xml')]
}
}
}
stage('SonarQube Analysis') {
when {
branch 'develop'
}
steps {
withSonarQubeEnv('KSKE SonarQube') {
sh "$SONAR_MAVEN_GOAL"
}
}
}
}
post {
success {
archiveArtifacts artifacts: '*/target/event-bus-*.jar'
}
}
}

View File

@ -1,6 +1,4 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>event-bus-core</artifactId>
@ -26,14 +24,36 @@
<!-- Disable resource folder -->
<resources />
<!-- Run unit tests -->
<plugins>
<!-- Run unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
<!-- Generate coverage report -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>