Skip to content
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

Run MATLAB from shell with v2? #89

Closed
rdzman opened this issue Feb 2, 2024 · 4 comments
Closed

Run MATLAB from shell with v2? #89

rdzman opened this issue Feb 2, 2024 · 4 comments

Comments

@rdzman
Copy link

rdzman commented Feb 2, 2024

With v1 I was able to configure my CI to use the same workflow to run my own custom test environment in both MATLAB and Octave, by launching them via the command line. For MATLAB, I used matlab -batch "myscript".

After switching to v2, I get a "License checkout failed" error when attempting to launch MATLAB from a shell.

License checkout failed.
License Manager Error -1
The license file cannot be found.

Troubleshoot this issue by visiting: 
https://www.mathworks.com/support/lme/1

Diagnostic Information:
Feature: MATLAB 
License path: /home/runner/.matlab/R2023b_licenses:/opt/hostedtoolcache/MATLAB/2023.2.999/x64/licenses/license.dat:/opt/hostedtoolcache/MATLAB/2023.2.999/x64/licenses 

Can I add a -c licensefile to the command to make it work? If so, where is the license file? If not, please tell me how I can successfully launch MATLAB from a shell script to run my custom tests.

And keep in mind that the reason I am not able to use matlab-actions/run-command is because I'm using the same workflow to run my custom test scripts on Octave. I have a lot of projects with this setup, so redesigning all of them would be prohibitive.

Any help is appreciated.

@mcafaro
Copy link
Member

mcafaro commented Feb 2, 2024

Hi @rdzman,

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. 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')"

@mcafaro mcafaro changed the title "License checkout failed" with v2 Run MATLAB from shell with v2? Feb 2, 2024
rdzman added a commit to MATPOWER/action-configure-matlab that referenced this issue Feb 2, 2024
…up-matlab@v2.

For the latter, I had to use the undocumented 'run-matlab-command'.

Ref: matlab-actions/setup-matlab#89 (comment)
rdzman added a commit to MATPOWER/action-configure-matlab that referenced this issue Feb 2, 2024
…up-matlab@v2.

For the latter, I had to use the undocumented 'run-matlab-command'.

Ref: matlab-actions/setup-matlab#89 (comment)
rdzman added a commit to MATPOWER/action-configure-matlab that referenced this issue Feb 2, 2024
…up-matlab@v2.

For the latter, I had to use the undocumented 'run-matlab-command'.
Remove os input. Make note about nojvm input being irrelevant under v2.

Ref: matlab-actions/setup-matlab#89 (comment)
rdzman added a commit to MATPOWER/action-configure-matlab that referenced this issue Feb 2, 2024
…up-matlab@v2.

For the latter, I had to use the undocumented 'run-matlab-command'.
Remove os input. Make note about nojvm input being irrelevant under v2.

Ref: matlab-actions/setup-matlab#89 (comment)
@rdzman
Copy link
Author

rdzman commented Feb 2, 2024

Thank you. This appears to solve the problem ... with one minor issue.

With v1, there were quite a few Matlab Toolboxes included, but when I run v2 via run-matlab-command, it is missing those toolboxes. In particular, some of my tests depend on the Optimization Toolbox and some on the Statistics and Machine Learning Toolbox.

Is there a way to include these via run-matlab-command?

@mcafaro
Copy link
Member

mcafaro commented Feb 5, 2024

With setup-matlab@v2, you need to specify what products you want to install with the "products" input as shown below.

- name: Set up MATLAB
  uses: matlab-actions/setup-matlab@v2-beta
  with:
    products: Optimization_Toolbox Statistics_and_Machine_Learning_Toolbox

These details will be in the action documentation when v2 is officially released shortly.

@rdzman
Copy link
Author

rdzman commented Feb 5, 2024

Thank you! Exactly what I needed.

Please do let me know if/when this run-matlab-command approach is superseded by an officially supported alternative for shell-based workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants