Skip to content

Commit

Permalink
add Code Coverage Report (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang authored Apr 12, 2022
1 parent d4c23fe commit e94d0aa
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,52 @@ jobs:
codecov:
name: Codecov
runs-on: ubuntu-latest
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
zookeeper:
image: zookeeper
ports:
- 2181:2181
steps:
- name: Start Mysql
run: sudo /etc/init.d/mysql start

- name: Checkout
uses: actions/checkout@master

- name: Run Codecov
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}

- name: Init CosId-Db
run: mysql -vvv -h localhost -uroot -proot < cosid-jdbc/src/main/init-script/init-cosid-mysql.sql

- name: Check
run: gradle check

- name: Build Code Coverage Report
run: gradle codeCoverageReport

- name: Upload Code Coverage Report to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
# directory: ./build/reports/jacoco/codeCoverageReport/
files: ./build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml
path_to_write_report: ./coverage/codecov_report.txt
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![GitHub release](https://img.shields.io/github/release/Ahoo-Wang/CosId.svg)](https://github.com/Ahoo-Wang/CosId/releases)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dfd1d6237a1644409548ebfbca300dc1)](https://app.codacy.com/gh/Ahoo-Wang/CosId?utm_source=github.com&utm_medium=referral&utm_content=Ahoo-Wang/CosId&utm_campaign=Badge_Grade_Settings)
[![codecov](https://codecov.io/gh/Ahoo-Wang/CosId/branch/main/graph/badge.svg?token=L0N51NB7ET)](https://codecov.io/gh/Ahoo-Wang/CosId)

> [中文文档](https://cosid.ahoo.me/)
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![GitHub release](https://img.shields.io/github/release/Ahoo-Wang/CosId.svg)](https://github.com/Ahoo-Wang/CosId/releases)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dfd1d6237a1644409548ebfbca300dc1)](https://app.codacy.com/gh/Ahoo-Wang/CosId?utm_source=github.com&utm_medium=referral&utm_content=Ahoo-Wang/CosId&utm_campaign=Badge_Grade_Settings)
[![codecov](https://codecov.io/gh/Ahoo-Wang/CosId/branch/main/graph/badge.svg?token=L0N51NB7ET)](https://codecov.io/gh/Ahoo-Wang/CosId)

> [English Document](https://github.com/Ahoo-Wang/CosId/blob/main/README.md)
Expand Down
18 changes: 16 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

plugins {
id("io.github.gradle-nexus.publish-plugin")
java
jacoco
}

val bomProjects = setOf(
Expand Down Expand Up @@ -45,7 +47,6 @@ ext {
set("libraryProjects", libraryProjects)
}


allprojects {
repositories {
mavenLocal()
Expand All @@ -69,6 +70,7 @@ configure(libraryProjects) {
configure<com.github.spotbugs.snom.SpotBugsExtension> {
excludeFilter.set(file("${rootDir}/config/spotbugs/exclude.xml"))
}
apply<JacocoPlugin>()
apply<JavaLibraryPlugin>()
configure<JavaPluginExtension> {
toolchain {
Expand Down Expand Up @@ -210,4 +212,16 @@ nexusPublishing {

fun getPropertyOf(name: String) = project.properties[name]?.toString()


tasks.register<JacocoReport>("codeCoverageReport") {
executionData(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))
libraryProjects.forEach {
sourceSets(it.sourceSets.main.get())
}
reports {
xml.required.set(true)
html.outputLocation.set(file("${buildDir}/reports/jacoco/report.xml"))
csv.required.set(false)
html.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/"))
}
}
3 changes: 3 additions & 0 deletions document/docs/blog/CosId-Integration-ShardingSphere.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CosId 集成 ShardingSphere


1 change: 1 addition & 0 deletions document/docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![GitHub release](https://img.shields.io/github/release/Ahoo-Wang/CosId.svg)](https://github.com/Ahoo-Wang/CosId/releases)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dfd1d6237a1644409548ebfbca300dc1)](https://app.codacy.com/gh/Ahoo-Wang/CosId?utm_source=github.com&utm_medium=referral&utm_content=Ahoo-Wang/CosId&utm_campaign=Badge_Grade_Settings)
[![codecov](https://codecov.io/gh/Ahoo-Wang/CosId/branch/main/graph/badge.svg?token=L0N51NB7ET)](https://codecov.io/gh/Ahoo-Wang/CosId)

<p align="center" >
<img width="200" :src="$withBase('/logo.png')" alt="Throughput-Of-SegmentChainId"/>
Expand Down

0 comments on commit e94d0aa

Please sign in to comment.