run-command
run-command copied to clipboard
Run Matlab executable outside the context of this action
Hello, sorry if this isn't the correct place to ask this question. The CI/CD testing of our MATLAB library uses a Python script which calls directly calls the matlab binary (among testing and doing other things). So unfortunately we can't directly use this action.
Calling this, for example, fails
$ echo 'frpintf("Hello world\n");' > hello.m
$/opt/hostedtoolcache/MATLAB/2023.2.999/x64/bin/matlab -batch "hello"
License checkout failed.
License Manager Error -1
The license file cannot be found.
This repository seems to use an intermediary command located at $WORKINGDIR/$os/run-matlab-command$bin_ext. Presumably it configures the license or something?
Is there any workaround we can use to be able to call the Matlab executable directly? Like loading the action and calling this run-matlab-command command?
Thanks.
Hi @externl,
At the moment, the run-*@v2 actions (i.e. run-command@v2, run-tests@v2, and run-build@v2) are the only supported ways to run and license MATLAB for open source projects with matlab-actions/setup-matlab@v2.
We are considering ways to support shell-based workflows in the future but I do not have anything official to give you now. As you noted, the run actions use a "run-matlab-command" binary behind-the-scenes that you could use as a stopgap for shell-based workflows but please note the "run-matlab-command" binary is undocumented and subject to change in the future.
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v2
- name: Get run-matlab-command
run: |
wget -O /usr/local/bin/run-matlab-command https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2/glnxa64/run-matlab-command
chmod +x /usr/local/bin/run-matlab-command
- name: Run MATLAB Command
run: run-matlab-command "disp('hello world')"
Thanks @mcafaro, we'll probably try this workaround for now!