Skip to content

Commit 6669181

Browse files
authored
Add Apple Silicon support (#54)
1 parent e9ac599 commit 6669181

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

scripts/setupdeps.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
RMC_BASE_URL='https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2'
4-
SUPPORTED_OS=('win64' 'maci64' 'glnxa64')
4+
SUPPORTED_OS=('win64' 'maci64' 'maca64' 'glnxa64')
55

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

src/matlab.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export async function runCommand(hs: HelperScript, platform: string, architectur
7878
* @param architecture Architecture of the runner (e.g., "x64")
7979
*/
8080
export function getRunMATLABCommandScriptPath(platform: string, architecture: string): string {
81-
if (architecture != "x64") {
81+
if (architecture != "x64" && !(platform == "darwin" && architecture == "arm64")) {
8282
throw new Error(`This action is not supported on ${platform} runners using the ${architecture} architecture.`);
8383
}
8484
let ext;
@@ -90,7 +90,11 @@ export function getRunMATLABCommandScriptPath(platform: string, architecture: st
9090
break;
9191
case "darwin":
9292
ext = "";
93-
platformDir = "maci64";
93+
if (architecture == "x64") {
94+
platformDir = "maci64";
95+
} else {
96+
platformDir = "maca64";
97+
}
9498
break;
9599
case "linux":
96100
ext = "";

src/matlab.unit.test.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe("ci helper path", () => {
135135
});
136136
};
137137

138-
const testDirectory = (platform: string, subdirectory: string) => {
138+
const testDirectory = (platform: string, architecture: string, subdirectory: string) => {
139139
it(`considers the appropriate script on ${platform}`, () => {
140140
const actualPath = matlab.getRunMATLABCommandScriptPath(platform, architecture);
141141
expect(actualPath).toContain(subdirectory);
@@ -146,9 +146,10 @@ describe("ci helper path", () => {
146146
testExtension("darwin", "");
147147
testExtension("linux", "");
148148

149-
testDirectory("win32", "win64");
150-
testDirectory("darwin", "maci64");
151-
testDirectory("linux", "glnxa64");
149+
testDirectory("win32", "x64", "win64");
150+
testDirectory("darwin", "x64", "maci64");
151+
testDirectory("darwin", "arm64", "maca64");
152+
testDirectory("linux", "x64", "glnxa64");
152153

153154
it("errors on unsupported platform", () => {
154155
expect(() => matlab.getRunMATLABCommandScriptPath('sunos',architecture)).toThrow();

0 commit comments

Comments
 (0)