@@ -118,7 +118,9 @@ jobs:
118118 if : startsWith(matrix.os, 'ubuntu')
119119 run : |
120120 GFVER=${{ env.GFORTRAN_VERSION }}
121- if [[ "${{ matrix.matlab }}" = "R2020b" || "${{ matrix.matlab }}" = "R2021a" || "${{ matrix.matlab }}" = "R2021b" ]] ; then
121+ # MATLAB R2021b- supports gfortran 9-
122+ MATLAB_VERSION_NUMBER=$(echo "${{ matrix.matlab }}" | sed -e 's/R\([0-9]*\)\([ab]\)/\1/')
123+ if [[ "${MATLAB_VERSION_NUMBER}" != "latest" && "${MATLAB_VERSION_NUMBER}" -le 2021 ]]; then
122124 GFVER=9
123125 fi
124126 echo "GFVER=$GFVER" >> $GITHUB_ENV
@@ -132,16 +134,17 @@ jobs:
132134 if : startsWith(matrix.os, 'ubuntu')
133135 run : which gcc && gcc --version && which gfortran && gfortran --version
134136
135- - name : Decide the version of oneAPI to use
137+ - name : Decide the version of oneAPI to use on macOS and Windows
136138 shell : bash
139+ if : ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows') }}
137140 run : |
138- # Initialize the variable ONEAPI_VERSION to an empty string, which means the default version
139- ONEAPI_VERSION=
140- if [[ "${{ matrix.os }}" = "windows-"* ]] ; then
141- # The latest oneAPI supported by MATLAB R2023a/b and R2024a/b is 2023 and 2024, respectively
142- if [[ "${{ matrix.matlab }}" = "R2023"* || "${{ matrix.matlab }}" = "R2024"* ]] ; then
143- ONEAPI_VERSION="$(echo "$ {{ matrix.matlab }}" | cut -c 2-5)"
144- fi
141+ # Initialize ONEAPI_VERSION to "latest", causing the installer script to install the latest oneAPI.
142+ ONEAPI_VERSION="latest"
143+ # On Windows. the latest oneAPI supported by MATLAB R2023a/b and R2024a/b is 2023 and 2024,
144+ # respectively. Thus we set ONEAPI_VERSION to the following. If matrix.matlab is "latest",
145+ # then ONEAPI_VERSION will be "latest".
146+ if [[ "$ {{ matrix.os }}" == windows* ]]; then
147+ ONEAPI_VERSION=$(echo "${{ matrix.matlab }}" | sed -e 's/R\([0-9]*\)\([ab]\)/\1/')
145148 fi
146149 echo "ONEAPI_VERSION=$ONEAPI_VERSION" >> $GITHUB_ENV
147150 echo "ONEAPI_VERSION:" $ONEAPI_VERSION
0 commit comments