Skip to content

Commit

Permalink
Add Apple Silicon support (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcafaro authored Mar 6, 2024
1 parent e9ac599 commit 6669181
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/setupdeps.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

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

# Create dist directory if it doesn't already exist
DISTDIR="$(pwd)/dist/bin"
Expand Down
8 changes: 6 additions & 2 deletions src/matlab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function runCommand(hs: HelperScript, platform: string, architectur
* @param architecture Architecture of the runner (e.g., "x64")
*/
export function getRunMATLABCommandScriptPath(platform: string, architecture: string): string {
if (architecture != "x64") {
if (architecture != "x64" && !(platform == "darwin" && architecture == "arm64")) {
throw new Error(`This action is not supported on ${platform} runners using the ${architecture} architecture.`);
}
let ext;
Expand All @@ -90,7 +90,11 @@ export function getRunMATLABCommandScriptPath(platform: string, architecture: st
break;
case "darwin":
ext = "";
platformDir = "maci64";
if (architecture == "x64") {
platformDir = "maci64";
} else {
platformDir = "maca64";
}
break;
case "linux":
ext = "";
Expand Down
9 changes: 5 additions & 4 deletions src/matlab.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("ci helper path", () => {
});
};

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

testDirectory("win32", "win64");
testDirectory("darwin", "maci64");
testDirectory("linux", "glnxa64");
testDirectory("win32", "x64", "win64");
testDirectory("darwin", "x64", "maci64");
testDirectory("darwin", "arm64", "maca64");
testDirectory("linux", "x64", "glnxa64");

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

0 comments on commit 6669181

Please sign in to comment.