Skip to content

Commit 135bc66

Browse files
committed
update plugin
1 parent 2e9b141 commit 135bc66

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/bat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
name: built-action
114114
- name: Perform 'setup-matlab' without MATLAB Test
115115
uses: matlab-actions/setup-matlab@v3
116-
- name: Run MATLAB Tests # Test Case 1: Without MATLAB Test, no view is shown
116+
- name: Run MATLAB Tests without MATLAB Test # Test Case 1: Without MATLAB Test, no view is shown
117117
uses: ./
118118
with:
119119
source-folder: sample

plugins/+testframework/CodeCoverageSummaryPlugin.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,24 @@ function runSession(plugin, pluginData)
6262

6363
% Determine file path for coverage results
6464
coverageArtifactFile = fullfile(getenv("RUNNER_TEMP"), "matlabCoverageResults" + getenv("GITHUB_RUN_ID") + ".json");
65+
stepSummaryFile = getenv('GITHUB_STEP_SUMMARY');
6566

67+
if ~isempty(stepSummaryFile)
68+
% Write coverage summary to the file
69+
fid = fopen(stepSummaryFile, 'a'); % 'a' for append mode
70+
if fid ~= -1
71+
fprintf(fid, '## Code Coverage Summary\n\n');
72+
fprintf(fid, '| Metric | Coverage |\n');
73+
fprintf(fid, '|--------|----------|\n');
74+
fprintf(fid, '| Statement | %.2f%% |\n', statementCoverage);
75+
fprintf(fid, '| Function | %.2f%% |\n', functionCoverage);
76+
fprintf(fid, '| Decision | %.2f%% |\n', decisionCoverage);
77+
fprintf(fid, '| Condition | %.2f%% |\n', conditionCoverage);
78+
fprintf(fid, '| MC/DC | %.2f%% |\n', mcdcCoverage);
79+
fprintf(fid, '\n');
80+
fclose(fid);
81+
end
82+
end
6683
try
6784
JsonCoverageResults = jsonencode(coverageResults, "PrettyPrint", true);
6885

0 commit comments

Comments
 (0)