variables:
  GIT_SUBMODULE_STRATEGY: normal
  TERM: linux
  MATLAB_VERSION: R2026a
  OLD_MATLAB_VERSION: R2020a
  # To ensure that "false && true" fails, see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/25394#note_412609647
  FF_ENABLE_BASH_EXIT_CODE_CHECK: 'true'

before_script:
  - git clone https://git.dynare.org/Dynare/m-unit-tests

test_matlab:
  stage: test
  script:
    - make check-matlab MATLAB=/opt/MATLAB/$MATLAB_VERSION/bin/matlab

test_old_matlab:
  variables:
    # Allows the stack to be executable, which is not allowed by default in Debian 13.
    # This is necessary for MATLAB ⩽ R2020a, otherwise it does not start.
    # This workaround may be dropped when we bump our minimal supported MATLAB version.
    GLIBC_TUNABLES: glibc.rtld.execstack=2
  stage: test
  script:
    - make check-matlab MATLAB=/opt/MATLAB/$OLD_MATLAB_VERSION/bin/matlab

test_octave:
  stage: test
  variables:
    OPENBLAS_NUM_THREADS: 1
  script:
    - make check-octave
