mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Add Jenkinsfile for CI pipeline
This commit is contained in:
parent
836d111e99
commit
582832cce5
1 changed files with 35 additions and 0 deletions
35
Jenkinsfile
vendored
Normal file
35
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
cron('H/10 * * * 1') // This triggers the job every 10 minutes on Mondays
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Ensure you have Maven installed in your Jenkins instance
|
||||||
|
sh 'mvn clean package'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Code Coverage') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Run tests and generate code coverage report using Jacoco
|
||||||
|
sh 'mvn clean test jacoco:report'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
// Archive the code coverage report
|
||||||
|
junit '**/target/surefire-reports/*.xml' // Adjust the path if necessary
|
||||||
|
publishCoverage adapters: [jacocoAdapter('**/target/jacoco.exec')]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue