Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
if_ci_failed: ignore
patch:
default:
target: 60% # Require 80% patch coverage
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says 'Require 80% patch coverage' but the target is set to 60%. The comment should be updated to match the actual target value.

Suggested change
target: 60% # Require 80% patch coverage
target: 60% # Require 60% patch coverage

Copilot uses AI. Check for mistakes.
threshold: 1% # Allow up to 1% below target
if_ci_failed: ignore
8 changes: 7 additions & 1 deletion .github/workflows/unit_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ jobs:
*) ;;
esac

scripts/build/gn_gen.sh --args="$GN_ARGS"
scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true use_coverage=true is_debug=true"
- name: Run Build
run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE"
- name: Run Tests
run: scripts/tests/gn_tests.sh
- name: Run Build Coverage
run: scripts/build_coverage.sh --yaml --xml --code=all
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227
# TODO https://github.com/project-chip/connectedhomeip/issues/1512
# - name: Run Code Coverage
Expand Down
38 changes: 36 additions & 2 deletions scripts/build_coverage.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ _install_lcov() {

_install_lcov

_install_gcovr() {
if ! gcovr --version >/dev/null 2>&1; then
echo "gcovr not installed. Installing..."
pip3 install gcovr==8.3
fi
}

Comment on lines +41 to +47
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The _install_gcovr function should be called after its definition. Currently it's defined but never invoked until line 298, which could lead to confusion about when gcovr gets installed.

Suggested change
_install_gcovr() {
if ! gcovr --version >/dev/null 2>&1; then
echo "gcovr not installed. Installing..."
pip3 install gcovr==8.3
fi
}
# _install_gcovr invocation moved closer to its definition for clarity.() {
if ! gcovr --version >/dev/null 2>&1; then
echo "gcovr not installed. Installing..."
pip3 install gcovr==8.3
fi
}
_install_gcovr

Copilot uses AI. Check for mistakes.
# Get absolute path from a relative and normalize (e.g "foo/bar/../baz" -> "/path/to/foo/baz")
_abspath() {
python3 -c "import os.path; print(os.path.abspath('$@'))"
Expand All @@ -58,6 +65,8 @@ TEST_TARGETS=(check)
ENABLE_YAML=false
ENABLE_PYTHON=false

GENERATE_XML=false

help() {
echo "Usage: $file_name [--output_root=<output_root>] [--code=<core|clusters|all>] [Test options"
echo
Expand Down Expand Up @@ -119,6 +128,9 @@ for i in "$@"; do
ENABLE_PYTHON=true
shift
;;
--xml)
GENERATE_XML=true
;;
-q | --quiet)
QUIET_FLAG=("--quiet")
shift
Expand Down Expand Up @@ -282,8 +294,27 @@ genhtml "$COVERAGE_ROOT/lcov_final.info" \
--prefix "$CHIP_ROOT/src" \
"${QUIET_FLAG[@]}"

cp "$CHIP_ROOT/integrations/appengine/webapp_config.yaml" \
"$COVERAGE_ROOT/webapp_config.yaml"
if [ "$GENERATE_XML" == true ]; then
_install_gcovr

gcovr --exclude=zzz_generated/ \
--exclude=third_party/ \
--include=src/ \
--gcov-ignore-parse-errors \
--xml="$COVERAGE_ROOT"/coverage.xml

XML_INDEX=$(_abspath "$COVERAGE_ROOT/coverage.xml")
if [ -f "$XML_INDEX" ]; then
echo
echo "============================================================"
echo "Coverage report successfully generated:"
echo " file://$XML_INDEX"
echo "============================================================"
else
echo "WARNING: Coverage XML index was not found at expected path:"
echo " $XML_INDEX"
fi
fi

HTML_INDEX=$(_abspath "$COVERAGE_ROOT/html/index.html")
if [ -f "$HTML_INDEX" ]; then
Expand All @@ -296,3 +327,6 @@ else
echo "WARNING: Coverage HTML index was not found at expected path:"
echo " $HTML_INDEX"
fi

cp "$CHIP_ROOT/integrations/appengine/webapp_config.yaml" \
"$COVERAGE_ROOT/webapp_config.yaml"
Loading