OCT 1. 更新 gitlab-ci 配置, 支持 jacoco

This commit is contained in:
黄昕 2024-03-06 09:51:43 +08:00
parent 83881ac808
commit b16e35a596
2 changed files with 36 additions and 35 deletions

View File

@ -3,6 +3,7 @@ stages :
- sonarqube-check
- compile
- integration-test
- coverage
- package
sonarqube-check :
@ -37,7 +38,7 @@ compile :
- echo "=============== 开始编译任务 ==============="
- mvn clean compile -DskipTests
# 打包
# 集成测试
integration-test:
stage : integration-test
tags :
@ -54,6 +55,16 @@ integration-test:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml
coverage :
stage : coverage
tags :
- linux-maven
only :
- master
script:
- echo "=============== 开始代码覆盖率检测任务 ==============="
- mvn package
# 打包
package :
stage : package

58
pom.xml
View File

@ -177,6 +177,11 @@
<artifactId>mapstruct-processor</artifactId>
<version>1.5.5.Final</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</dependency>
</dependencies>
<build>
@ -248,6 +253,25 @@
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
@ -278,38 +302,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>