Skip to content
Merged
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
19 changes: 19 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 Expand Up @@ -92,6 +94,23 @@ jobs:
[~, f] = fileparts(pwd);
assert(strcmp(f, 'subdir'));
startup-options: -sd subdir
- name: Create buildfile.m in project root for build and test summary
shell: bash
run: |
cat <<'_EOF' >> "buildfile.m"
function plan = buildfile
import matlab.buildtool.tasks.TestTask

plan = buildplan(localfunctions);
plan("preMadeTest") = TestTask;

plan.DefaultTasks = "preMadeTest";
end
_EOF
- name: Run command with buildtool pre-made test task
uses: ./
with:
command: buildtool preMadeTest
- name: Verify environment variables make it to MATLAB
uses: ./
with:
Expand Down
4,257 changes: 572 additions & 3,685 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"build": "tsc",
"deps": "bash ./scripts/setupdeps.sh",
"package": "ncc build --minify",
"test": "jest",
"test": "jest --passWithNoTests",
"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#v1.0.0"
},
"devDependencies": {
"@types/jest": "^30.0.0",
Expand Down
8 changes: 8 additions & 0 deletions sample/TheTruth.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
classdef TheTruth < matlab.unittest.TestCase
methods (Test)
function testTheTestOfAllTime(testCase)
onetyone = 11;
testCase.verifyEqual(onetyone, 11);
end
end
end
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
23 changes: 17 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// 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 };
import { matlab, testResultsSummary, buildSummary } from "common-utils";

/**
* Gather action inputs and then run action.
Expand All @@ -13,14 +11,27 @@ 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 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.processAndAddBuildSummary(runnerTemp, runId, actionName);
testResultsSummary.processAndAddTestSummary(runnerTemp, runId, actionName, workspaceDir);
core.summary.write();
});
}

// 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.

Loading
Loading