Test MEX, windows-latest #1
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, windows-latest | |
on: | |
# Trigger the workflow on push or pull request | |
#push: | |
# 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-latest] | |
matlab: [R2022a, R2022b] | |
oneapi: [2021] #, 2022, 2023] | |
lang: [Fortran] #, C] | |
steps: | |
- name: Check out repository | |
uses: actions/[email protected] | |
- 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 }} | |
- name: Run the test | |
uses: matlab-actions/[email protected] | |
with: | |
command: | | |
lang = '${{ matrix.lang }}'; | |
if strcmpi(lang, 'Fortran') | |
oneapi_root = 'C:\Program Files (x86)\Intel\oneAPI\'; | |
ifort_compiler18 = [oneapi_root, 'compiler\latest\windows\']; | |
ifort_path = fullfile(ifort_compiler18, 'bin', 'intel64'); | |
setenv('PATH', [getenv('PATH'), ';', ifort_path]); % Seems not needed. | |
setenv('ONEAPI_ROOT', oneapi_root); | |
setenv('IFORT_COMPILER18', ifort_compiler18); | |
end | |
mex('-setup', '-v', lang); | |
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) |