1- // Copyright 2020-2023 The MathWorks, Inc.
1+ // Copyright 2020-2025 The MathWorks, Inc.
22
33import * as core from "@actions/core" ;
44import * as exec from "@actions/exec" ;
5- import * as matlab from "./matlab" ;
6-
7- export { matlab } ;
5+ // TODO: update common-utils version when new version is released
6+ import { matlab , testResultsSummary , buildSummary } from "common-utils" ;
7+ import * as path from "path" ;
88
99/**
1010 * Gather action inputs and then run action.
@@ -13,14 +13,31 @@ async function run() {
1313 const platform = process . platform ;
1414 const architecture = process . arch ;
1515 const workspaceDir = process . cwd ( ) ;
16- const command = core . getInput ( "command" ) ;
16+
17+ const pluginsPath = path . join ( __dirname , "plugins" ) . replaceAll ( "'" , "''" ) ;
18+ const command = "addpath('" + pluginsPath + "'); " + core . getInput ( "command" ) ;
1719 const startupOpts = core . getInput ( "startup-options" ) . split ( " " ) ;
1820
1921 const helperScript = await matlab . generateScript ( workspaceDir , command ) ;
2022 const execOpts = {
21- env : { ...process . env , MW_BATCH_LICENSING_ONLINE :'true' } // Remove when online batch licensing is the default
23+ env : {
24+ ...process . env ,
25+ MW_BATCH_LICENSING_ONLINE :'true' , // Remove when online batch licensing is the default
26+ "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" : "buildframework.getDefaultPlugins" ,
27+ }
2228 } ;
23- await matlab . runCommand ( helperScript , platform , architecture , ( cmd , args ) => exec . exec ( cmd , args , execOpts ) , startupOpts ) ;
29+ await matlab . runCommand ( helperScript , platform , architecture , ( cmd , args ) => exec . exec ( cmd , args , execOpts ) , startupOpts ) . finally ( ( ) => {
30+ const runnerTemp = process . env . RUNNER_TEMP || '' ;
31+ const runId = process . env . GITHUB_RUN_ID || '' ;
32+ const actionName = process . env . GITHUB_ACTION || '' ;
33+
34+ buildSummary . processAndDisplayBuildSummary ( runnerTemp , runId , actionName ) ;
35+
36+ const testResultsData = testResultsSummary . getTestResults ( runnerTemp , runId , workspaceDir ) ;
37+ if ( testResultsData ) {
38+ testResultsSummary . writeSummary ( testResultsData , actionName ) ;
39+ }
40+ } ) ;
2441}
2542
2643// Only run this action if it is invoked directly. Do not run if this node
0 commit comments