Fix coveralls integration

This commit is contained in:
Andreas Dangel 2024-02-23 10:56:30 +01:00
parent 7069e6146c
commit ce347bd736
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3
2 changed files with 35 additions and 26 deletions

View File

@ -136,13 +136,9 @@ function build() {
pmd_ci_openjdk_setdefault 17 pmd_ci_openjdk_setdefault 17
# Note: Sonar also needs GITHUB_TOKEN (!) # Note: Sonar also needs GITHUB_TOKEN (!)
./mvnw \ ./mvnw \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
--show-version --errors --batch-mode \ --show-version --errors --batch-mode \
clean package \ 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_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
pmd_ci_log_group_end pmd_ci_log_group_end
@ -151,15 +147,22 @@ function build() {
export CI_NAME="github actions" export CI_NAME="github actions"
export CI_BUILD_URL="${PMD_CI_JOB_URL}" export CI_BUILD_URL="${PMD_CI_JOB_URL}"
export CI_BRANCH="${PMD_CI_BRANCH}" export CI_BRANCH="${PMD_CI_BRANCH}"
# first create jacoco report
./mvnw \ ./mvnw \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
-DrepoToken="${COVERALLS_REPO_TOKEN}" \
--show-version --errors --batch-mode \ --show-version --errors --batch-mode \
clean package jacoco:report \ clean package \
coveralls:report -Pcoveralls 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_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
pmd_ci_log_group_end pmd_ci_log_group_end
fi fi

34
pom.xml
View File

@ -550,7 +550,7 @@
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version> <version>0.8.11</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.cyclonedx</groupId> <groupId>org.cyclonedx</groupId>
@ -1142,6 +1142,23 @@
</profile> </profile>
<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> <id>coveralls</id>
<build> <build>
<plugins> <plugins>
@ -1158,20 +1175,9 @@
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.eluder.coveralls</groupId> <groupId>com.github.hazendaz.maven</groupId>
<artifactId>coveralls-maven-plugin</artifactId> <artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version> <version>4.5.0-M3</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>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>