You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by aa...@apache.org on 2022/09/01 07:46:39 UTC

[rocketmq-clients] branch master updated: Add golang coverage badge (#220)

This is an automated email from the ASF dual-hosted git repository.

aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ecee11  Add golang coverage badge (#220)
5ecee11 is described below

commit 5ecee11bb1e4e445ae2f3493330cca56eb10cd1f
Author: Aaron Ai <ya...@gmail.com>
AuthorDate: Thu Sep 1 15:46:35 2022 +0800

    Add golang coverage badge (#220)
---
 .codecov.yml                          |  6 +++++-
 .github/workflows/golang_coverage.yml | 29 +++++++++++++++++++++++++++++
 README.md                             |  2 ++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/.codecov.yml b/.codecov.yml
index 9c76c1a..7794ca3 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -21,4 +21,8 @@ flags:
   java:
     carryforward: true
     paths:
-      - "java/**"
\ No newline at end of file
+      - "java/**"
+  golang:
+    carryforward: true
+    paths:
+      - "golang/**"
diff --git a/.github/workflows/golang_coverage.yml b/.github/workflows/golang_coverage.yml
new file mode 100644
index 0000000..3e1090f
--- /dev/null
+++ b/.github/workflows/golang_coverage.yml
@@ -0,0 +1,29 @@
+name: Golang Coverage
+on:
+  pull_request:
+    types: [opened, reopened, synchronize]
+    paths:
+      - 'golang/**'
+  push:
+    branches:
+      - master
+jobs:
+  calculate-coverage:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set up Golang ${{ matrix.go }}
+        uses: actions/setup-go@v2
+        with:
+          go-version: ${{ matrix.go }}
+      - name: Generate coverage report
+        working-directory: ./golang
+        run: go test -coverprofile coverage.out
+      - name: Upload to Codecov
+        uses: codecov/codecov-action@v3
+        with:
+          file: ./golang/coverage.out
+          flags: golang
+          fail_ci_if_error: true
+          verbose: true
\ No newline at end of file
diff --git a/README.md b/README.md
index 6a870a4..75851ab 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@
 [![Golang][golang-image]][golang-url]
 [![Codecov-cpp][codecov-cpp-image]][codecov-url]
 [![Codecov-java][codecov-java-image]][codecov-url]
+[![Codecov-golang][codecov-golang-image]][codecov-url]
 [![Maven Central][maven-image]][maven-url]
 
 ## Overview
@@ -55,6 +56,7 @@ Provide cloud-native and robust solutions for Java, C++, C#, Golang, Rust and al
 [golang-url]: https://github.com/apache/rocketmq-clients/actions/workflows/golang_build.yml
 [codecov-cpp-image]: https://img.shields.io/codecov/c/gh/apache/rocketmq-clients/master?flag=cpp&label=CPP%20Coverage&logo=codecov
 [codecov-java-image]: https://img.shields.io/codecov/c/gh/apache/rocketmq-clients/master?flag=java&label=Java%20Coverage&logo=codecov
+[codecov-golang-image]: https://img.shields.io/codecov/c/gh/apache/rocketmq-clients/master?flag=golang&label=Golang%20Coverage&logo=codecov
 [codecov-url]: https://codecov.io/gh/apache/rocketmq-clients/branch/master/
 [maven-image]: https://maven-badges.herokuapp.com/maven-central/org.apache.rocketmq/rocketmq-client-java/badge.svg
 [maven-url]: https://maven-badges.herokuapp.com/maven-central/org.apache.rocketmq/rocketmq-client-java
\ No newline at end of file