Skip to content

Commit

Permalink
Fix coveralls integration
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Feb 23, 2024
1 parent 7069e61 commit ce347bd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
27 changes: 15 additions & 12 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,9 @@ function build() {
pmd_ci_openjdk_setdefault 17
# Note: Sonar also needs GITHUB_TOKEN (!)
./mvnw \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
--show-version --errors --batch-mode \
clean package \
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar,fastSkip
pmd_ci_log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
pmd_ci_log_group_end

Expand All @@ -151,15 +147,22 @@ function build() {
export CI_NAME="github actions"
export CI_BUILD_URL="${PMD_CI_JOB_URL}"
export CI_BRANCH="${PMD_CI_BRANCH}"
# first create jacoco report
./mvnw \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
-DrepoToken="${COVERALLS_REPO_TOKEN}" \
--show-version --errors --batch-mode \
clean package jacoco:report \
coveralls:report -Pcoveralls
clean package \
jacoco:report -Pcoveralls,fastSkip

# workaround, maybe https://github.com/jacoco/jacoco/issues/654
sed -i 's$Comparisons.kt$ApexTreeBuilder.kt$g' pmd-apex/target/site/jacoco/jacoco.xml

# then create and send coveralls report
# note: generate-sources is needed, so that antlr4 generated directories are on the compileSourceRoots
./mvnw \
--show-version --errors --batch-mode \
generate-sources \
coveralls:report -DrepoToken="${COVERALLS_REPO_TOKEN}" -Pcoveralls,fastSkip

pmd_ci_log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
pmd_ci_log_group_end
fi
Expand Down
34 changes: 20 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.11</version>
</plugin>
<plugin>
<groupId>org.cyclonedx</groupId>
Expand Down Expand Up @@ -1142,6 +1142,23 @@
</profile>

<profile>
<!-- skips many plugins. Useful for sonar and coveralls and reproducible builds -->
<id>fastSkip</id>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.source.skip>true</maven.source.skip>
<checkstyle.skip>true</checkstyle.skip>
<pmd.skip>true</pmd.skip>
<cpd.skip>true</cpd.skip>
<cyclonedx.skip>true</cyclonedx.skip>
<dokka.skip>true</dokka.skip>
</properties>
</profile>

<profile>
<!--
Configuration: https://docs.coveralls.io/java | https://github.com/hazendaz/coveralls-maven-plugin
Report is available here: https://coveralls.io/github/pmd/pmd -->
<id>coveralls</id>
<build>
<plugins>
Expand All @@ -1158,20 +1175,9 @@
</executions>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<groupId>com.github.hazendaz.maven</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
<dependencies>
<!--
coveralls maven plugin needs javax.xml.bind api
See also https://github.com/trautonen/coveralls-maven-plugin/issues/112
-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<version>4.5.0-M3</version>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit ce347bd

Please sign in to comment.