Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/bat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
name: built-action
- name: Perform 'setup-matlab'
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Test
- name: Greet the world in style
uses: ./
with:
Expand Down
4,249 changes: 567 additions & 3,682 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"package": "ncc build --minify",
"test": "jest",
"all": "npm test && npm run build && npm run package",
"ci": "npm run clean && npm run deps && npm ci && npm run all"
"ci": "npm run clean && npm ci && npm run deps && npm run all"
},
"files": [
"lib/"
],
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"uuid": "^11.1.0"
"common-utils": "github:matlab-actions/common-utils#kapilg/refactor"
},
"devDependencies": {
"@types/jest": "^30.0.0",
Expand Down
27 changes: 2 additions & 25 deletions scripts/setupdeps.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
#!/bin/bash

RMC_BASE_URL='https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2'
SUPPORTED_OS=('win64' 'maci64' 'maca64' 'glnxa64')
source ./node_modules/common-utils/scripts/setupdeps.sh

# Create dist directory if it doesn't already exist
DISTDIR="$(pwd)/dist/bin"
mkdir -p $DISTDIR

# Download and extract in a temporary directory
WORKINGDIR=$(mktemp -d -t rmc_build.XXXXXX)
cd $WORKINGDIR

wget -O "$WORKINGDIR/license.txt" "$RMC_BASE_URL/license.txt"
wget -O "$WORKINGDIR/thirdpartylicenses.txt" "$RMC_BASE_URL/thirdpartylicenses.txt"

for os in ${SUPPORTED_OS[@]}
do
if [[ $os == 'win64' ]] ; then
bin_ext='.exe'
else
bin_ext=''
fi
mkdir -p "$WORKINGDIR/$os"
wget -O "$WORKINGDIR/$os/run-matlab-command$bin_ext" "$RMC_BASE_URL/$os/run-matlab-command$bin_ext"
done

mv -f ./* "$DISTDIR/"
mv -f ./* "$DISTDIR/bin"
rm -rf $WORKINGDIR
31 changes: 24 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2020-2023 The MathWorks, Inc.
// Copyright 2020-2025 The MathWorks, Inc.

import * as core from "@actions/core";
import * as exec from "@actions/exec";
import * as matlab from "./matlab";

export { matlab };
// 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.
Expand All @@ -13,14 +13,31 @@ async function run() {
const platform = process.platform;
const architecture = process.arch;
const workspaceDir = process.cwd();
const command = core.getInput("command");

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
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);
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
Expand Down
109 changes: 0 additions & 109 deletions src/matlab.ts

This file was deleted.

161 changes: 0 additions & 161 deletions src/matlab.unit.test.ts

This file was deleted.

Loading
Loading