From 8888e163c50ee5ab2907ae73f78533cd40975103 Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 14:26:11 -0400 Subject: [PATCH 01/12] update cache-save to warn instead of error --- .github/workflows/bat.yml | 10 +++++----- src/cache-save.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 77eba90..27717b0 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -62,6 +62,11 @@ jobs: - uses: actions/download-artifact@v4 with: name: built-action + - name: Cache MATLAB + id: cache-matlab + uses: actions/cache@v4 + with: + path: ${{ runner.tool_cache }}/MATLAB - name: Install selected products id: setup_matlab uses: ./ @@ -79,8 +84,3 @@ jobs: uses: matlab-actions/run-command@v2 with: command: "${{ matrix.check-toolbox }}" - - name: Check NoOp on 2nd install - uses: ./ - with: - release: ${{ matrix.release }} - products: ${{ matrix.products }} diff --git a/src/cache-save.ts b/src/cache-save.ts index 548cdac..3525034 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -16,6 +16,10 @@ export async function cacheMATLAB() { return; } - await cache.saveCache([matlabPath, supportPackagesPath], primaryKey); - core.info(`Cache saved with the key: ${primaryKey}`); + try { + await cache.saveCache([matlabPath, supportPackagesPath], primaryKey); + core.info(`Cache saved with the key: ${primaryKey}`); + } catch (e) { + core.warning(`Failed to save MATLAB to cache: ${e}`); + } } From 62bfdd6d916da1340f6f79c767f086d878183acd Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 14:29:12 -0400 Subject: [PATCH 02/12] add missing cache param --- .github/workflows/bat.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 27717b0..2bc7364 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -67,6 +67,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ runner.tool_cache }}/MATLAB + key: ${{ matrix.os }}-${{ matrix.release }} - name: Install selected products id: setup_matlab uses: ./ From 4ceaad463177ae32b713e07293e76796f665de12 Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 14:44:54 -0400 Subject: [PATCH 03/12] fix mac cache issue --- src/matlab.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/matlab.ts b/src/matlab.ts index 6413f63..8ba0daf 100644 --- a/src/matlab.ts +++ b/src/matlab.ts @@ -27,12 +27,15 @@ export async function makeToolcacheDir(release: Release, platform: string): Prom } else { if (platform === "win32") { toolpath = await windowsHostedToolpath(release).catch(async () => { - return await defaultToolpath(release, platform); + return await defaultToolpath(release); }); } else { - toolpath = await defaultToolpath(release, platform); + toolpath = await defaultToolpath(release); } } + if (platform == "darwin") { + toolpath = toolpath + "/MATLAB.app"; + } return [toolpath, alreadyExists] } @@ -72,13 +75,10 @@ async function windowsHostedToolpath(release: Release): Promise { return actualToolCacheDir; } -async function defaultToolpath(release: Release, platform: string): Promise { +async function defaultToolpath(release: Release): Promise { fs.writeFileSync(".keep", ""); let toolpath = await tc.cacheFile(".keep", ".keep", "MATLAB", release.version); io.rmRF(".keep"); - if (platform == "darwin") { - toolpath = toolpath + "/MATLAB.app"; - } return toolpath } From b1096b2d0039bc4ea868851d5372bbc95703879d Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 15:03:08 -0400 Subject: [PATCH 04/12] testing something --- .github/workflows/bat.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 2bc7364..1cdd666 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -66,7 +66,9 @@ jobs: id: cache-matlab uses: actions/cache@v4 with: - path: ${{ runner.tool_cache }}/MATLAB + path: | + ${{ runner.tool_cache }}/MATLAB + D:\hostedtoolcache\windows\MATLAB\2023.2.999\x64 key: ${{ matrix.os }}-${{ matrix.release }} - name: Install selected products id: setup_matlab From ab14fa0c5c0850e84c766dbdad63878b364ee195 Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 15:40:40 -0400 Subject: [PATCH 05/12] some reorganizing --- src/install.ts | 2 +- src/install.unit.test.ts | 2 +- src/matlab.ts | 32 ++++++++++++++++++++++---------- src/matlab.unit.test.ts | 16 ++++++++-------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/install.ts b/src/install.ts index 384abe5..6d4b0df 100644 --- a/src/install.ts +++ b/src/install.ts @@ -29,7 +29,7 @@ export async function install(platform: string, architecture: string, release: s ); await core.group("Setting up MATLAB", async () => { - let [destination, alreadyExists]: [string, boolean] = await matlab.makeToolcacheDir(releaseInfo, platform); + let [destination, alreadyExists]: [string, boolean] = await matlab.getToolcacheDir(platform, releaseInfo); let cacheHit = false; if (useCache) { diff --git a/src/install.unit.test.ts b/src/install.unit.test.ts index cd01fdf..bd9c566 100644 --- a/src/install.unit.test.ts +++ b/src/install.unit.test.ts @@ -42,7 +42,7 @@ describe("install procedure", () => { beforeEach(() => { matlabInstallSystemDependenciesMock = matlab.installSystemDependencies as jest.Mock; matlabGetReleaseInfoMock = matlab.getReleaseInfo as jest.Mock; - matlabMakeToolcacheDirMock = matlab.makeToolcacheDir as jest.Mock; + matlabMakeToolcacheDirMock = matlab.getToolcacheDir as jest.Mock; matlabSetupBatchMock = matlab.setupBatch as jest.Mock; mpmSetupMock = mpm.setup as jest.Mock; mpmInstallMock = mpm.install as jest.Mock; diff --git a/src/matlab.ts b/src/matlab.ts index 8ba0daf..5ad6a5a 100644 --- a/src/matlab.ts +++ b/src/matlab.ts @@ -18,20 +18,14 @@ export interface Release { isPrerelease: boolean; } -export async function makeToolcacheDir(release: Release, platform: string): Promise<[string, boolean]> { +export async function getToolcacheDir(platform: string, release: Release): Promise<[string, boolean]> { let toolpath: string = tc.find("MATLAB", release.version); let alreadyExists = false; if (toolpath) { core.info(`Found MATLAB ${release.name} in cache at ${toolpath}.`); alreadyExists = true; } else { - if (platform === "win32") { - toolpath = await windowsHostedToolpath(release).catch(async () => { - return await defaultToolpath(release); - }); - } else { - toolpath = await defaultToolpath(release); - } + toolpath = await makeToolcacheDir(platform, release); } if (platform == "darwin") { toolpath = toolpath + "/MATLAB.app"; @@ -39,7 +33,20 @@ export async function makeToolcacheDir(release: Release, platform: string): Prom return [toolpath, alreadyExists] } -async function windowsHostedToolpath(release: Release): Promise { +async function makeToolcacheDir(platform: string, release: Release): Promise { + let toolcacheDir: string; + if (platform === "win32") { + toolcacheDir = await makeWindowsHostedToolpath(release) + .catch(async () => { + return await makeDefaultToolpath(release) + }); + } else { + toolcacheDir = await makeDefaultToolpath(release); + } + return toolcacheDir; +} + +async function makeWindowsHostedToolpath(release: Release): Promise { // bail early if not on a github hosted runner if (process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && process.env['AGENT_ISSELFHOSTED'] === '1') { return Promise.reject(); @@ -59,11 +66,16 @@ async function windowsHostedToolpath(release: Release): Promise { process.env['RUNNER_TOOL_CACHE'] = actualToolCacheRoot; // create install directory and link it to the toolcache directory + console.log("writing .keep"); fs.writeFileSync(".keep", ""); + console.log("creating toolcache dir"); let actualToolCacheDir = await tc.cacheFile(".keep", ".keep", "MATLAB", release.version); + console.log("removing .keep"); io.rmRF(".keep"); let defaultToolCacheDir = actualToolCacheDir.replace(actualToolCacheRoot, defaultToolCacheRoot); + console.log("make linked"); fs.mkdirSync(path.dirname(defaultToolCacheDir), {recursive: true}); + console.log("symlink"); fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); // required for github actions to make the cacheDir persistent @@ -75,7 +87,7 @@ async function windowsHostedToolpath(release: Release): Promise { return actualToolCacheDir; } -async function defaultToolpath(release: Release): Promise { +async function makeDefaultToolpath(release: Release): Promise { fs.writeFileSync(".keep", ""); let toolpath = await tc.cacheFile(".keep", ".keep", "MATLAB", release.version); io.rmRF(".keep"); diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index b51df75..3b262b4 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -46,20 +46,20 @@ describe("matlab tests", () => { it("returns toolpath if in toolcache", async () => { findMock.mockReturnValue("/opt/hostedtoolcache/matlab/r2022b"); - await expect(matlab.makeToolcacheDir(release, platform)).resolves.toMatchObject(["/opt/hostedtoolcache/matlab/r2022b", true]); + await expect(matlab.getToolcacheDir(platform, release)).resolves.toMatchObject(["/opt/hostedtoolcache/matlab/r2022b", true]); expect(infoMock).toHaveBeenCalledTimes(1); }); it("creates cache and returns default path for linux", async () => { findMock.mockReturnValue(""); cacheFileMock.mockReturnValue("/opt/hostedtoolcache/matlab/r2022b"); - await expect(matlab.makeToolcacheDir(release, platform)).resolves.toMatchObject(["/opt/hostedtoolcache/matlab/r2022b", false]); + await expect(matlab.getToolcacheDir(platform, release)).resolves.toMatchObject(["/opt/hostedtoolcache/matlab/r2022b", false]); }); it("creates cache and returns default path for mac", async () => { findMock.mockReturnValue(""); cacheFileMock.mockReturnValue("/opt/hostedtoolcache/matlab/r2022b"); - await expect(matlab.makeToolcacheDir(release, "darwin")).resolves.toMatchObject(["/opt/hostedtoolcache/matlab/r2022b/MATLAB.app", false]); + await expect(matlab.getToolcacheDir("darwin", release)).resolves.toMatchObject(["/opt/hostedtoolcache/matlab/r2022b/MATLAB.app", false]); }); describe("windows performance workaround", () => { @@ -94,7 +94,7 @@ describe("matlab tests", () => { let mkdirSyncSpy = jest.spyOn(fs, "mkdirSync").mockImplementation(() => ""); let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); - await expect(matlab.makeToolcacheDir(release, "win32")).resolves.toMatchObject([expectedToolcacheDir, false]); + await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); expect(existsSyncSpy).toHaveBeenCalledTimes(2); expect(mkdirSyncSpy).toHaveBeenCalledTimes(1); expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); @@ -104,26 +104,26 @@ describe("matlab tests", () => { let expectedToolcacheDir = "C:\\hostedtoolcache\\windows\\matlab\\r2022b"; process.env["AGENT_ISSELFHOSTED"] = "1"; process.env["RUNNER_ENVIRONMENT"] = "self-hosted"; - await expect(matlab.makeToolcacheDir(release, "win32")).resolves.toMatchObject([expectedToolcacheDir, false]); + await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); }); it("uses default toolcache directory toolcache directory is not defined", async () => { let expectedToolcacheDir = "C:\\hostedtoolcache\\windows\\matlab\\r2022b"; process.env["RUNNER_TOOL_CACHE"] = ''; cacheFileMock.mockReturnValue(expectedToolcacheDir); - await expect(matlab.makeToolcacheDir(release, "win32")).resolves.toMatchObject([expectedToolcacheDir, false]); + await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); }); it("uses default toolcache directory if d: drive doesn't exist", async () => { jest.spyOn(fs, "existsSync").mockReturnValue(false); let expectedToolcacheDir = "C:\\hostedtoolcache\\windows\\matlab\\r2022b"; - await expect(matlab.makeToolcacheDir(release, "win32")).resolves.toMatchObject([expectedToolcacheDir, false]); + await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); }); it("uses default toolcache directory if c: drive doesn't exist", async () => { jest.spyOn(fs, "existsSync").mockReturnValueOnce(true).mockReturnValue(false); let expectedToolcacheDir = "C:\\hostedtoolcache\\windows\\matlab\\r2022b"; - await expect(matlab.makeToolcacheDir(release, "win32")).resolves.toMatchObject([expectedToolcacheDir, false]); + await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); }); }); From 1b72d88b2a3d737ed9c5dba2bd45877341adec69 Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 15:44:27 -0400 Subject: [PATCH 06/12] idk --- src/matlab.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index 3b262b4..58d8bcf 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -95,7 +95,7 @@ describe("matlab tests", () => { let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); - expect(existsSyncSpy).toHaveBeenCalledTimes(2); + expect(existsSyncSpy).toHaveBeenCalledTimes(10); expect(mkdirSyncSpy).toHaveBeenCalledTimes(1); expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); }); From 82239fd351f7f372f47e4fe3ed6ecc994c5ff727 Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 15:45:22 -0400 Subject: [PATCH 07/12] idk --- src/matlab.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index 58d8bcf..b43821d 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -95,7 +95,7 @@ describe("matlab tests", () => { let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); - expect(existsSyncSpy).toHaveBeenCalledTimes(10); + expect(existsSyncSpy).toHaveBeenCalledTimes(6); expect(mkdirSyncSpy).toHaveBeenCalledTimes(1); expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); }); From 69825564038085bd8190433ede0f837c4da25b3c Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 15:49:57 -0400 Subject: [PATCH 08/12] idk --- src/matlab.ts | 8 ++++---- src/matlab.unit.test.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/matlab.ts b/src/matlab.ts index 5ad6a5a..9441b10 100644 --- a/src/matlab.ts +++ b/src/matlab.ts @@ -76,12 +76,12 @@ async function makeWindowsHostedToolpath(release: Release): Promise { console.log("make linked"); fs.mkdirSync(path.dirname(defaultToolCacheDir), {recursive: true}); console.log("symlink"); - fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); + // fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); // required for github actions to make the cacheDir persistent - const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; - const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; - fs.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); + // const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; + // const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; + // fs.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; return actualToolCacheDir; diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index b43821d..4667968 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -92,12 +92,12 @@ describe("matlab tests", () => { // mock & no-op fs operations let existsSyncSpy = jest.spyOn(fs, "existsSync").mockReturnValue(true); let mkdirSyncSpy = jest.spyOn(fs, "mkdirSync").mockImplementation(() => ""); - let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); + // let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); expect(existsSyncSpy).toHaveBeenCalledTimes(6); expect(mkdirSyncSpy).toHaveBeenCalledTimes(1); - expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); + // expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); }); it("uses default toolcache directory if not github hosted", async () => { From fe311f2a7f56f9e7716723dee6e74e314bae66ca Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Tue, 2 Apr 2024 16:08:14 -0400 Subject: [PATCH 09/12] idk --- src/matlab.ts | 11 ++++++----- src/matlab.unit.test.ts | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/matlab.ts b/src/matlab.ts index 9441b10..1e5f93b 100644 --- a/src/matlab.ts +++ b/src/matlab.ts @@ -37,7 +37,8 @@ async function makeToolcacheDir(platform: string, release: Release): Promise { + .catch(async (e) => { + console.log(e) return await makeDefaultToolpath(release) }); } else { @@ -76,12 +77,12 @@ async function makeWindowsHostedToolpath(release: Release): Promise { console.log("make linked"); fs.mkdirSync(path.dirname(defaultToolCacheDir), {recursive: true}); console.log("symlink"); - // fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); + fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); // required for github actions to make the cacheDir persistent - // const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; - // const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; - // fs.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); + const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; + const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; + fs.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; return actualToolCacheDir; diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index 4667968..b43821d 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -92,12 +92,12 @@ describe("matlab tests", () => { // mock & no-op fs operations let existsSyncSpy = jest.spyOn(fs, "existsSync").mockReturnValue(true); let mkdirSyncSpy = jest.spyOn(fs, "mkdirSync").mockImplementation(() => ""); - // let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); + let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); expect(existsSyncSpy).toHaveBeenCalledTimes(6); expect(mkdirSyncSpy).toHaveBeenCalledTimes(1); - // expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); + expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); }); it("uses default toolcache directory if not github hosted", async () => { From 91a96f87379d08e6b8621dac21c393c21a598c80 Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Wed, 3 Apr 2024 14:01:28 -0400 Subject: [PATCH 10/12] try only caching D --- .github/workflows/bat.yml | 28 ---------------------------- src/matlab.ts | 5 ----- src/matlab.unit.test.ts | 2 +- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1cdd666..1106d8d 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -26,38 +26,11 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - release: latest - products: Symbolic_Math_Toolbox - check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); - check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); - - os: ubuntu-latest - release: latest-including-prerelease - products: Symbolic_Math_Toolbox - check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); - check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); - - os: ubuntu-20.04 - release: R2021bU2 - products: | - MATLAB - Symbolic_Math_Toolbox - check-matlab: matlabVer = ver('matlab'); assert(strcmp(matlabVer.Release,'(R2021b)')); - check-toolbox: symbolicVer = ver('symbolic'); assert(strcmp(symbolicVer.Release,'(R2021b)')); - os: windows-latest release: latest products: Symbolic_Math_Toolbox check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); - - os: macos-latest - release: latest - products: Symbolic_Math_Toolbox - check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); - check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); - - os: macos-14 - release: latest - products: Symbolic_Math_Toolbox - check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); - check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); steps: - uses: actions/download-artifact@v4 with: @@ -67,7 +40,6 @@ jobs: uses: actions/cache@v4 with: path: | - ${{ runner.tool_cache }}/MATLAB D:\hostedtoolcache\windows\MATLAB\2023.2.999\x64 key: ${{ matrix.os }}-${{ matrix.release }} - name: Install selected products diff --git a/src/matlab.ts b/src/matlab.ts index 1e5f93b..ca0e517 100644 --- a/src/matlab.ts +++ b/src/matlab.ts @@ -67,16 +67,11 @@ async function makeWindowsHostedToolpath(release: Release): Promise { process.env['RUNNER_TOOL_CACHE'] = actualToolCacheRoot; // create install directory and link it to the toolcache directory - console.log("writing .keep"); fs.writeFileSync(".keep", ""); - console.log("creating toolcache dir"); let actualToolCacheDir = await tc.cacheFile(".keep", ".keep", "MATLAB", release.version); - console.log("removing .keep"); io.rmRF(".keep"); let defaultToolCacheDir = actualToolCacheDir.replace(actualToolCacheRoot, defaultToolCacheRoot); - console.log("make linked"); fs.mkdirSync(path.dirname(defaultToolCacheDir), {recursive: true}); - console.log("symlink"); fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); // required for github actions to make the cacheDir persistent diff --git a/src/matlab.unit.test.ts b/src/matlab.unit.test.ts index b43821d..3b262b4 100644 --- a/src/matlab.unit.test.ts +++ b/src/matlab.unit.test.ts @@ -95,7 +95,7 @@ describe("matlab tests", () => { let symlinkSyncSpy = jest.spyOn(fs, "symlinkSync").mockImplementation(() => {}); await expect(matlab.getToolcacheDir("win32", release)).resolves.toMatchObject([expectedToolcacheDir, false]); - expect(existsSyncSpy).toHaveBeenCalledTimes(6); + expect(existsSyncSpy).toHaveBeenCalledTimes(2); expect(mkdirSyncSpy).toHaveBeenCalledTimes(1); expect(symlinkSyncSpy).toHaveBeenCalledTimes(2); }); From e90737458f66fab2733a717baf4d6dce06f9ad89 Mon Sep 17 00:00:00 2001 From: David Buzinski <103441853+davidbuzinski@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:15:58 -0400 Subject: [PATCH 11/12] Update bat.yml --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1106d8d..2031e3d 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -40,7 +40,7 @@ jobs: uses: actions/cache@v4 with: path: | - D:\hostedtoolcache\windows\MATLAB\2023.2.999\x64 + D:\hostedtoolcache\windows\MATLAB key: ${{ matrix.os }}-${{ matrix.release }} - name: Install selected products id: setup_matlab From c823ce802c7cee58762f6f456f53438247b1f1ca Mon Sep 17 00:00:00 2001 From: David Buzinski Date: Wed, 10 Apr 2024 11:03:53 -0400 Subject: [PATCH 12/12] restore bat.yml --- .github/workflows/bat.yml | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1106d8d..77eba90 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -26,22 +26,42 @@ jobs: fail-fast: false matrix: include: + - os: ubuntu-latest + release: latest + products: Symbolic_Math_Toolbox + check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); + check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); + - os: ubuntu-latest + release: latest-including-prerelease + products: Symbolic_Math_Toolbox + check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); + check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); + - os: ubuntu-20.04 + release: R2021bU2 + products: | + MATLAB + Symbolic_Math_Toolbox + check-matlab: matlabVer = ver('matlab'); assert(strcmp(matlabVer.Release,'(R2021b)')); + check-toolbox: symbolicVer = ver('symbolic'); assert(strcmp(symbolicVer.Release,'(R2021b)')); - os: windows-latest release: latest products: Symbolic_Math_Toolbox check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); + - os: macos-latest + release: latest + products: Symbolic_Math_Toolbox + check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); + check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); + - os: macos-14 + release: latest + products: Symbolic_Math_Toolbox + check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); + check-toolbox: symbolicVer = ver('symbolic'); assert(~isempty(symbolicVer)); steps: - uses: actions/download-artifact@v4 with: name: built-action - - name: Cache MATLAB - id: cache-matlab - uses: actions/cache@v4 - with: - path: | - D:\hostedtoolcache\windows\MATLAB\2023.2.999\x64 - key: ${{ matrix.os }}-${{ matrix.release }} - name: Install selected products id: setup_matlab uses: ./ @@ -59,3 +79,8 @@ jobs: uses: matlab-actions/run-command@v2 with: command: "${{ matrix.check-toolbox }}" + - name: Check NoOp on 2nd install + uses: ./ + with: + release: ${{ matrix.release }} + products: ${{ matrix.products }}