-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
107 lines (99 loc) · 5.49 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: 'Set up MATLAB'
description: 'Set up env vars for MATLAB'
author: 'Ray Zimmerman'
inputs:
os:
description: 'required for ipopt to distinguish ubuntu-18.04 from 20.04/latest'
required: false
default: 'ubuntu-latest'
nojvm: # id of input
description: 'uses -nojvm flag, if true (default = true)'
required: false
default: true
ipopt:
description: 'builds and installs IPOPT interface, if true (default = false)'
required: false
default: false
ipopt-cached:
description: 'true means IPOPT is installing from a cached build'
required: false
default: false
osqp:
description: 'builds and installs OSQP interface, if true (default = false)'
required: false
default: false
osqp-cached:
description: 'true means OSQP is installing from a cached build'
required: false
default: false
runs:
using: "composite"
steps:
- name: Configure MATLAB
run: |
export MATLAB_REL=`ls /usr/local/MATLAB`
export FLAGS="-batch"
${{ inputs.nojvm }} && export FLAGS="-nojvm $FLAGS"
echo "MATLAB_REL=${MATLAB_REL}" >> $GITHUB_ENV
echo "ML_NAME=MATLAB" >> $GITHUB_ENV
echo "ML_CMD=/usr/local/MATLAB/${MATLAB_REL}/bin/matlab $FLAGS" >> $GITHUB_ENV
echo "ML_PATHVAR=MATLABPATH" >> $GITHUB_ENV
shell: bash
# export MATLAB_VER=`matlab -nojvm -batch "fprintf('%s', ver('matlab').Version)"`
- name: Set MATLAB_VER, ML_VER
run: |
export MATLAB_VER=${MATLAB_REL}
echo "MATLAB_VER=${MATLAB_VER}" >> $GITHUB_ENV
echo "ML_VER=${MATLAB_VER}" >> $GITHUB_ENV
shell: bash
- name: Build OSQP
run: |
${{ inputs.osqp }} && (${{ inputs.osqp-cached }} && echo "Include OSQP - cached - skip build" || echo "Build OSQP - not cached") || echo "Skip OSQP"
${{ inputs.osqp }} && export OSQP_PATH=$HOME/build/osqp-matlab
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && [ ! -d $HOME/build ] && mkdir -p $HOME/build
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && cd $HOME/build
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && git clone --recursive https://github.com/oxfordcontrol/osqp
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && git clone --recurse-submodules https://github.com/oxfordcontrol/osqp-matlab
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && mkdir -p $HOME/build/osqp/build
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && [ ! -d $HOME/install ] && mkdir -p $HOME/install
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && cd $HOME/build/osqp/build
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && cmake -DCMAKE_INSTALL_PREFIX=$HOME/install -G "Unix Makefiles" ..
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && cmake --build .
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && cmake --install .
${{ inputs.osqp }} && echo "OSQP_PATH=${OSQP_PATH}" >> $GITHUB_ENV
echo "-"
shell: bash
- name: Build and install OSQP MATLAB interface
run: |
${{ inputs.osqp }} && echo "Install OSQP interface" || echo "Skip OSQP interface"
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && ls -al $HOME/install/include/osqp
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && cd $HOME/build/osqp-matlab
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && $ML_CMD "make_osqp"
${{ inputs.osqp }} && ! ${{ inputs.osqp-cached }} && ls -al
${{ inputs.osqp }} && echo "$ML_CMD \"addpath('${OSQP_PATH}'); savepath('${GITHUB_WORKSPACE}/pathdef.m')\""
${{ inputs.osqp }} && $ML_CMD "addpath('${OSQP_PATH}'); savepath('${GITHUB_WORKSPACE}/pathdef.m')"
echo "-"
shell: bash
# expects that Octave and IPOPT libraries have already been installed
- name: Fetch IPOPT MATLAB interface
run: |
${{ inputs.ipopt }} && (${{ inputs.ipopt-cached }} && echo "Include IPOPT - cached - skip fetch" || echo "Fetch IPOPT - not cached") || echo "Skip IPOPT"
${{ inputs.ipopt }} && export IPOPT_PATH=$HOME/build/ipopt
${{ inputs.ipopt }} && ! ${{ inputs.ipopt-cached }} && mkdir -p $IPOPT_PATH
${{ inputs.ipopt }} && ! ${{ inputs.ipopt-cached }} && ${{ inputs.os == 'ubuntu-18.04' }} && curl -SL https://github.com/ebertolazzi/mexIPOPT/raw/master/toolbox/bin/linux_4/ipopt_linux_4.mexa64 --output $IPOPT_PATH/ipopt.mexa64
${{ inputs.ipopt }} && ! ${{ inputs.ipopt-cached }} && ${{ inputs.os != 'ubuntu-18.04' }} && curl -SL https://github.com/ebertolazzi/mexIPOPT/raw/master/toolbox/bin/linux_5/ipopt_linux_5.mexa64 --output $IPOPT_PATH/ipopt.mexa64
${{ inputs.ipopt }} && ! ${{ inputs.ipopt-cached }} && curl -SL https://github.com/ebertolazzi/mexIPOPT/raw/master/toolbox/lib/ipopt_auxdata.m --output $IPOPT_PATH/ipopt_auxdata.m
${{ inputs.ipopt }} && ! ${{ inputs.ipopt-cached }} && curl -SL https://github.com/ebertolazzi/mexIPOPT/raw/master/toolbox/lib/ipopt.m --output $IPOPT_PATH/ipopt.m
${{ inputs.ipopt }} && echo "IPOPT_PATH=${IPOPT_PATH}" >> $GITHUB_ENV
echo "-"
shell: bash
- name: Install IPOPT MATLAB interface
run: |
${{ inputs.ipopt }} && echo "Install IPOPT interface" || echo "Skip IPOPT interface"
${{ inputs.ipopt }} && echo "$ML_CMD \"addpath('${IPOPT_PATH}'); savepath('${GITHUB_WORKSPACE}/pathdef.m')\""
${{ inputs.ipopt }} && $ML_CMD "addpath('${IPOPT_PATH}'); savepath('${GITHUB_WORKSPACE}/pathdef.m')"
echo "-"
shell: bash
branding:
icon: 'zap'
color: 'yellow'