Skip to content

Merge pull request #14 from equipez/dependabot/github_actions/actions… #141

Merge pull request #14 from equipez/dependabot/github_actions/actions…

Merge pull request #14 from equipez/dependabot/github_actions/actions… #141

Workflow file for this run

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-11, macos-latest]
matlab: [R2020b, R2021a, R2021b, R2022a, R2022b, R2023a, R2023b, latest]
oneapi: [2022, 2023]
lang: [Fortran, C]
exclude:
- os: windows-2019
matlab: R2020b
- os: windows-2019
matlab: R2022b
- os: windows-2019
matlab: R2023a
- os: windows-2019
matlab: latest
# 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
steps:
- name: Check out repository
uses: actions/checkout@v4.1.0
- 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: Cache MATLAB
id: cache-matlab
uses: actions/cache@v3.3.2
with:
path: ${{ runner.tool_cache }}/MATLAB
key: ${{ matrix.os }}-${{ matrix.matlab }}
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2-beta
with:
release: ${{ matrix.matlab }}
- name: Run the test
uses: matlab-actions/run-command@v1.2.1
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)