From 478cc518030a48581906e6d4242797a879968cf3 Mon Sep 17 00:00:00 2001 From: Robert Brown <91291114+rjbrown2@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:00:28 -0500 Subject: [PATCH] [#258] MCDC Test --- .github/workflows/mc_dc_coverage.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mc_dc_coverage.yml b/.github/workflows/mc_dc_coverage.yml index a735fd48..77a10d0e 100644 --- a/.github/workflows/mc_dc_coverage.yml +++ b/.github/workflows/mc_dc_coverage.yml @@ -36,7 +36,14 @@ jobs: python3 python3-pip python3-venv gcovr bc pipx wget \ software-properties-common clang libclang-dev pipx install --system-site-packages mcdc-checker - pipx ensurepath + + - name: Ensure Pipx Binaries in Path + run: | + echo "Ensuring pipx binary directory is in PATH..." + export PATH=$PATH:$HOME/.local/bin + echo "PATH updated: $PATH" + which mcdc-checker || { echo "mcdc-checker not found in PATH"; exit 1; } + mcdc-checker --version || { echo "Failed to verify mcdc-checker installation"; exit 1; } - name: Build with Coverage Flags run: | @@ -52,8 +59,8 @@ jobs: BRANCH_COVERAGE=$(grep -oP '(?<=branch-rate=")[0-9.]+(?=")' doc/coverage/coverage_report.xml | head -n 1) LINE_COVERAGE_PERCENT=$(printf "%.0f" $(echo "$LINE_COVERAGE * 100" | bc)) BRANCH_COVERAGE_PERCENT=$(printf "%.0f" $(echo "$BRANCH_COVERAGE * 100" | bc)) - if [ "$LINE_COVERAGE_PERCENT" -ge 80 ]; then LINE_COLOR="brightgreen"; elif [ "$LINE_COVERAGE_PERCENT" -ge 50"; then LINE_COLOR="yellow"; else LINE_COLOR="red"; fi - if [ "$BRANCH_COVERAGE_PERCENT" -ge 80 ]; then BRANCH_COLOR="brightgreen"; elif [ "$BRANCH_COVERAGE_PERCENT" -ge 50"; then BRANCH_COLOR="yellow"; else BRANCH_COLOR="red"; fi + if [ "$LINE_COVERAGE_PERCENT" -ge 80 ]; then LINE_COLOR="brightgreen"; elif [ "$LINE_COVERAGE_PERCENT" -ge 50 ]; then LINE_COLOR="yellow"; else LINE_COLOR="red"; fi + if [ "$BRANCH_COVERAGE_PERCENT" -ge 80 ]; then BRANCH_COLOR="brightgreen"; elif [ "$BRANCH_COVERAGE_PERCENT" -ge 50 ]; then BRANCH_COLOR="yellow"; else BRANCH_COLOR="red"; fi curl -o doc/coverage/line-coverage-badge.svg "https://img.shields.io/badge/line%20coverage-${LINE_COVERAGE_PERCENT}%25-${LINE_COLOR}" curl -o doc/coverage/branch-coverage-badge.svg "https://img.shields.io/badge/branch%20coverage-${BRANCH_COVERAGE_PERCENT}%25-${BRANCH_COLOR}" @@ -69,6 +76,7 @@ jobs: - name: Run MC/DC Analysis run: | echo "Running mcdc-checker..." + export PATH=$PATH:$HOME/.local/bin mcdc-checker -a -j $GITHUB_WORKSPACE/doc/coverage/mcdc_report.json \ -I $GITHUB_WORKSPACE/include $(find $GITHUB_WORKSPACE/src -type f -name '*.c' | tr '\n' ' ') \ > $GITHUB_WORKSPACE/doc/coverage/mcdc_checker_output.log 2>&1 || true