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

eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new c7cc668230 Add code coverage report and upload to Codecov (#3586)
c7cc668230 is described below

commit c7cc668230b7a2d5f114f37709d01a1449caea12
Author: Lishen Yao <[email protected]>
AuthorDate: Mon Jan 30 16:01:08 2023 +0800

    Add code coverage report and upload to Codecov (#3586)
---
 .github/workflows/bk-ci.yml | 15 ++++++++++++++-
 .gitignore                  |  2 ++
 pom.xml                     |  8 ++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/bk-ci.yml b/.github/workflows/bk-ci.yml
index 7a9989d8c5..03ff639e70 100644
--- a/.github/workflows/bk-ci.yml
+++ b/.github/workflows/bk-ci.yml
@@ -99,23 +99,30 @@ jobs:
         include:
           - step_name: Bookie Tests
             module: bookkeeper-server
+            flag: bookie
             test_args: "-Dtest='org.apache.bookkeeper.bookie.**'"
           - step_name: Client Tests
             module: bookkeeper-server
+            flag: client
             test_args: "-Dtest='org.apache.bookkeeper.client.**'"
           - step_name: Remaining Tests
             module: bookkeeper-server
+            flag: remaining
             test_args: "-Dtest='org.apache.bookkeeper.replication.**'"
           - step_name: Replication Tests
             module: bookkeeper-server
+            flag: replication
             test_args: 
"-Dtest='!org.apache.bookkeeper.client.**,!org.apache.bookkeeper.bookie.**,!org.apache.bookkeeper.replication.**,!org.apache.bookkeeper.tls.**'"
           - step_name: TLS Tests
             module: bookkeeper-server
+            flag: tls
             test_args: "-Dtest='org.apache.bookkeeper.tls.**'"
           - step_name: StreamStorage Tests
             test_args: "-f stream/pom.xml -DstreamTests"
+            flag: stream
           - step_name: Shell tests
             module: tests/scripts
+            flag: shell
 
     steps:
       - name: checkout
@@ -155,7 +162,13 @@ jobs:
           if [[ ! -z "${{ matrix.module }}" ]]; then
             projects_list="-pl ${{ matrix.module }}"
           fi
-          mvn -B -nsu $projects_list verify ${{ matrix.test_args }}
+          mvn -Pcode-coverage -B -nsu $projects_list verify ${{ 
matrix.test_args }}
+
+      - name: Upload coverage to Codecov
+        if: ${{ matrix.flag }} != 'shell'
+        uses: codecov/codecov-action@v3
+        with:
+          flags: ${{ matrix.flag }}
 
       - name: Aggregates all test reports to ./test-reports and 
./surefire-reports directories
         if: ${{ always() }}
diff --git a/.gitignore b/.gitignore
index e9608507fb..7915540515 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,3 +44,5 @@ package-lock.json
 # gradle
 build/
 .gradle/
+*.log
+*.dat
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ff54da1bcc..de8cf02080 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1142,10 +1142,18 @@
             <version>${jacoco-maven-plugin.version}</version>
             <executions>
               <execution>
+                <id>pre-test</id>
                 <goals>
                   <goal>prepare-agent</goal>
                 </goals>
               </execution>
+              <execution>
+                <id>post-test</id>
+                <phase>test</phase>
+                <goals>
+                  <goal>report</goal>
+                </goals>
+              </execution>
             </executions>
           </plugin>
         </plugins>

Reply via email to