Add a Jenkinsfile that uses the new Git forensics features.
node {
+ def mvnHome = tool 'mvn-default'
+
stage ('Checkout') {
- checkout scm
+ git branch:'master', url: 'https://github.com/jenkinsci/analysis-model.git', credentialsId: 'github-app'
+ }
+
+ stage ('Git mining') {
+ gitForensics()
+ mineRepository()
}
- stage ('Build and Analysis') {
+ stage ('Build and Static Analysis') {
withMaven(maven: 'mvn-default', mavenLocalRepo: '/var/data/m2repository', mavenOpts: '-Xmx768m -Xms512m') {
- sh 'mvn -V -e clean verify -Dmaven.test.failure.ignore'
+ sh 'mvn -ntp -V -e clean verify -Dmaven.test.failure.ignore -Dgpg.skip'
}
- gitForensics()
- recordIssues tools: [java(), javaDoc()], aggregatingResults: 'true', id: 'java', name: 'Java', filters:[excludeFile('.*Assert.java')]
+ recordIssues tools: [java(), javaDoc()], aggregatingResults: 'true', id: 'java', name: 'Java'
recordIssues tool: errorProne(), healthy: 1, unhealthy: 20
+
junit testResults: '**/target/*-reports/TEST-*.xml'
- recordIssues tools: [mavenConsole(),
- checkStyle(pattern: 'target/checkstyle-result.xml'),
+ publishCoverage adapters: [jacocoAdapter('**/*/jacoco.xml')], sourceFileResolver: sourceFiles('STORE_ALL_BUILD')
+
+ recordIssues tools: [checkStyle(pattern: 'target/checkstyle-result.xml'),
spotBugs(pattern: 'target/spotbugsXml.xml'),
pmdParser(pattern: 'target/pmd.xml'),
cpd(pattern: 'target/cpd.xml'),
- taskScanner(highTags:'FIXME', normalTags:'TODO', includePattern: '**/*.java', excludePattern: 'target/**/*')]
+ taskScanner(highTags:'FIXME', normalTags:'TODO', includePattern: '**/*.java', excludePattern: 'target/**/*')],
+ qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]
+ recordIssues tool: mavenConsole()
+ }
+
+ stage ('Autograding') {
+ autoGrade('''
+ {
+ "analysis": {
+ "maxScore": 100,
+ "errorImpact": -5,
+ "highImpact": -2,
+ "normalImpact": -1,
+ "lowImpact": -1
+ },
+ "tests": {
+ "maxScore": 100,
+ "passedImpact": 0,
+ "failureImpact": -5,
+ "skippedImpact": -1
+ },
+ "coverage": {
+ "maxScore": 100,
+ "coveredPercentageImpact": 0,
+ "missedPercentageImpact": -1
+ }
+ }
+ '''
+ )
}
}
