Skip to content
Snippets Groups Projects
Verified Commit deba9cd4 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

CI: add job for creating MATLAB Online package

parent 33d4b0ec
Branches
No related tags found
No related merge requests found
Checking pipeline status
...@@ -142,6 +142,20 @@ pkg_macOS_arm64: ...@@ -142,6 +142,20 @@ pkg_macOS_arm64:
expire_in: 3 days expire_in: 3 days
needs: [ "build_doc" ] needs: [ "build_doc" ]
pkg_matlab_online:
stage: pkg
script:
- meson rewrite kwargs set project / version "$VERSION"
- cd scripts/matlab-online && ./packageDynare.sh
tags:
- matlab-online
artifacts:
paths:
- scripts/matlab-online/*.mltbx
expire_in: 3 days
needs: []
when: manual
test_matlab: test_matlab:
stage: test stage: test
script: script:
......
function packageDynare(zipfile, version, logo) function packageDynare(zipfile, version, version_sanitized, logo)
tfolder = tempname; tfolder = tempname;
mkdir(tfolder) mkdir(tfolder)
...@@ -10,7 +10,7 @@ unzip(zipfile,dynarefld) ...@@ -10,7 +10,7 @@ unzip(zipfile,dynarefld)
% create tbx options % create tbx options
opts = matlab.addons.toolbox.ToolboxOptions(dynarefld, "dynare", ... opts = matlab.addons.toolbox.ToolboxOptions(dynarefld, "dynare", ...
ToolboxName = "Dynare", ... ToolboxName = "Dynare", ...
ToolboxVersion = version, ... ToolboxVersion = version_sanitized, ...
Summary = "Solves, simulates and estimates a wide class of economic models", ... Summary = "Solves, simulates and estimates a wide class of economic models", ...
AuthorName = "Dynare Team", ... AuthorName = "Dynare Team", ...
ToolboxImageFile = logo, ... ToolboxImageFile = logo, ...
......
#!/bin/bash #!/bin/bash
set -exo pipefail set -exo pipefail
# Creates a dynare-X.Y.mltbx in the current repository, using the settings below. # Creates a dynare-X.Y.mltbx in the current repository, using the settings
# Needs to be run from Ubuntu 24.04 LTS, with the needed packages installed. # below. Needs to be run from Ubuntu, with the needed packages installed.
# The required Ubuntu version can be obtained by running “!lsb_release -a” in
# MATLAB Online.
X13ASVER=1-1-b61 X13ASVER=1-1-b61
MATLABPATH=/opt/MATLAB/R2024b MATLABVER=R2024b
MATLABPATH=/opt/MATLAB/${MATLABVER}
# TODO: change size and put white background for better rendering in MATLAB Add-Ons browser # TODO: change size and put white background for better rendering in MATLAB Add-Ons browser
DYNARE_PNG_LOGO=../../preprocessor/doc/logos/dlogo.png DYNARE_PNG_LOGO=../../preprocessor/doc/logos/dlogo.png
...@@ -18,13 +22,23 @@ cleanup () ...@@ -18,13 +22,23 @@ cleanup ()
trap cleanup EXIT trap cleanup EXIT
pushd ../.. pushd ../..
meson setup -Dmatlab_path="$MATLABPATH" -Dbuildtype=release -Dprefer_static=true "$tmpdir"/build-matlab-online meson setup -Dbuild_for=matlab -Dmatlab_path="$MATLABPATH" -Dbuildtype=release -Dprefer_static=true "$tmpdir"/build-matlab-online
cd "$tmpdir"/build-matlab-online cd "$tmpdir"/build-matlab-online
meson compile meson compile -v
meson install --destdir "$tmpdir" meson install --destdir "$tmpdir"
DYNAREVER=$(meson introspect --projectinfo | jq -r '.version') DYNAREVER=$(meson introspect --projectinfo | jq -r '.version')
# Sanitize the version number so that is corresponds to MATLAB toolbox
# requirements: the version must be a scalar string or character vector of the
# form Major.Minor.Bug.Build, where Bug and Build are optional.
# Hence remove any character which is not a number or a dot, and ensure that we
# have at least a minor version number.
DYNAREVER_SANITIZED=${DYNAREVER//[^0-9.]/}
if [[ ${DYNAREVER_SANITIZED} != *.* ]]; then
DYNAREVER_SANITIZED=${DYNAREVER_SANITIZED}.0
fi
cd .. cd ..
strip usr/local/bin/dynare-preprocessor strip usr/local/bin/dynare-preprocessor
strip usr/local/lib/dynare/mex/matlab/*.mexa64 strip usr/local/lib/dynare/mex/matlab/*.mexa64
...@@ -45,4 +59,4 @@ zip -q -r "$tmpdir"/dynare.zip * ...@@ -45,4 +59,4 @@ zip -q -r "$tmpdir"/dynare.zip *
# make toolbox # make toolbox
popd popd
"$MATLABPATH/bin/matlab" -batch "packageDynare('$tmpdir/dynare.zip', '$DYNAREVER', '$DYNARE_PNG_LOGO')" "$MATLABPATH/bin/matlab" -batch "packageDynare('$tmpdir/dynare.zip', '$DYNAREVER', '$DYNAREVER_SANITIZED', '$DYNARE_PNG_LOGO')"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment