Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and enable build profiling extensions #1498

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<!-- <extension>-->
<!-- &lt;!&ndash; outputs resultt directly to the build log &ndash;&gt;-->
<!-- <groupId>com.soebes.maven.extensions</groupId>-->
<!-- <artifactId>maven-buildtime-profiler</artifactId>-->
<!-- <version>0.2.0</version>-->
<!-- </extension>-->

<extension>
<!-- outputs log only in debug mode, for convenience can output to csv file:
`-Dbuildtime.output.csv=true -Dbuildtime.output.csv.file=buildtime.csv` -->
<groupId>co.leantechniques</groupId>
<artifactId>maven-buildtime-extension</artifactId>
<version>3.0.3</version>
</extension>

<extension>
<!-- requires enabling during execution: `-Dprofile -DprofileFormat=JSON,HTML` -->
<groupId>fr.jcgay.maven</groupId>
<artifactId>maven-profiler</artifactId>
<version>3.2</version>
</extension>
</extensions>

20 changes: 17 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pipeline {
MVN_LOCAL_REPO_OPT = '-Dmaven.repo.local=.repository'
MVN_TEST_FAIL_IGNORE = '-Dmaven.test.failure.ignore=true'
MVN_SHOW_TIMESTAMPS="-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS"
MVN_PROFILING = '-Dbuildtime.output.csv=true -Dprofile -DprofileFormat=JSON,HTML'
CI = true
LC_CTYPE = 'en_US.UTF-8'
}
Expand Down Expand Up @@ -85,19 +86,29 @@ pipeline {
stage('Build') {
steps {
echo 'Building'
sh 'mvn -U -B -e clean install -DskipTests -T1C ${MVN_SHOW_TIMESTAMPS} ${MVN_LOCAL_REPO_OPT}'
sh 'mvn -U -B -e clean install -DskipTests -T1C ${MVN_SHOW_TIMESTAMPS} ${MVN_LOCAL_REPO_OPT} ${MVN_PROFILING} -Dbuildtime.output.csv.file=buildstats_Build.csv'
}
post {
always {
archiveArtifacts artifacts: '**/target/buildstats*.log' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
archiveArtifacts artifacts: '**/.profiler/profiler-report*.html' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
archiveArtifacts artifacts: '**/.profiler/profiler-report*.json' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
}
}
}

stage('Stable Tests') {
steps {
echo 'Running tests'
sh 'mvn -B -e -fae test ${MVN_SHOW_TIMESTAMPS} -P ci-test ${MVN_LOCAL_REPO_OPT} -Dassembly.skipAssembly=true'
sh 'mvn -B -e -fae test ${MVN_SHOW_TIMESTAMPS} -P ci-test ${MVN_LOCAL_REPO_OPT} -Dassembly.skipAssembly=true ${MVN_PROFILING} -Dbuildtime.output.csv.file=buildstats_StableTests.csv'
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: false)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
archiveArtifacts artifacts: '**/target/buildstats*.log' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
archiveArtifacts artifacts: '**/.profiler/profiler-report*.html' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
archiveArtifacts artifacts: '**/.profiler/profiler-report*.json' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
}
failure {
archiveArtifacts artifacts: '**/target/test-run.log' , fingerprint: true
Expand All @@ -110,13 +121,16 @@ pipeline {
steps {
echo 'Running unstable tests'
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'mvn -B -e -fae test -Punstable-tests ${MVN_SHOW_TIMESTAMPS} -P ci-test ${MVN_LOCAL_REPO_OPT} -Dassembly.skipAssembly=true'
sh 'mvn -B -e -fae test -Punstable-tests ${MVN_SHOW_TIMESTAMPS} -P ci-test ${MVN_LOCAL_REPO_OPT} -Dassembly.skipAssembly=true ${MVN_PROFILING} -Dbuildtime.output.csv.file=buildstats_UnstableTests.csv'
}
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
archiveArtifacts artifacts: '**/target/buildstats*.log' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
archiveArtifacts artifacts: '**/.profiler/profiler-report*.html' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
archiveArtifacts artifacts: '**/.profiler/profiler-report*.json' , fingerprint: false, allowEmptyArchive: true, onlyIfSuccessful: true
}
failure {
archiveArtifacts artifacts: '**/target/test-run.log' , fingerprint: true
Expand Down