Skip to content

Commit bbc87e0

Browse files
ssun30ischoegl
authored andcommitted
[CI] Added multi-OS MATLAB test workflows
Co-authored-by: ischoegl <ischoegl@lsu.edu> Combines: - [CI] Added multi-OS MATLAB test workflows - [CI] Consolidated multi-OS MATLAB tests into one - Update to use artifacts for testing
1 parent 8451f8e commit bbc87e0

File tree

1 file changed

+151
-69
lines changed

1 file changed

+151
-69
lines changed

.github/workflows/main.yml

Lines changed: 151 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -26,59 +26,6 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
jobs:
29-
matlab-test-ubuntu:
30-
name: MATLAB on ubuntu-latest with Python 3.10
31-
runs-on: ubuntu-latest
32-
env:
33-
CANTERA_ROOT: ${{ github.workspace }}
34-
CANTERA_DATA: ${{ github.workspace }}/data
35-
steps:
36-
- uses: actions/checkout@v5
37-
name: Checkout the repository
38-
with:
39-
submodules: recursive
40-
persist-credentials: false
41-
- name: Setup Python
42-
uses: actions/setup-python@v6
43-
with:
44-
python-version: '3.10'
45-
architecture: x64
46-
- name: Install Apt dependencies
47-
run: |
48-
sudo apt update
49-
sudo apt install libboost-dev gfortran libopenmpi-dev libopenblas-openmp-dev \
50-
libhdf5-dev doxygen
51-
gcc --version
52-
- name: Install Python dependencies
53-
run: |
54-
python3 -m pip install --upgrade pip setuptools wheel build
55-
python3 -m pip install scons ruamel.yaml Jinja2 typing-extensions
56-
- name: Build Cantera with generated CLib
57-
run: |
58-
python3 `which scons` build -j4 debug=n --debug=time \
59-
python_package=n env_vars=all
60-
- name: Set LD_PRELOAD environment variable for MATLAB
61-
run: |
62-
LIB_STDCXX=$(ldconfig -p | grep libstdc++.so.6 | awk '{print $4}' | head -n 1)
63-
echo "LD_PRELOAD=$LIB_STDCXX" >> $GITHUB_ENV
64-
- name: Set up MATLAB
65-
uses: matlab-actions/setup-matlab@39293085af7de88b5775bbeee38e6946b6709873 # v2.6.0
66-
- name: Build MATLAB C++ Interface
67-
uses: matlab-actions/run-command@7102c36f8d9b02c376168901511f20260327693e # v2.3.0
68-
with:
69-
command: |
70-
ctDir = getenv('CANTERA_ROOT');
71-
ctToolboxDir = fullfile(ctDir, 'interfaces', 'matlab_experimental');
72-
ctIncludeDir = fullfile(ctDir, 'interfaces', 'clib', 'include');
73-
ctLibDir = fullfile(ctDir, 'build', 'lib');
74-
addpath(genpath(ctToolboxDir));
75-
ctBuildInterface(ctToolboxDir, ctIncludeDir, ctLibDir);
76-
- name: Run tests
77-
uses: matlab-actions/run-tests@720bb7ae1d98878f668e76490134b57b36d81e12 # v2.2.0
78-
with:
79-
select-by-folder: ${{ github.workspace }}/test/matlab_experimental
80-
81-
8229
ubuntu-multiple-pythons:
8330
name: >
8431
${{ matrix.os }} with Python ${{ matrix.python-version }},
@@ -173,8 +120,6 @@ jobs:
173120
- name: Run install command
174121
run: python3 `which scons` install prefix=tmp_install
175122
- name: Upload shared library
176-
# Pin to 4.3.4 to resolve errors around only uploading symlinks.
177-
# See https://github.com/actions/upload-artifact/issues/589
178123
uses: actions/upload-artifact@v5
179124
if: matrix.python-version == '3.11'
180125
with:
@@ -942,13 +887,11 @@ jobs:
942887
run: scons test-clib --debug=time
943888
if: matrix.python-version == '3.11'
944889
- name: Upload shared library
945-
# Pin to 4.3.4 to resolve errors around only uploading symlinks.
946-
# See https://github.com/actions/upload-artifact/issues/589
947890
uses: actions/upload-artifact@v5
948891
if: matrix.python-version == '3.11'
949892
with:
950893
path: build/lib/cantera_shared.dll
951-
name: cantera_shared.dll
894+
name: cantera_shared-windows_2022.dll
952895
retention-days: 2
953896

954897
windows:
@@ -977,7 +920,7 @@ jobs:
977920
- name: Install Python dependencies
978921
run: |
979922
python -m pip install -U pip setuptools wheel
980-
python -m pip install 'scons<4.4.0' pypiwin32 numpy ruamel.yaml cython!=3.1.2 pandas graphviz pytest pytest-xdist pytest-github-actions-annotate-failures typing_extensions
923+
python -m pip install 'scons<4.4.0' pypiwin32 numpy ruamel.yaml cython!=3.1.2 pandas graphviz pytest pytest-xdist pytest-github-actions-annotate-failures typing_extensions Jinja2
981924
- name: Restore Boost cache
982925
uses: actions/cache@v4
983926
id: cache-boost
@@ -994,16 +937,29 @@ jobs:
994937
mv $BOOST_ROOT/boost-1.87.0/boost $BOOST_ROOT/boost
995938
rm $BOOST_ROOT/download.7z
996939
shell: bash
940+
- name: Install Doxygen
941+
run: |
942+
choco install doxygen.install -y --no-progress
943+
refreshenv
944+
doxygen --version
945+
shell: pwsh
997946
- name: Build Cantera
998947
run: scons build -j4 boost_inc_dir=$Env:BOOST_ROOT debug=n logging=debug
999-
python_package=y env_vars=USERPROFILE,GITHUB_ACTIONS clib_legacy=y
948+
python_package=y env_vars=USERPROFILE,GITHUB_ACTIONS
1000949
f90_interface=n toolchain=msvc --debug=time
1001950
- name: Build Tests
1002951
run: scons -j4 build-tests --debug=time
1003952
- name: Run compiled tests
1004953
run: scons test-gtest test-legacy --debug=time
1005954
- name: Run Python tests
1006955
run: python -m pytest -raP -v -n auto --durations=50 test/python
956+
- name: Upload shared library
957+
uses: actions/upload-artifact@v5
958+
if: matrix.python-version == '3.11'
959+
with:
960+
path: build/lib/cantera_shared.dll
961+
name: cantera_shared-windows_2025.dll
962+
retention-days: 2
1007963

1008964
# Adapted from https://www.scivision.dev/intel-oneapi-github-actions/
1009965
linux-intel-oneapi:
@@ -1081,7 +1037,7 @@ jobs:
10811037
- name: Install Python dependencies
10821038
run: |
10831039
python -m pip install -U pip setuptools wheel
1084-
python -m pip install scons pypiwin32 numpy ruamel.yaml cython!=3.1.2 h5py pandas pytest pytest-xdist pytest-github-actions-annotate-failures pint graphviz
1040+
python -m pip install scons pypiwin32 numpy ruamel.yaml cython!=3.1.2 h5py pandas pytest pytest-xdist pytest-github-actions-annotate-failures pint graphviz Jinja2 typing-extensions
10851041
- name: Restore Boost cache
10861042
uses: actions/cache@v4
10871043
id: cache-boost
@@ -1104,10 +1060,16 @@ jobs:
11041060
mv $BOOST_ROOT/boost-1.87.0/boost $BOOST_ROOT/boost
11051061
rm $BOOST_ROOT/download.7z
11061062
shell: bash
1063+
- name: Install Doxygen
1064+
run: |
1065+
choco install doxygen.install -y --no-progress
1066+
refreshenv
1067+
doxygen --version
1068+
shell: pwsh
11071069
- name: Build Cantera
11081070
run: scons build -j4 boost_inc_dir=$Env:BOOST_ROOT debug=n logging=debug
11091071
python_package=y env_vars=USERPROFILE,PYTHONPATH,GITHUB_ACTIONS
1110-
toolchain=mingw f90_interface=n --debug=time clib_legacy=y
1072+
toolchain=mingw f90_interface=n --debug=time
11111073
- name: Upload Wheel
11121074
uses: actions/upload-artifact@v5
11131075
with:
@@ -1134,10 +1096,10 @@ jobs:
11341096
name: .NET on ${{ matrix.os }}
11351097
strategy:
11361098
matrix:
1137-
os: [ubuntu-22.04, windows-2022, macos-14]
1099+
os: [ubuntu-22.04, windows-2022, windows-2025, macos-14]
11381100
fail-fast: false
11391101
runs-on: ${{ matrix.os }}
1140-
needs: [ubuntu-multiple-pythons, macos-multiple-pythons, windows-2022]
1102+
needs: [ubuntu-multiple-pythons, macos-multiple-pythons, windows-2022, windows]
11411103
timeout-minutes: 60
11421104
steps:
11431105
- uses: actions/checkout@v5
@@ -1149,12 +1111,12 @@ jobs:
11491111
with:
11501112
python-version: "3.10"
11511113
architecture: x64
1152-
if: matrix.os == 'windows-2022'
1114+
if: runner.os == 'Windows'
11531115
- name: Set Python version (macOS)
11541116
uses: actions/setup-python@v6
11551117
with:
11561118
python-version: "3.12"
1157-
if: matrix.os == 'macos-14'
1119+
if: runner.os == 'macOS'
11581120
# Ubuntu uses default system Python 3
11591121
- name: Install library dependencies with micromamba (Windows)
11601122
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
@@ -1171,13 +1133,13 @@ jobs:
11711133
run: |
11721134
echo "Running on `sysctl -n machdep.cpu.brand_string`"
11731135
brew install --display-times hdf5
1174-
if: matrix.os == 'macos-14'
1136+
if: runner.os == 'macOS'
11751137
- name: Install Apt dependencies (Ubuntu)
11761138
run: |
11771139
echo "Running on `cat /proc/cpuinfo | grep 'model name' | head -n 1 | cut -d ':' -f 2`"
11781140
sudo apt update
11791141
sudo apt install libhdf5-dev libfmt-dev libopenblas0-openmp
1180-
if: matrix.os == 'ubuntu-22.04'
1142+
if: runner.os == 'Linux'
11811143
- name: Install Python dependencies
11821144
# Install Python dependencies, which are used by 'dotnet build'
11831145
run: |
@@ -1192,16 +1154,25 @@ jobs:
11921154
with:
11931155
name: libcantera_shared-ubuntu-22.04.so
11941156
path: build/lib
1157+
if: runner.os == 'Linux'
11951158
- name: Download the Cantera shared library (.dylib)
11961159
uses: actions/download-artifact@v6
11971160
with:
11981161
name: libcantera_shared.dylib
11991162
path: build/lib
1163+
if: runner.os == 'macOS'
12001164
- name: Download the Cantera shared library (.dll)
12011165
uses: actions/download-artifact@v6
12021166
with:
1203-
name: cantera_shared.dll
1167+
name: cantera_shared-windows_2022.dll
12041168
path: build/lib
1169+
if: matrix.os == 'windows-2022'
1170+
- name: Download the Cantera shared library (.dll)
1171+
uses: actions/download-artifact@v5
1172+
with:
1173+
name: cantera_shared-windows_2025.dll
1174+
path: build/lib
1175+
if: matrix.os == 'windows-2025'
12051176
- name: Download the Doxygen artifacts
12061177
uses: actions/download-artifact@v6
12071178
with:
@@ -1236,3 +1207,114 @@ jobs:
12361207
run: python -m pip install -e interfaces/sourcegen
12371208
- name: Test YAML output generation
12381209
run: sourcegen --api=yaml --output=build/yaml -v
1210+
1211+
matlab:
1212+
name: MATLAB on ${{ matrix.os }}
1213+
strategy:
1214+
matrix:
1215+
os: [ubuntu-22.04, ubuntu-24.04, windows-2025, macos-14]
1216+
fail-fast: false
1217+
env:
1218+
CANTERA_ROOT: ${{ github.workspace }}
1219+
CANTERA_DATA: ${{ github.workspace }}/data
1220+
runs-on: ${{ matrix.os }}
1221+
needs: [ubuntu-multiple-pythons, macos-multiple-pythons, windows]
1222+
timeout-minutes: 60
1223+
steps:
1224+
- uses: actions/checkout@v5
1225+
name: Checkout the repository
1226+
with:
1227+
persist-credentials: false
1228+
- name: Set Python version (Windows)
1229+
uses: actions/setup-python@v6
1230+
with:
1231+
python-version: "3.10"
1232+
architecture: x64
1233+
if: runner.os == 'Windows'
1234+
- name: Set Python version (macOS)
1235+
uses: actions/setup-python@v6
1236+
with:
1237+
python-version: "3.12"
1238+
if: runner.os == 'macOS'
1239+
# Ubuntu uses default system Python 3
1240+
- name: Install Brew dependencies (macOS)
1241+
run: |
1242+
echo "Running on `sysctl -n machdep.cpu.brand_string`"
1243+
brew install --display-times libomp hdf5
1244+
if: runner.os == 'macOS'
1245+
- name: Install Apt dependencies (Ubuntu)
1246+
run: |
1247+
echo "Running on `cat /proc/cpuinfo | grep 'model name' | head -n 1 | cut -d ':' -f 2`"
1248+
sudo apt update
1249+
sudo apt install libhdf5-dev libfmt-dev libopenblas0-openmp
1250+
if: runner.os == 'Linux'
1251+
- name: Install Python dependencies
1252+
# Install Python dependencies, which are used by 'dotnet build'
1253+
run: |
1254+
python3 -m pip install --upgrade pip setuptools wheel build
1255+
python3 -m pip install ruamel.yaml Jinja2 typing-extensions
1256+
- name: Download the Cantera shared library (Linux)
1257+
uses: actions/download-artifact@v5
1258+
with:
1259+
name: libcantera_shared-${{ matrix.os }}.so
1260+
path: build/lib
1261+
if: runner.os == 'Linux'
1262+
- name: Create library symlinks (Linux)
1263+
working-directory: build/lib
1264+
run: |
1265+
ln -s libcantera_shared.so libcantera_shared.so.3.2.0
1266+
ln -s libcantera_shared.so.3.2.0 libcantera_shared.so.3
1267+
if: runner.os == 'Linux'
1268+
- name: Download the Cantera shared library (macOS)
1269+
uses: actions/download-artifact@v5
1270+
with:
1271+
name: libcantera_shared.dylib
1272+
path: build/lib
1273+
if: runner.os == 'macOS'
1274+
- name: Create library symlinks (macOS)
1275+
working-directory: build/lib
1276+
run: |
1277+
ln -s libcantera_shared.dylib libcantera_shared.3.2.0.dylib
1278+
ln -s libcantera_shared.3.2.0.dylib libcantera_shared.3.dylib
1279+
if: runner.os == 'macOS'
1280+
- name: Download the Cantera shared library (Windows)
1281+
uses: actions/download-artifact@v5
1282+
with:
1283+
name: cantera_shared-windows_2025.dll
1284+
path: build/lib
1285+
if: runner.os == 'Windows'
1286+
- name: Download the Doxygen artifacts
1287+
uses: actions/download-artifact@v5
1288+
with:
1289+
name: doxygen-tree
1290+
path: build/doc
1291+
- name: Extract Doxygen artifacts
1292+
run: tar -xzf doxygen.tar.gz
1293+
working-directory: build/doc
1294+
- name: Install sourcegen
1295+
run: python -m pip install -e interfaces/sourcegen
1296+
- name: Generage CLib headers
1297+
run: sourcegen --api=clib --output=interfaces/clib
1298+
- name: Set LD_PRELOAD environment variable for MATLAB (Linux)
1299+
run: |
1300+
LIB_STDCXX=$(ldconfig -p | grep libstdc++.so.6 | awk '{print $4}' | head -n 1)
1301+
LIB_OPENBLAS=$(ldconfig -p | grep libopenblas.so.0 | awk '{print $4}' | head -n 1)
1302+
LIB_LAPACK=$(ldconfig -p | grep liblapack.so.3 | awk '{print $4}' | head -n 1)
1303+
echo "LD_PRELOAD=$LIB_STDCXX:$LIB_OPENBLAS:$LIB_LAPACK" >> $GITHUB_ENV
1304+
if: runner.os == 'Linux'
1305+
- name: Set up MATLAB
1306+
uses: matlab-actions/setup-matlab@39293085af7de88b5775bbeee38e6946b6709873 # v2.6.0
1307+
- name: Build MATLAB C++ Interface
1308+
uses: matlab-actions/run-command@7102c36f8d9b02c376168901511f20260327693e # v2.3.0
1309+
with:
1310+
command: |
1311+
ctDir = getenv('CANTERA_ROOT');
1312+
ctToolboxDir = fullfile(ctDir, 'interfaces', 'matlab_experimental');
1313+
ctIncludeDir = fullfile(ctDir, 'interfaces', 'clib', 'include');
1314+
ctLibDir = fullfile(ctDir, 'build', 'lib');
1315+
addpath(genpath(ctToolboxDir));
1316+
ctBuildInterface(ctToolboxDir, ctIncludeDir, ctLibDir);
1317+
- name: Run tests
1318+
uses: matlab-actions/run-tests@a80b208946040c701ae65c1bce73ba7ec4810757 # v2.1.2
1319+
with:
1320+
select-by-folder: test/matlab_experimental

0 commit comments

Comments
 (0)