diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 77eba90..6be53c4 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -58,6 +58,10 @@ jobs: products: Symbolic_Math_Toolbox check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); + - os: macos-14 + release: R2023a + check-matlab: matlabVer = ver('matlab'); assert(strcmp(matlabVer.Release,'(R2023a)')); + check-toolbox: symbolicVer = ver('symbolic'); assert(strcmp(symbolicVer.Release,'(R2023a)')); steps: - uses: actions/download-artifact@v4 with: diff --git a/src/install.ts b/src/install.ts index 6d4b0df..123ba8c 100644 --- a/src/install.ts +++ b/src/install.ts @@ -38,7 +38,7 @@ export async function install(platform: string, architecture: string, release: s } if (!alreadyExists && !cacheHit) { - const mpmPath: string = await mpm.setup(platform, architecture); + const mpmPath: string = await mpm.setup(platform, architecture, releaseInfo.name); await mpm.install(mpmPath, releaseInfo, products, destination); } diff --git a/src/matlab.ts b/src/matlab.ts index ac552c8..d8e7107 100644 --- a/src/matlab.ts +++ b/src/matlab.ts @@ -206,7 +206,7 @@ export function getSupportPackagesPath(platform: string, release: string): strin export async function installSystemDependencies(platform: string, architecture: string, release: string) { if (platform === "linux") { return script.downloadAndRunScript(platform, properties.matlabDepsUrl, [release]); - } else if (platform === "darwin" && architecture === "arm64") { + } else if (platform === "darwin" && architecture === "arm64" && release >= "r2023b") { return installAppleSiliconJdk(); } } diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index 3b262b4..fbec2ce 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -285,7 +285,7 @@ describe("matlab tests", () => { let tcDownloadToolMock: jest.Mock; let execMock: jest.Mock; const arch = "x64"; - const release = "R2023b"; + const release = "r2023b"; beforeEach(() => { downloadAndRunScriptMock = script.downloadAndRunScript as jest.Mock; diff --git a/src/mpm.ts b/src/mpm.ts index ca52bbf..a2a40c2 100644 --- a/src/mpm.ts +++ b/src/mpm.ts @@ -6,7 +6,7 @@ import * as path from "path"; import * as matlab from "./matlab"; import properties from "./properties.json"; -export async function setup(platform: string, architecture: string): Promise { +export async function setup(platform: string, architecture: string, release: string): Promise { let mpmUrl: string; let ext = ""; if (architecture != "x64" && !(platform == "darwin" && architecture == "arm64")) { @@ -21,7 +21,7 @@ export async function setup(platform: string, architecture: string): Promise { let execMock: jest.Mock; let defaultInstallRootMock: jest.Mock; const arch = "x64"; + const release = "r2023b"; const mpmMockPath = path.join("path", "to", "mpm"); beforeEach(() => { @@ -37,7 +38,7 @@ describe("setup mpm", () => { it(`works on linux`, async () => { const platform = "linux"; execMock.mockResolvedValue(0); - await expect(mpm.setup(platform, arch)).resolves.toBe(mpmMockPath); + await expect(mpm.setup(platform, arch, release)).resolves.toBe(mpmMockPath); expect(tcDownloadToolMock.mock.calls[0][0]).toContain("glnxa64"); }); @@ -45,7 +46,7 @@ describe("setup mpm", () => { const platform = "win32"; tcDownloadToolMock.mockResolvedValue(mpmMockPath); execMock.mockResolvedValue(0); - await expect(mpm.setup(platform, arch)).resolves.toBe(path.join(mpmMockPath)); + await expect(mpm.setup(platform, arch, release)).resolves.toBe(path.join(mpmMockPath)); expect(tcDownloadToolMock.mock.calls[0][0]).toContain("win64"); }); @@ -53,25 +54,25 @@ describe("setup mpm", () => { const platform = "darwin"; tcDownloadToolMock.mockResolvedValue(mpmMockPath); execMock.mockResolvedValue(0); - await expect(mpm.setup(platform, arch)).resolves.toBe(path.join(mpmMockPath)); + await expect(mpm.setup(platform, arch, release)).resolves.toBe(path.join(mpmMockPath)); expect(tcDownloadToolMock.mock.calls[0][0]).toContain("maci64"); }); it(`works on mac with apple silicon`, async () => { const platform = "darwin"; execMock.mockResolvedValue(0); - await expect(mpm.setup(platform, "arm64")).resolves.toBe(mpmMockPath); + await expect(mpm.setup(platform, "arm64", release)).resolves.toBe(mpmMockPath); expect(tcDownloadToolMock.mock.calls[0][0]).toContain("maca64"); }); }); it("errors on unsupported platform", async () => { - await expect(() => mpm.setup('sunos', arch)).rejects.toBeDefined(); + await expect(() => mpm.setup('sunos', arch, release)).rejects.toBeDefined(); }); it("errors on unsupported architecture", async () => { const platform = "linux"; - await expect(() => mpm.setup(platform, 'x86')).rejects.toBeDefined(); + await expect(() => mpm.setup(platform, 'x86', release)).rejects.toBeDefined(); }); it("errors without RUNNER_TEMP", async () => { @@ -80,21 +81,21 @@ describe("setup mpm", () => { tcDownloadToolMock.mockResolvedValue(mpmMockPath); defaultInstallRootMock.mockReturnValue(path.join("path", "to", "install", "root")); execMock.mockResolvedValue(0); - await expect(mpm.setup(platform, arch)).rejects.toBeDefined(); + await expect(mpm.setup(platform, arch, release)).rejects.toBeDefined(); }); it("rejects when the download fails", async () => { const platform = "linux"; tcDownloadToolMock.mockRejectedValue(Error("oof")); execMock.mockResolvedValue(0); - await expect(mpm.setup(platform, arch)).rejects.toBeDefined(); + await expect(mpm.setup(platform, arch, release)).rejects.toBeDefined(); }); it("rejects when the chmod fails", async () => { const platform = "linux"; tcDownloadToolMock.mockResolvedValue("/path/to/mpm"); execMock.mockResolvedValue(1); - await expect(mpm.setup(platform, arch)).rejects.toBeDefined(); + await expect(mpm.setup(platform, arch, release)).rejects.toBeDefined(); }); });