-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.ts
More file actions
56 lines (50 loc) · 1.83 KB
/
Copy pathindex.ts
File metadata and controls
56 lines (50 loc) · 1.83 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
50
51
52
53
54
55
56
// Copyright 2020-2025 The MathWorks, Inc.
import * as core from "@actions/core";
import * as exec from "@actions/exec";
import { matlab, testResultsSummary, buildSummary } from "common-utils";
/**
* Gather action inputs and then run action.
*/
async function run() {
const platform = process.platform;
const architecture = process.arch;
const workspaceDir = process.cwd();
const command = core.getInput("command");
const startupOpts = core.getInput("startup-options").split(" ");
const generateSummary = core.getBooleanInput("generate-summary");
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",
MW_GENERATE_SUMMARY: String(generateSummary),
},
};
await matlab
.runCommand(
helperScript,
platform,
architecture,
(cmd: string, args?: string[]) => exec.exec(cmd, args, execOpts),
startupOpts,
)
.finally(() => {
if (generateSummary) {
const runnerTemp = process.env.RUNNER_TEMP || "";
const runId = process.env.GITHUB_RUN_ID || "";
const actionName = process.env.GITHUB_ACTION || "";
buildSummary.processAndAddBuildSummary(runnerTemp, actionName);
testResultsSummary.processAndAddTestSummary(
runnerTemp,
runId,
actionName,
workspaceDir,
);
core.summary.write();
}
});
}
run().catch((e) => {
core.setFailed(e);
});