GitHub Action to configure MATLAB
Configures MATLAB by defining environment variables and optionally installing some 3rd party solvers.
Optionally installs the MATLAB interface for COIN-OR's IPOPT and
defines the IPOPT_PATH environment variable to point to the directory
containing the IPOPT MEX- and M-files.
Optionally installs the MATLAB interface for OSQP and defines the
OSQP_PATH environment variable to point to the directory containing the
OSQP MEX- and M-files.
Sets the following environment variables.
MATLAB_RELset to the release name (e.g.'R2021a') of installed MATLABMATLAB_VERset to the version (e.g.'9.1.0') of installed MATLAB,ML_NAMEset toMATLABML_VERset to same asMATLAB_VERML_CMDset to/usr/local/MATLAB/${MATLAB_REL}/bin/matlab -nojvm -batchML_PATHVARset toMATLABPATHIPOPT_PATHset to$HOME/build/ipopt(ifipoptinput istrue)OSQP_PATHset to$HOME/build/osqp-matlab(ifosqpinput istrue) (currently set equal to release name instead)
Note: This action depends on MATLAB being installed first, using
matlab-actions/setup-matlab and currently, as of Aug 25, 2021, works
on ubuntu-18.04, ubuntu-20.04 and ubuntu-latest.
os- (default'ubuntu-latest') required ifipoptistrueto distinguishubuntu-18.04fromubuntu-20.04/ubuntu-latestnojvm- (defaulttrue) set tofalseto exclude the-nojvmflag from the definition ofML_CMDipopt- (defaultfalse) if true, include IPOPT interface in~/build/ipoptipopt-cached- (defaultfalse) install IPOPT interface from cached build, if true andipoptistrueosqp- (defaultfalse) if true, include OSQP interface, in~/build/osqp-matlabosqp-cached- (defaultfalse) install OSQP interface from cached build, if true andosqpistrue
None.
Default Inputs
steps:
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Configure MATLAB
uses: MATPOWER/action-configure-matlab@v1
- name: MATLAB ${{ env.ML_VER }} Installed
run: $ML_CMD ver
- name: Run MATLAB script with path
run: |
export MY_PATH=<path-to-my-MATLAB-code>
env $ML_PATHNAME=$MY_PATH $ML_CMD <my-MATLAB-script>
With support for JVM, IPOPT, and OSQP
strategy:
fail-fast: false
matrix:
platform: [matlab]
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Cache IPOPT interface
id: cache-ipopt
env:
cache-name: ipopt
uses: actions/cache@v3
with:
path: ~/build/ipopt
key: ${{ env.cache-name }}-${{ matrix.platform }}-${{ matrix.os }}
- name: Cache OSQP interface
id: cache-osqp
env:
cache-name: osqp
uses: actions/cache@v3
with:
path: ~/build/osqp-matlab
key: ${{ env.cache-name }}-${{ matrix.platform }}-${{ matrix.os }}
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Configure MATLAB
if: matrix.platform == 'matlab'
uses: MATPOWER/action-configure-matlab@v1
with:
os: ${{ matrix.os }}
nojvm: false
ipopt: ${{ env.INCLUDE_IPOPT == 1 }}
ipopt-cached: ${{ steps.cache-ipopt.outputs.cache-hit == 'true' }}
osqp: ${{ env.INCLUDE_OSQP == 1 }}
osqp-cached: ${{ steps.cache-osqp.outputs.cache-hit == 'true' }}
- name: MATLAB ${{ env.ML_VER }} Installed
run: $ML_CMD ver
- name: Run MATLAB script with path
run: |
$ML_CMD "fprintf('OSQP Version %s installed\n', osqp().version)"
export MY_PATH=<path-to-my-MATLAB-code>
env $ML_PATHNAME=$MY_PATH $ML_CMD <my-MATLAB-script>