Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 additions & 2 deletions .github/workflows/unit_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for PR diff to work
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
Expand All @@ -74,11 +76,16 @@ jobs:
*) ;;
esac

scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true"
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
run: scripts/tests/gn_modified_code_tests.sh
- name: Run Code Coverage
run: scripts/build_coverage.sh --code=all
- name: Upload Code Coverage
shell: bash
run: bash <(curl -s https://codecov.io/bash)
# 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
5 changes: 1 addition & 4 deletions examples/platform/silabs/provision/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ if (wifi_soc) {
import("${silabs_sdk_build_root}/efr32_sdk.gni")
}

# Seperate import since the matter_support_root is defined in the ef32_sdk.gni / SiWx917_sdk.gni
# Separate import since the matter_support_root is defined in the ef32_sdk.gni / SiWx917_sdk.gni
import("${matter_support_root}/provision/args.gni")
source_set("storage") {
# SL-TEMP: CHIP_DEVICE_CONFIG_ENABLE_EXAMPLE_CREDENTIALS is required for credentials fallback in ProvisionStorageXXX.
# The define is replaced by SL_MATTER_ENABLE_EXAMPLE_CREDENTIALS in matter 1.5.
defines = [ "CHIP_DEVICE_CONFIG_ENABLE_EXAMPLE_CREDENTIALS=1" ]
sources = [ "ProvisionStorageCustom.cpp" ]

if (use_provision_flash_storage) {
Expand Down
87 changes: 87 additions & 0 deletions scripts/tests/gn_modified_code_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash

#
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed 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.
#

set -e

# Paths and environment
CHIP_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
BUILD_DIR="$CHIP_ROOT/out/$BUILD_TYPE"
CHECK_ALL=false

source "$CHIP_ROOT/scripts/activate.sh"

# Enable dmalloc if configured
dmalloc=$(gn --root="$CHIP_ROOT" args "$BUILD_DIR" --short --list=chip_config_memory_debug_dmalloc)

case "$dmalloc" in
"chip_config_memory_debug_dmalloc = true")
eval "$(dmalloc -b -i 1 high)"
export G_SLICE=always-malloc
;;
"chip_config_memory_debug_dmalloc = false") ;;
*)
echo >&2 "Invalid dmalloc output: \"$dmalloc\""
exit 1
;;
esac

echo "🔍 Detecting if this is a PR build with file diff support..."

# Only try differential logic if in PR context
if [[ -n "$GITHUB_EVENT_NAME" && "$GITHUB_EVENT_NAME" == "pull_request" && -n "$GITHUB_BASE_REF" ]]; then
echo "📂 Fetching changed files..."
git fetch origin "$GITHUB_BASE_REF" --depth=1 || true
CHANGED_FILES=$(git diff --name-only origin/"$GITHUB_BASE_REF"...HEAD)

echo "🔍 Changed files:"
echo "$CHANGED_FILES"

TESTS_TO_RUN=()

for f in "$CHANGED_FILES"; do
base=$(basename "$f" .cpp)

# Loop through test binaries and try to match with changed source file
for test in "$BUILD_DIR"/tests/Test*; do
test_name=$(basename "$test")
if [[ "$test_name" == *"$base"* && -x "$test" ]]; then
TESTS_TO_RUN+=("$test")
fi
done
done

if [ ${#TESTS_TO_RUN[@]} -eq 0 ]; then
echo "⚠️ No matching test binaries found for changed files. Running all tests instead."
CHECK_ALL=true
fi
else
echo "ℹ️ Not a PR build or missing base ref — running all tests."
CHECK_ALL=true
fi

set -x

if [ "$CHECK_ALL" = true ]; then
ninja -v -C "$BUILD_DIR" -k 0 check
else
echo "✅ Running selected test(s) only:"
for t in "${TESTS_TO_RUN[@]}"; do
echo "▶️ $t"
"$t"
done
fi
Loading