mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 00:31:22 +00:00
Add CI support for code coverage
This commit is contained in:
committed by
Guillaume Smet
parent
8b1a42aae4
commit
3a35468e20
@@ -1,5 +1,6 @@
|
||||
parameters:
|
||||
jdk: 1.8
|
||||
extra:
|
||||
|
||||
steps:
|
||||
- task: CacheBeta@0 #we know the very first job will have restored or created this, so this will never write built artifacts to the cache
|
||||
|
||||
@@ -95,10 +95,27 @@ stages:
|
||||
steps:
|
||||
- template: jvm-build-steps.yaml
|
||||
parameters:
|
||||
# we only generate the PDF documentation once for the initial JDK 8 build
|
||||
extra: '-Ddocumentation-pdf'
|
||||
# we only generate the PDF documentation and test coverage once for the initial JDK 8 build
|
||||
extra: '-Ddocumentation-pdf -Ptest-coverage'
|
||||
- publish: $(MAVEN_CACHE_FOLDER)
|
||||
artifact: $(Build.SourceVersion)-BuiltMavenRepo
|
||||
|
||||
- task: Maven@3
|
||||
displayName: 'Aggregate Code Coverage'
|
||||
inputs:
|
||||
mavenPomFile: 'coverage-report/pom.xml'
|
||||
goals: 'install'
|
||||
mavenOptions: $(MAVEN_OPTS)
|
||||
options: '-B --settings azure-mvn-settings.xml -Dno-native -Dno-format'
|
||||
|
||||
- task: PublishCodeCoverageResults@1
|
||||
inputs:
|
||||
codeCoverageTool: 'JaCoCo'
|
||||
summaryFileLocation: 'coverage-report/target/site/jacoco/jacoco.xml'
|
||||
pathToSources: 'coverage-report/src/main/java'
|
||||
reportDirectory: 'coverage-report/target/site/jacoco/'
|
||||
failIfCoverageEmpty: true
|
||||
|
||||
- template: prepare-cache.yaml
|
||||
|
||||
- stage: run_jvm_tests_stage${{parameters.expectUseVMs}}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<executable>prepare.sh</executable>
|
||||
<executable>${project.basedir}/prepare.sh</executable>
|
||||
<workingDirectory>${project.basedir}</workingDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@@ -61,13 +61,6 @@
|
||||
</fileSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-report</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -5,14 +5,24 @@ mkdir -p src/main/java
|
||||
|
||||
for j in '../extensions' '../core' '../devtools' '../independent-projects/'
|
||||
do
|
||||
for i in `find $j -regex .*target/classes `
|
||||
for i in `find $j -regex .*target/classes`
|
||||
do
|
||||
cp -r $i/* target/classes/
|
||||
done
|
||||
for i in `find $j -regex .*src/main/java `
|
||||
for i in `find $j -regex .*src/main/java`
|
||||
do
|
||||
cp -r $i/* src/main/java/
|
||||
done
|
||||
done
|
||||
#needed to make sure the script always suceeds
|
||||
|
||||
#we don't care about classes in the 'graal' package, because they are only used in native image generation
|
||||
find target/classes/ -name graal -exec rm -r {} \;
|
||||
|
||||
#antlr generated code
|
||||
rm -r target/classes/io/quarkus/panacheql/internal
|
||||
|
||||
#we don't care about the document processor
|
||||
rm -r target/classes/io/quarkus/annotation/processor/generate_doc
|
||||
|
||||
#needed to make sure the script always succeeds
|
||||
echo "complete"
|
||||
|
||||
131
pom.xml
131
pom.xml
@@ -159,137 +159,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<!--
|
||||
JaCoCo based code coverage analysis
|
||||
|
||||
mvn -Pjacoco clean verify
|
||||
mvn antrun:run@jacoco-all-in-one-report -Pjacoco-report
|
||||
open target/jacoco-report/index.html
|
||||
-->
|
||||
<profile>
|
||||
<id>jacoco</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>${jacoco.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-prepare</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<destFile>${project.build.directory}/jacoco.exec</destFile>
|
||||
<includes>
|
||||
<include>*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>io.quarkus.it.*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jacoco-report-per-module</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jacoco-report</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<phase>process-test-resources</phase>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>org.jacoco.ant</artifactId>
|
||||
<version>${jacoco.version}</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<stripVersion>true</stripVersion>
|
||||
<outputDirectory>${project.build.directory}/jacoco-jars</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>org.jacoco.ant</artifactId>
|
||||
<version>${jacoco.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-all-in-one-report</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef name="report" classname="org.jacoco.ant.ReportTask">
|
||||
<classpath path="${project.build.directory}/jacoco-jars/org.jacoco.ant.jar"/>
|
||||
</taskdef>
|
||||
<echo>Creating JaCoCo for Quarkus code coverage reports</echo>
|
||||
<report>
|
||||
<executiondata>
|
||||
<fileset dir="${basedir}">
|
||||
<include name="**/target/jacoco.exec"/>
|
||||
</fileset>
|
||||
</executiondata>
|
||||
<structure name="JaCoCo for Quarkus">
|
||||
<classfiles>
|
||||
<fileset dir="${basedir}">
|
||||
<include name="**/*${project.version}.jar"/>
|
||||
<exclude name="**/target/lib/*.jar"/>
|
||||
<exclude name="independent-projects/**/*.jar"/>
|
||||
<exclude name="integration-tests/**/*.jar"/>
|
||||
<exclude name="**/*quarkus-cli-${project.version}.jar"/>
|
||||
</fileset>
|
||||
</classfiles>
|
||||
<sourcefiles encoding="UTF-8">
|
||||
<dirset dir="${basedir}">
|
||||
<include name="**/src/main/java"/>
|
||||
</dirset>
|
||||
</sourcefiles>
|
||||
</structure>
|
||||
<html destdir="target/jacoco-report"/>
|
||||
<xml destfile="target/jacoco-report/report.xml"/>
|
||||
</report>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>tcks</id>
|
||||
<activation>
|
||||
|
||||
Reference in New Issue
Block a user