ci: 覆盖率统计

This commit is contained in:
CaptainB 2023-04-26 17:37:12 +08:00 committed by 刘瑞斌
parent 438fbb800d
commit 1b33367852
3 changed files with 42 additions and 94 deletions

21
.github/workflows/codecov.yml vendored Normal file
View File

@ -0,0 +1,21 @@
on: pull_request
name: MeterSphere 覆盖率统计
permissions:
pull-requests: write
jobs:
generic_handler:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

View File

@ -1,93 +0,0 @@
package io.metersphere.track.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TrackLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("test-track");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

22
pom.xml
View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.5</version> <version>3.0.6</version>
<relativePath/> <relativePath/>
</parent> </parent>
@ -93,6 +93,7 @@
<!-- --> <!-- -->
<skipAntRunForJenkins>false</skipAntRunForJenkins> <skipAntRunForJenkins>false</skipAntRunForJenkins>
<commons-dbcp2-version>2.9.0</commons-dbcp2-version> <commons-dbcp2-version>2.9.0</commons-dbcp2-version>
<jacoco.version>0.8.7</jacoco.version>
</properties> </properties>
<modules> <modules>
@ -211,6 +212,25 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</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>
</plugins> </plugins>
</build> </build>
</project> </project>