Skip to content

Commit

Permalink
[#258] MCDC Test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbrown2 authored Dec 20, 2024
1 parent a1cb003 commit 478cc51
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/mc_dc_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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}"
Expand All @@ -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
Expand Down

0 comments on commit 478cc51

Please sign in to comment.