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 + diff --git a/src/index.ts b/src/index.ts index 92c2e0b..6067c87 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 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,execOpts), startupOpts); } // Only run this action if it is invoked directly. Do not run if this node