Merge branch 'gitlab-coverage' into 'master'
Add gitlab coverage report See merge request oysteikt/tdt4100-project-2021v!2
This commit is contained in:
commit
eafbd2e023
@ -22,8 +22,11 @@ cache:
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- coverage
|
||||
- report
|
||||
- deploy
|
||||
|
||||
build-job:
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- "mvn clean compile $MAVEN_CLI_OPTS"
|
||||
@ -31,10 +34,9 @@ build-job:
|
||||
paths:
|
||||
- target/
|
||||
|
||||
unittest-job:
|
||||
unittest:
|
||||
stage: test
|
||||
dependencies:
|
||||
- build-job
|
||||
needs: [build]
|
||||
script:
|
||||
- "mvn package $MAVEN_CLI_OPTS"
|
||||
artifacts:
|
||||
@ -46,7 +48,39 @@ unittest-job:
|
||||
- target/surefire-reports/TEST-*.xml
|
||||
- target/failsafe-reports/TEST-*.xml
|
||||
|
||||
generate-coverage:
|
||||
stage: coverage
|
||||
script:
|
||||
- 'mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report'
|
||||
artifacts:
|
||||
paths:
|
||||
- target/site/
|
||||
- target/site/jacoco/jacoco.xml
|
||||
|
||||
report-coverage:
|
||||
stage: report
|
||||
image: haynes/jacoco2cobertura:1.0.4
|
||||
script:
|
||||
# convert report from jacoco to cobertura
|
||||
- 'python /opt/cover2cover.py target/site/jacoco/jacoco.xml src/main/java > target/site/cobertura.xml'
|
||||
# read the <source></source> tag and prepend the path to every filename attribute
|
||||
- 'python /opt/source2filename.py target/site/cobertura.xml'
|
||||
needs: [generate-coverage]
|
||||
artifacts:
|
||||
reports:
|
||||
cobertura: target/site/cobertura.xml
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
needs: [generate-coverage]
|
||||
script:
|
||||
- mv target/site/* public/
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
expire_in: 30 days
|
||||
only:
|
||||
- master
|
||||
|
||||
# integrationtest-job:
|
||||
# stage: test
|
||||
|
30
pom.xml
30
pom.xml
@ -88,7 +88,12 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<argLine>--enable-preview</argLine>
|
||||
<argLine>@{argLine} --enable-preview</argLine>
|
||||
<forkCount>1</forkCount>
|
||||
<reuseForks>true</reuseForks>
|
||||
<!-- <includes>
|
||||
<include>**/test/**/*Test.java</include>
|
||||
</includes> -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@ -101,6 +106,29 @@
|
||||
<mainClass>app.Main</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-report</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
Loading…
Reference in New Issue
Block a user