Skip to content

Commit

Permalink
Added Summary plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed May 21, 2024
1 parent ae4bdd2 commit 536b4c1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions plugins/+ciplugins/+github/BuildSummaryPlugin.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
classdef BuildSummaryPlugin < matlab.buildtool.plugins.BuildRunnerPlugin

% Copyright 2024 The MathWorks, Inc.

methods (Access=protected)

function runTaskGraph(plugin, pluginData)
[email protected](plugin, pluginData);
[fID, msg] = fopen(fullfile(tempdir ,"buildSummary" + getenv("GITHUB_RUN_ID") + ".json"), "w");

if fID == -1
warning("ciplugins:github:BuildSummaryPlugin:UnableToOpenFile","Could not open a file for GitHub build summary table due to: %s", msg);
else
closeFile = onCleanup(@()fclose(fID));
taskDetails = struct();
for idx = 1:numel(pluginData.TaskResults)
taskDetails(idx).name = pluginData.TaskResults(idx).Name;
taskDetails(idx).description = pluginData.TaskGraph.Tasks(idx).Description;
taskDetails(idx).failed = pluginData.TaskResults(idx).Failed;
taskDetails(idx).skipped = pluginData.TaskResults(idx).Skipped;
taskDetails(idx).duration = string(pluginData.TaskResults(idx).Duration);
end
a = struct("taskDetails",taskDetails);
s = jsonencode(a,PrettyPrint=true);
fprintf(fID, "%s",s);
end
end
end
end

0 comments on commit 536b4c1

Please sign in to comment.