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
2 changes: 1 addition & 1 deletion .github/workflows/bat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: npm run ci

- name: Perform 'setup-matlab'
uses: matlab-actions/setup-matlab
uses: matlab-actions/setup-matlab@v0
env:
MATHWORKS_TOKEN: ${{ secrets.MATHWORKS_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
node-version: '12'
- name: Perform npm tasks
run: npm ci && npm run build && npm run package
run: npm run ci

- name: Set release vars
id: release_helpers
Expand Down
2,267 changes: 543 additions & 1,724 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "run-matlab-command-action",
"author": "The MathWorks, Inc.",
"version": "0.1.1",
"version": "0.2.0",
"description": "",
"main": "lib/index.js",
"scripts": {
Expand All @@ -21,17 +21,17 @@
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"uuid": "^8.3.0"
"uuid": "^8.3.1"
},
"devDependencies": {
"@types/jest": "^26.0.14",
"@types/node": "^14.11.2",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.10",
"@types/uuid": "^8.3.0",
"@zeit/ncc": "^0.22.3",
"jest": "^26.4.2",
"jest-circus": "^26.4.2",
"prettier": "2.0.5",
"ts-jest": "^26.4.1",
"typescript": "^3.9.7"
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"prettier": "2.2.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
}
}
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ async function run() {
});
}

run().catch((e) => {
core.setFailed(e);
});
// 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);
});
}
4 changes: 2 additions & 2 deletions src/matlab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function generateScript(workspaceDir: string, command: string): Pro
* @param fn ExecFn that will execute a command on the runner
*/
export async function runCommand(hs: HelperScript, platform: string, fn: ExecFn): Promise<void> {
const rmcPath = getRmcPath(platform);
const rmcPath = getRunMATLABCommandScriptPath(platform);
await fs.chmod(rmcPath, 0o777);

const rmcArg = script.cdAndCall(hs.dir, hs.command);
Expand All @@ -66,7 +66,7 @@ export async function runCommand(hs: HelperScript, platform: string, fn: ExecFn)
*
* @param platform Operating system of the runner (e.g., "win32" or "linux")
*/
export function getRmcPath(platform: string): string {
export function getRunMATLABCommandScriptPath(platform: string): string {
const ext = platform === "win32" ? "bat" : "sh";
const rmcPath = path.join(__dirname, "bin", `run_matlab_command.${ext}`);
return rmcPath;
Expand Down
2 changes: 1 addition & 1 deletion src/matlab.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe("run command", () => {
describe("ci helper path", () => {
const testCase = (platform: string, ext: string) => {
it(`considers the appropriate script on ${platform}`, () => {
const actualPath = matlab.getRmcPath(platform);
const actualPath = matlab.getRunMATLABCommandScriptPath(platform);
const actualExt = path.extname(actualPath);
expect(actualExt).toMatch(ext);
});
Expand Down