Skip to content

Commit 8dadb4c

Browse files
Update to use new run-matlab-command (#39)
* update to use RMC binary * added workdir to run-tests * fixing shellcheck findings in install * took out accidental activation flag def in install * taking out extra quotes in run-tests * fixing typo for windows paths * fixing casing and trying run-tests without heredoc * remove unused var * adding rootdir conversion back to install.sh * Update src/scripts/install.sh Co-authored-by: Mark Cafaro <34887852+mcafaro@users.noreply.github.com> * adding quotes around args to be safe * Update src/scripts/install.sh Co-authored-by: Mark Cafaro <34887852+mcafaro@users.noreply.github.com> Co-authored-by: Mark Cafaro <34887852+mcafaro@users.noreply.github.com>
1 parent 62ed804 commit 8dadb4c

File tree

3 files changed

+46
-13
lines changed

3 files changed

+46
-13
lines changed

src/scripts/install.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,28 @@ fi
1818

1919
# install core system dependencies
2020
if [[ $os = Linux ]]; then
21-
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/matlab-deps/v0/install.sh ${PARAM_RELEASE}
21+
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/matlab-deps/v0/install.sh "${PARAM_RELEASE}"
2222
fi
2323

2424
# install ephemeral version of MATLAB
25-
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/ephemeral-matlab/v0/ci-install.sh --release ${PARAM_RELEASE}
25+
if [ -n "${MATHWORKS_ACCOUNT}" ] && [ -n "${MATHWORKS_TOKEN}" ]; then
26+
activationFlag="--skip-activation"
27+
fi
28+
29+
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/ephemeral-matlab/v0/ci-install.sh --release "${PARAM_RELEASE}" $activationFlag
2630

27-
# add MATLAB to path
2831
tmpdir=$(dirname "$(mktemp -u)")
2932
rootdir=$(cat "$tmpdir/ephemeral_matlab_root")
33+
34+
# install matlab-batch
3035
if [[ $os = CYGWIN* || $os = MINGW* || $os = MSYS* ]]; then
36+
batchInstallDir='/c/Program Files/matlab-batch'
3137
rootdir=$(cygpath "$rootdir")
38+
else
39+
batchInstallDir='/opt/matlab-batch'
3240
fi
33-
echo 'export PATH="'$rootdir'/bin:$PATH"' >> $BASH_ENV
41+
42+
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/matlab-batch/v0/install.sh "$batchInstallDir"
43+
44+
# add MATLAB and matlab-batch to path
45+
echo 'export PATH="'$rootdir'/bin:'$batchInstallDir':$PATH"' >> $BASH_ENV

src/scripts/run-command.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1+
downloadAndRun() {
2+
url=$1
3+
shift
4+
if [[ -x $(command -v sudo) ]]; then
5+
curl -sfL $url | sudo -E bash -s -- "$@"
6+
else
7+
curl -sfL $url | bash -s -- "$@"
8+
fi
9+
}
10+
111
tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'run-command')
212

3-
# download run command shell scripts
4-
curl -sfLo "${tmpdir}/run-matlab-command.zip" https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v0/run-matlab-command.zip
5-
unzip -qod "${tmpdir}/bin" "${tmpdir}/run-matlab-command.zip"
13+
# install run-matlab-command
14+
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v1/install.sh "${tmpdir}/bin"
615

716
# form OS appropriate paths for MATLAB
817
os=$(uname)
918
workdir=$(pwd)
1019
scriptdir=$tmpdir
20+
binext=""
1121
if [[ $os = CYGWIN* || $os = MINGW* || $os = MSYS* ]]; then
1222
workdir=$(cygpath -w "$workdir")
1323
scriptdir=$(cygpath -w "$scriptdir")
24+
binext=".exe"
1425
fi
1526

1627
# create script to execute
@@ -22,4 +33,4 @@ ${PARAM_COMMAND}
2233
EOF
2334

2435
# run MATLAB command
25-
"${tmpdir}/bin/run_matlab_command.sh" "cd('${scriptdir//\'/\'\'}'); $script"
36+
"${tmpdir}/bin/run-matlab-command$binext" "cd('${scriptdir//\'/\'\'}');$script"

src/scripts/run-tests.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
downloadAndRun() {
2+
url=$1
3+
shift
4+
if [[ -x $(command -v sudo) ]]; then
5+
curl -sfL $url | sudo -E bash -s -- "$@"
6+
else
7+
curl -sfL $url | bash -s -- "$@"
8+
fi
9+
}
10+
111
tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'run-tests')
212

3-
# download run command shell scripts
4-
curl -sfLo "${tmpdir}/bin.zip" https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v0/run-matlab-command.zip
5-
unzip -qod "${tmpdir}/bin" "${tmpdir}/bin.zip"
13+
# install run-matlab-command
14+
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v1/install.sh "${tmpdir}/bin"
615

716
# download script generator
817
curl -sfLo "${tmpdir}/scriptgen.zip" https://ssd.mathworks.com/supportfiles/ci/matlab-script-generator/v0/matlab-script-generator.zip
@@ -11,12 +20,13 @@ unzip -qod "${tmpdir}/scriptgen" "${tmpdir}/scriptgen.zip"
1120
# form OS appropriate paths for MATLAB
1221
os=$(uname)
1322
gendir=$tmpdir
23+
binext=""
1424
if [[ $os = CYGWIN* || $os = MINGW* || $os = MSYS* ]]; then
1525
gendir=$(cygpath -w "$gendir")
26+
binext=".exe"
1627
fi
1728

18-
# generate and run MATLAB test script
19-
"${tmpdir}/bin/run_matlab_command.sh" "\
29+
"${tmpdir}/bin/run-matlab-command$binext" "\
2030
addpath('${gendir}/scriptgen');\
2131
testScript = genscript('Test',\
2232
'JUnitTestResults','${PARAM_TEST_RESULTS_JUNIT}',\

0 commit comments

Comments
 (0)