Test MEX #271
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
name: Test MEX | |
on: | |
# Trigger the workflow on push or pull request | |
push: | |
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. | |
schedule: | |
- cron: '0 20 * * 6' | |
# Trigger the workflow when it is manually triggered | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test MEX | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019, windows-latest, macos-12, macos-13] # macos-14 is only for Apple Silicon chip, which needs nagfor | |
matlab: [R2020b, R2021a, R2021b, R2022a, R2022b, R2023a, R2023b, R2024a, latest] | |
oneapi: [2022, 2023, 2024] # oneAPI is not supported yet as of Dec 2023. | |
lang: [Fortran, C] | |
exclude: | |
# Only MATLAB R2021a, R2021b, and R2022a are available on Windows-2019 | |
- os: windows-2019 | |
matlab: R2020b | |
- os: windows-2019 | |
matlab: R2022b | |
- os: windows-2019 | |
matlab: R2023a | |
- os: windows-2019 | |
matlab: R2023b | |
- os: windows-2019 | |
matlab: R2024a | |
- os: windows-2019 | |
matlab: latest | |
# Intel oneAPI does not support macOS anymore starting from 2024. | |
- os: macos-latest | |
oneapi: 2024 | |
- os: macos-13 | |
oneapi: 2024 | |
# Intel oneAPI 2022 does not support Windows anymore starting from Mar. 2024 | |
- os: windows-2019 | |
oneapi: 2022 | |
- os: windows-latest | |
oneapi: 2022 | |
# Below R2022a, MEX does not work on windows-latest due to the version of MS Visual Studio; | |
# R2022a/b should work according to the documentation of MathWorks and GitHub Actions, but | |
# they do not as of March 2022. | |
- os: windows-latest | |
matlab: R2020b | |
- os: windows-latest | |
matlab: R2021a | |
- os: windows-latest | |
matlab: R2021b | |
- os: windows-latest | |
matlab: R2022a | |
- os: windows-latest | |
matlab: R2022b | |
# OneAPI 2024 is not supported before MATLAB R2024a | |
- matlab: R2021a | |
oneapi: 2024 | |
- matlab: R2021b | |
oneapi: 2024 | |
- matlab: R2022a | |
oneapi: 2024 | |
- matlab: R2023a | |
oneapi: 2024 | |
- matlab: R2023b | |
oneapi: 2024 | |
steps: | |
- name: Check out repository | |
uses: actions/[email protected] | |
- name: Install Intel oneAPI on macOS for Fortran | |
if: startsWith(matrix.os, 'macos') && matrix.lang == 'Fortran' | |
run: sudo bash install_oneapi_macos.sh ${{ matrix.oneapi }} | |
- name: Install Intel oneAPI on Windows for Fortran | |
if: startsWith(matrix.os, 'windows') && matrix.lang == 'Fortran' | |
run: cmd.exe "/K" '"install_oneapi_windows.bat" ${{ matrix.oneapi }}' | |
- name: Set up MATLAB | |
uses: matlab-actions/[email protected] | |
with: | |
release: ${{ matrix.matlab }} | |
cache: true | |
- name: Run the test | |
uses: matlab-actions/[email protected] | |
with: | |
command: | | |
lang = '${{ matrix.lang }}'; | |
fprintf("\n\nTry setting mex up, attempt 1:\n\n"); | |
try_mex_setup(lang, true); | |
fprintf("\n\nTry setting mex up, attempt 2:\n\n"); | |
mex -v -setup ${{ matrix.lang }} | |
fprintf("\n\nTry setting mex up, attempt 3:\n\n"); | |
try_mex_setup(lang, true); | |
fprintf("\n\nTry compiling the official example from MathWorks:\n\n"); | |
if strcmpi(lang, 'Fortran') | |
mex('-v', fullfile(matlabroot,'extern','examples','refbook','timestwo.F')); | |
else | |
mex('-v', fullfile(matlabroot,'extern','examples','refbook','timestwo.c')); | |
end | |
timestwo(1) |