-
Notifications
You must be signed in to change notification settings - Fork 14
Add a source
argument to setup-matlab
#149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// Copyright 2020-2025 The MathWorks, Inc. | ||
|
||
import * as core from "@actions/core"; | ||
import * as crypto from "crypto"; | ||
import * as matlab from "./matlab"; | ||
import * as mpm from "./mpm"; | ||
import * as path from "path"; | ||
|
@@ -56,7 +57,7 @@ export async function install(platform: string, architecture: string, release: s | |
core.setOutput('matlabroot', destination); | ||
|
||
await matlab.setupBatch(platform, matlabArch); | ||
|
||
if (platform === "win32") { | ||
if (matlabArch === "x86") { | ||
core.addPath(path.join(destination, "runtime", "win32")); | ||
|
@@ -68,3 +69,39 @@ export async function install(platform: string, architecture: string, release: s | |
|
||
return; | ||
} | ||
|
||
// Limitations | ||
// | ||
// * No system dependencies are installed | ||
// * Does not cache | ||
export async function installFromSource(platform: string, architecture: string, source: string, products: string[]) { | ||
// Create release key | ||
const releaseKey = 'source-' + crypto.createHash('sha256').update(source).digest('hex'); | ||
const releaseInfo = { | ||
name: releaseKey, | ||
version: "1.0.0", | ||
update: "", | ||
isPrerelease: false | ||
}; | ||
Comment on lines
+80
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about looking for this info in |
||
|
||
const [destination, alreadyExists]: [string, boolean] = await matlab.getToolcacheDir(platform, releaseInfo); | ||
|
||
if (!alreadyExists) { | ||
const mpmPath: string = await mpm.setup(platform, architecture); | ||
await mpm.installFromSource(mpmPath, source, products, destination); | ||
core.saveState(State.InstallSuccessful, 'true'); | ||
} | ||
|
||
core.addPath(path.join(destination, "bin")); | ||
core.setOutput('matlabroot', destination); | ||
|
||
await matlab.setupBatch(platform, architecture); | ||
|
||
if (platform === "win32") { | ||
if (architecture === "x86") { | ||
core.addPath(path.join(destination, "runtime", "win32")); | ||
} else { | ||
core.addPath(path.join(destination, "runtime", "win64")); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sameagen-MW: Is this going to be an internal feature or are we going to document the input right away?
(https://www.mathworks.com/help/install/ug/mpminstall.html#mw_5abeb5ba-92a4-4ecf-8e4d-263760988c7e)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the goal is to document it right away. It has some niche use cases with self-hosted runners, but also acts as a mitigating factor if there's ever any future outages.