-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.ts
More file actions
49 lines (42 loc) · 1.88 KB
/
Copy pathindex.ts
File metadata and controls
49 lines (42 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2020-2025 The MathWorks, Inc.
import * as core from "@actions/core";
import * as exec from "@actions/exec";
// TODO: update common-utils version when new version is released
import { matlab, testResultsSummary, buildSummary } from "common-utils";
import * as path from "path";
/**
* Gather action inputs and then run action.
*/
async function run() {
const platform = process.platform;
const architecture = process.arch;
const workspaceDir = process.cwd();
const pluginsPath = path.join(__dirname, "plugins").replaceAll("'","''");
const command = "addpath('"+ pluginsPath +"'); " + core.getInput("command");
const startupOpts = core.getInput("startup-options").split(" ");
const helperScript = await matlab.generateScript(workspaceDir, command);
const execOpts = {
env: {
...process.env,
MW_BATCH_LICENSING_ONLINE:'true', // Remove when online batch licensing is the default
"MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE": "buildframework.getDefaultPlugins",
}
};
await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOpts), startupOpts).finally(() => {
const runnerTemp = process.env.RUNNER_TEMP || '';
const runId = process.env.GITHUB_RUN_ID || '';
const actionName = process.env.GITHUB_ACTION || '';
buildSummary.processAndDisplayBuildSummary(runnerTemp, runId, actionName);
const testResultsData = testResultsSummary.getTestResults(runnerTemp, runId, workspaceDir);
if(testResultsData) {
testResultsSummary.writeSummary(testResultsData, actionName);
}
});
}
// Only run this action if it is invoked directly. Do not run if this node
// module is required by another action such as run-tests.
if (require.main === module) {
run().catch((e) => {
core.setFailed(e);
});
}