-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
173 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
description: > | ||
Run builds using the MATLAB build tool. Use this command to run the tasks in the plan returned | ||
by a file named buildfile.m in the root of your repository. To use the run-build command, you | ||
need MATLAB R2022b or a later release. | ||
parameters: | ||
tasks: | ||
description: > | ||
Space-separated list of tasks to run. If not specified, the command runs the default tasks | ||
in the plan returned by buildfile.m as well as all the tasks on which they depend. | ||
type: string | ||
default: "" | ||
no-output-timeout: | ||
description: > | ||
Elapsed time the command can run without output. The string is a decimal with unit suffix, | ||
such as “20m”, “1.25h”, “5s”. The default is 10 minutes and the maximum is governed by the | ||
maximum time a job is allowed to run. | ||
type: string | ||
default: 10m | ||
|
||
steps: | ||
- run: | ||
name: Run MATLAB build | ||
environment: | ||
PARAM_TASKS: <<parameters.tasks>> | ||
command: <<include(scripts/run-build.sh)>> | ||
shell: bash | ||
no_output_timeout: <<parameters.no-output-timeout>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
description: > | ||
Run a MATLAB build for your project. | ||
usage: | ||
version: 2.1 | ||
orbs: | ||
matlab: mathworks/matlab@0 | ||
jobs: | ||
build: | ||
machine: | ||
image: ubuntu-2204:2022.07.1 | ||
steps: | ||
- checkout | ||
- matlab/install | ||
- matlab/run-build: | ||
tasks: test | ||
workflows: | ||
build: | ||
jobs: | ||
- build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
downloadAndRun() { | ||
url=$1 | ||
shift | ||
if [[ -x $(command -v sudo) ]]; then | ||
curl -sfL $url | sudo -E bash -s -- "$@" | ||
else | ||
curl -sfL $url | bash -s -- "$@" | ||
fi | ||
} | ||
|
||
tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'run-command') | ||
|
||
# install run-matlab-command | ||
downloadAndRun https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v1/install.sh "${tmpdir}/bin" | ||
|
||
# form OS appropriate paths for MATLAB | ||
os=$(uname) | ||
workdir=$(pwd) | ||
scriptdir=$tmpdir | ||
binext="" | ||
if [[ $os = CYGWIN* || $os = MINGW* || $os = MSYS* ]]; then | ||
workdir=$(cygpath -w "$workdir") | ||
scriptdir=$(cygpath -w "$scriptdir") | ||
binext=".exe" | ||
fi | ||
|
||
# create buildtool command from parameters | ||
buildCommand="buildtool ${PARAM_TASKS}" | ||
|
||
# create script to execute | ||
script=command_${RANDOM} | ||
scriptpath=${tmpdir}/${script}.m | ||
echo "cd('${workdir//\'/\'\'}');" > "$scriptpath" | ||
cat << EOF >> "$scriptpath" | ||
$buildCommand | ||
EOF | ||
|
||
# run MATLAB command | ||
"${tmpdir}/bin/run-matlab-command$binext" "cd('${scriptdir//\'/\'\'}');$script" |