Skip to content

Commit ae05642

Browse files
committed
added summary to cover step
1 parent 83ca04a commit ae05642

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,57 @@ jobs:
141141
# Find all modified packages
142142
modified_packages=$(git diff --name-only HEAD~1 -- packages | cut -d/ -f1,2 | sort -u)
143143
144+
failed_packages=()
145+
passed_packages=()
146+
144147
for pkg in ${modified_packages}; do
145148
if [ -d "${pkg}" ]; then
146149
echo "============================================================"
147150
echo "Evaluating coverage for package: ${pkg}"
148151
echo "============================================================"
149152
153+
set +e
150154
if [ -f "${pkg}/.coveragerc" ]; then
151155
echo "Using package-specific configuration: ${pkg}/.coveragerc"
152156
# If fail_under is specified in the package-specific .coveragerc, coverage report
153157
# will automatically enforce it. Otherwise, we enforce the default.
154158
if grep -q "fail_under" "${pkg}/.coveragerc"; then
155-
coverage report --rcfile="${pkg}/.coveragerc"
159+
coverage report --rcfile="${pkg}/.coveragerc" --include="${pkg}/**"
156160
else
157161
echo "No fail_under specified in ${pkg}/.coveragerc, enforcing default"
158-
coverage report --rcfile="${pkg}/.coveragerc" --fail-under="${DEFAULT_FAIL_UNDER}"
162+
coverage report --rcfile="${pkg}/.coveragerc" --include="${pkg}/**" --fail-under="${DEFAULT_FAIL_UNDER}"
159163
fi
160164
else
161165
echo "No .coveragerc found for ${pkg}, enforcing default"
162166
coverage report --include="${pkg}/**" --fail-under="${DEFAULT_FAIL_UNDER}"
163167
fi
168+
status=$?
169+
set -e
170+
171+
if [ ${status} -ne 0 ]; then
172+
failed_packages+=("${pkg}")
173+
else
174+
passed_packages+=("${pkg}")
175+
fi
164176
fi
165177
done
178+
179+
echo "============================================================"
180+
echo "Coverage Evaluation Summary"
181+
echo "============================================================"
182+
if [ ${#passed_packages[@]} -gt 0 ]; then
183+
echo "Passed packages:"
184+
for pkg in "${passed_packages[@]}"; do
185+
echo " - ${pkg}"
186+
done
187+
fi
188+
if [ ${#failed_packages[@]} -gt 0 ]; then
189+
echo "Failed packages:"
190+
for pkg in "${failed_packages[@]}"; do
191+
echo " - ${pkg}"
192+
done
193+
exit 1
194+
fi
166195
else
167196
echo "Error: No coverage results were downloaded from the unit test jobs."
168197
echo "This usually means the unit tests did not run or failed to upload their coverage files."

0 commit comments

Comments
 (0)