Skip to content

Commit

Permalink
optimize jenkins tests, add sonarcloud (#16)
Browse files Browse the repository at this point in the history
* add sonarcloud & jacoco coverage

* split unit and integrated tests, add sonarcloud to jenkins
  • Loading branch information
Danconnolly committed Jan 29, 2018
1 parent caa169d commit 29d16b9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/pom.xml
Expand Up @@ -50,6 +50,10 @@
</developer>
</developers>

<properties>
<sonar.exclusions>**/*Protos.java,**/ClientState.java,**/ServerState.java</sonar.exclusions>
</properties>

<profiles>
<profile>
<id>dev</id> <!-- default profile -->
Expand All @@ -66,6 +70,7 @@
<!-- exclude postgres and mysql tests, these need environment setup -->
<exclude>**/PostgresFullPrunedBlockChainIT.java</exclude>
<exclude>**/MySQLFullPrunedBlockChainIT.java</exclude>
<skipTests>${skipIntegrationTests}</skipTests>
</excludes>
</configuration>
</plugin>
Expand Down Expand Up @@ -124,6 +129,7 @@
<exclude>**/core/PeerTest.java</exclude>
<exclude>**/core/TransactionBroadcastTest.java</exclude>
</excludes>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -351,6 +357,7 @@
<configuration>
<argLine>-Xmx1024m ${surefireArgLine}</argLine><!-- Last argument is required for code coverage to work. -->
<runOrder>alphabetical</runOrder>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>

Expand All @@ -361,6 +368,7 @@
<configuration>
<runOrder>alphabetical</runOrder>
<argLine>${failsafeArgLine}</argLine>
<skipTests>${skipIntegrationTests}</skipTests>
</configuration>
<executions>
<execution>
Expand Down
31 changes: 30 additions & 1 deletion jenkins/Jenkinsfile
Expand Up @@ -16,7 +16,8 @@
// Jenkins integration tests for BitcoinJ Cash

// tested with Jenkins v2.89.3
// required plugins: ansiColor
// required plugins: ansiColor, jaCoCo
// for central jenkins, also need SonarQube scanner plugin

pipeline {
agent {
Expand Down Expand Up @@ -53,6 +54,13 @@ pipeline {
}
}


/*
*
* various integration tests
*
*/

// test syncing with testnet
stage('test testnet sync') {
steps {
Expand All @@ -70,11 +78,32 @@ pipeline {
}
}
}


/*
*
* other reporting & analysis
*
*/

// perform SonarQube, but only for main dev branch and main repo
stage('SonarQube analysis') {
when {
branch 'cash'
environment name: 'GIT_URL', value: 'https://github.com/bitcoinj-cash/bitcoinj.git'
}
steps {
withSonarQubeEnv('SonarCloud') {
sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.organization=bitcoinj-cash'
}
}
}
}

post {
always {
junit '**/target/*-reports/*.xml'
jacoco(execPattern: '**/target/jacoco.exec')
}
success {
archive '**/target/*.jar'
Expand Down
3 changes: 3 additions & 0 deletions pom.xml
Expand Up @@ -59,6 +59,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<generated.sourceDirectory>gen</generated.sourceDirectory>
<slf4j.version>1.7.25</slf4j.version>
<skipTests>false</skipTests>
<skipUnitTests>${skipTests}</skipUnitTests>
<skipIntegrationTests>${skipTests}</skipIntegrationTests>
</properties>


Expand Down

0 comments on commit 29d16b9

Please sign in to comment.