Skip to content

Commit 1ebcb2a

Browse files
authored
Merge pull request #1 from matlab-actions/jpereira/migrate
Prepare for release
2 parents d2edaa2 + da3a308 commit 1ebcb2a

File tree

7 files changed

+564
-1741
lines changed

7 files changed

+564
-1741
lines changed

.github/workflows/bat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run: npm run ci
1515

1616
- name: Perform 'setup-matlab'
17-
uses: matlab-actions/setup-matlab
17+
uses: matlab-actions/setup-matlab@v0
1818
env:
1919
MATHWORKS_TOKEN: ${{ secrets.MATHWORKS_TOKEN }}
2020

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
node-version: '12'
2020
- name: Perform npm tasks
21-
run: npm ci && npm run build && npm run package
21+
run: npm run ci
2222

2323
- name: Set release vars
2424
id: release_helpers

package-lock.json

Lines changed: 543 additions & 1724 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "run-matlab-command-action",
33
"author": "The MathWorks, Inc.",
4-
"version": "0.1.1",
4+
"version": "0.2.0",
55
"description": "",
66
"main": "lib/index.js",
77
"scripts": {
@@ -21,17 +21,17 @@
2121
"dependencies": {
2222
"@actions/core": "^1.2.6",
2323
"@actions/exec": "^1.0.4",
24-
"uuid": "^8.3.0"
24+
"uuid": "^8.3.1"
2525
},
2626
"devDependencies": {
27-
"@types/jest": "^26.0.14",
28-
"@types/node": "^14.11.2",
27+
"@types/jest": "^26.0.15",
28+
"@types/node": "^14.14.10",
2929
"@types/uuid": "^8.3.0",
3030
"@zeit/ncc": "^0.22.3",
31-
"jest": "^26.4.2",
32-
"jest-circus": "^26.4.2",
33-
"prettier": "2.0.5",
34-
"ts-jest": "^26.4.1",
35-
"typescript": "^3.9.7"
31+
"jest": "^26.6.3",
32+
"jest-circus": "^26.6.3",
33+
"prettier": "2.2.1",
34+
"ts-jest": "^26.4.4",
35+
"typescript": "^4.1.2"
3636
}
3737
}

src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ async function run() {
2525
});
2626
}
2727

28-
run().catch((e) => {
29-
core.setFailed(e);
30-
});
28+
// Only run this action if it is invoked directly. Do not run if this node
29+
// module is required by another action such as run-tests.
30+
if (require.main === module) {
31+
run().catch((e) => {
32+
core.setFailed(e);
33+
});
34+
}

src/matlab.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export async function generateScript(workspaceDir: string, command: string): Pro
5050
* @param fn ExecFn that will execute a command on the runner
5151
*/
5252
export async function runCommand(hs: HelperScript, platform: string, fn: ExecFn): Promise<void> {
53-
const rmcPath = getRmcPath(platform);
53+
const rmcPath = getRunMATLABCommandScriptPath(platform);
5454
await fs.chmod(rmcPath, 0o777);
5555

5656
const rmcArg = script.cdAndCall(hs.dir, hs.command);
@@ -66,7 +66,7 @@ export async function runCommand(hs: HelperScript, platform: string, fn: ExecFn)
6666
*
6767
* @param platform Operating system of the runner (e.g., "win32" or "linux")
6868
*/
69-
export function getRmcPath(platform: string): string {
69+
export function getRunMATLABCommandScriptPath(platform: string): string {
7070
const ext = platform === "win32" ? "bat" : "sh";
7171
const rmcPath = path.join(__dirname, "bin", `run_matlab_command.${ext}`);
7272
return rmcPath;

src/matlab.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe("run command", () => {
112112
describe("ci helper path", () => {
113113
const testCase = (platform: string, ext: string) => {
114114
it(`considers the appropriate script on ${platform}`, () => {
115-
const actualPath = matlab.getRmcPath(platform);
115+
const actualPath = matlab.getRunMATLABCommandScriptPath(platform);
116116
const actualExt = path.extname(actualPath);
117117
expect(actualExt).toMatch(ext);
118118
});

0 commit comments

Comments
 (0)