From 28000dcfb11baf5731f8261991c3d5845b424344 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 17 Dec 2020 16:24:30 +0100
Subject: [PATCH] CI: use variables for chosing MATLAB and Octave versions

(manually cherry picked from commit 7743fc6f623ba7afdf1a627bc0a5a8e99ccfadef)
---
 .gitlab-ci.yml | 11 ++++++-----
 Makefile       |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5a83d21..7227358 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,9 @@
 variables:
   GIT_SUBMODULE_STRATEGY: normal
   TERM: linux
+  MATLAB_VERSION: R2020b
+  OLD_MATLAB_VERSION: R2009b
+  OCTAVE_VERSION: 5.2.0
 
 before_script:
   - git clone https://git.dynare.org/Dynare/m-unit-tests
@@ -8,18 +11,16 @@ before_script:
 test_matlab:
   stage: test
   script:
-    - make check-matlab
+    - make check-matlab MATLAB=/usr/local/MATLAB/$MATLAB_VERSION/bin/matlab
 
 test_old_matlab:
   stage: test
-  variables:
-    MATLAB: /usr/local/MATLAB/R2009b/bin/matlab
   script:
-    - make check-matlab
+    - make check-matlab MATLAB=/usr/local/MATLAB/$OLD_MATLAB_VERSION/bin/matlab
 
 test_octave:
   stage: test
   variables:
     OPENBLAS_NUM_THREADS: 1
   script:
-    - make check-octave
+    - make check-octave OCTAVE=/usr/local/octave/$OCTAVE_VERSION/bin/octave
diff --git a/Makefile b/Makefile
index d389dc5..cafff1d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 OCTAVE ?= octave-cli
-MATLAB ?= $(shell which matlab)
+MATLAB ?= matlab
 
 all: check-octave check-matlab
 
-- 
GitLab