From 55d1bf0a06a51e488bcd0ff77b7297b25d1aaf9f Mon Sep 17 00:00:00 2001 From: Mark Cafaro Date: Mon, 7 Apr 2025 12:18:21 -0400 Subject: [PATCH 1/3] Set MW_BATCH_LICENSING_ONLINE to true --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 92c2e0b..00afa4f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,10 @@ async function run() { const startupOpts = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOpts); + const execOptions = { + env: {...process.env, MW_BATCH_LICENSING_ONLINE: 'true'} // remove when online batch licensing is the default + }; + await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOpts); } // Only run this action if it is invoked directly. Do not run if this node From b06a8be32aa5de9050da20285eef06ada42bd26d Mon Sep 17 00:00:00 2001 From: Mark Cafaro Date: Mon, 7 Apr 2025 12:23:22 -0400 Subject: [PATCH 2/3] Styling touch ups --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 00afa4f..6067c87 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,10 +17,10 @@ async function run() { const startupOpts = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - const execOptions = { - env: {...process.env, MW_BATCH_LICENSING_ONLINE: 'true'} // remove when online batch licensing is the default + const execOpts = { + env: {...process.env, MW_BATCH_LICENSING_ONLINE:'true'} // remove when online batch licensing is the default }; - await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOpts); + await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOpts), startupOpts); } // Only run this action if it is invoked directly. Do not run if this node From 80ccbefbfe8613f7a688cce7a961a672071c1dfe Mon Sep 17 00:00:00 2001 From: Mark Cafaro Date: Mon, 7 Apr 2025 13:18:17 -0400 Subject: [PATCH 3/3] Add test to verify env vars are properly set --- .github/workflows/bat.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index f3295e0..b137eec 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -88,3 +88,19 @@ jobs: [~, f] = fileparts(pwd); assert(strcmp(f, 'subdir')); startup-options: -sd subdir + + - name: Verify environment variables make it to MATLAB + uses: ./ + with: + command: exp = 'my_value', act = getenv('MY_VAR'), assert(strcmp(act, exp), strjoin({act exp}, '\n')); + env: + MY_VAR: my_value + + # Remove when online batch licensing is the default + - name: Verify MW_BATCH_LICENSING_ONLINE variable set + uses: ./ + with: + command: exp = 'true', act = getenv('MW_BATCH_LICENSING_ONLINE'), assert(strcmp(act, exp), strjoin({act exp}, '\n')); + env: + MY_VAR: my_value +