diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 785694da2b..320589d00c 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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 diff --git a/README.md b/README.md index 8198808a92..6395ccb3cb 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/README.zh-CN.md b/README.zh-CN.md index 2f52b6812a..fd3974393a 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -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) diff --git a/build.gradle.kts b/build.gradle.kts index e035b0d69b..f24e9dda77 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,6 +13,8 @@ plugins { id("io.github.gradle-nexus.publish-plugin") + java + jacoco } val bomProjects = setOf( @@ -45,7 +47,6 @@ ext { set("libraryProjects", libraryProjects) } - allprojects { repositories { mavenLocal() @@ -69,6 +70,7 @@ configure(libraryProjects) { configure { excludeFilter.set(file("${rootDir}/config/spotbugs/exclude.xml")) } + apply() apply() configure { toolchain { @@ -210,4 +212,16 @@ nexusPublishing { fun getPropertyOf(name: String) = project.properties[name]?.toString() - +tasks.register("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/")) + } +} diff --git a/document/docs/blog/CosId-Integration-ShardingSphere.md b/document/docs/blog/CosId-Integration-ShardingSphere.md new file mode 100644 index 0000000000..235e35b1a5 --- /dev/null +++ b/document/docs/blog/CosId-Integration-ShardingSphere.md @@ -0,0 +1,3 @@ +# CosId 集成 ShardingSphere + + diff --git a/document/docs/guide/README.md b/document/docs/guide/README.md index 6f563ebbf8..218938ae11 100644 --- a/document/docs/guide/README.md +++ b/document/docs/guide/README.md @@ -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)

Throughput-Of-SegmentChainId