Skip to content

Commit

Permalink
[improve][CI] Generate unit test code coverage reports and upload to …
Browse files Browse the repository at this point in the history
…Codecov (apache#17382)

* [improve][ci] Generate jacoco code coverage reports and upload to CodeCov

* [improve][ci] Generate jacoco code coverage reports and upload to CodeCov

* [improve][ci] Generate jacoco code coverage reports and upload to CodeCov

* [improve][ci] Generate jacoco code coverage reports and upload to CodeCov

* Add codecov configuration file

* Update codecov.yml

Co-authored-by: tison <wander4096@gmail.com>

* Change codecov comment behaviour configuration to default to reduce the email notification times.

* Allow CodeCov upload report job can be failure

* Include only apache/pulsar class to generate jacoco tests

* Include only apache/pulsar class to generate jacoco tests

* Exclude class files in META-INF and skip pulsar-all-docker-image in test_group_other

* Remove generate jacoco reports step in pulsar-ci

Co-authored-by: tison <wander4096@gmail.com>
  • Loading branch information
yaalsn and tisonkun committed Oct 11, 2022
1 parent 88e357a commit 9a8b68a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/pulsar-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ jobs:
if: ${{ always() }}
uses: ./.github/actions/copy-test-reports

- name: Upload to Codecov
uses: codecov/codecov-action@v3
continue-on-error: true
with:
flags: unittests

- name: Publish Test Report
uses: apache/pulsar-test-infra/action-junit-report@master
if: ${{ always() }}
Expand Down
4 changes: 2 additions & 2 deletions build/run_unit_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set -e
set -o pipefail
set -o errexit

MVN_TEST_OPTIONS='mvn -B -ntp -DskipSourceReleaseAssembly=true -DskipBuildDistribution=true -Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true'
MVN_TEST_OPTIONS='mvn -Pcoverage -B -ntp -DskipSourceReleaseAssembly=true -DskipBuildDistribution=true -Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true'

function mvn_test() {
(
Expand Down Expand Up @@ -129,7 +129,7 @@ function test_group_proxy() {

function test_group_other() {
mvn_test --clean --install \
-pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution' \
-pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution,!org.apache.pulsar:pulsar-all-docker-image' \
-PskipTestsForUnitGroupOther -DdisableIoMainProfile=true -DdisableSqlMainProfile=true -DskipIntegrationTests \
-Dexclude='**/ManagedLedgerTest.java,
**/OffloadersCacheTest.java
Expand Down
39 changes: 39 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

codecov:
require_ci_to_pass: yes

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false
require_base: no
require_head: yes

coverage:
status:
patch:
default:
target: auto
informational: true
project:
default:
target: auto
informational: true
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@ flexible messaging model and an intuitive client API.</description>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>target/report</outputDirectory>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit 9a8b68a

Please sign in to comment.