1+ name : MHKiT-MATLAB Unix Unit Tests (mhkit.install)
2+
3+ on :
4+ push :
5+ branches : [ master, develop, feat_add_mhkit_python_install_script ]
6+ pull_request :
7+ branches : [ master, develop, feat_add_mhkit_python_install_script ]
8+
9+ jobs :
10+ cache_population :
11+ strategy :
12+ fail-fast : false
13+
14+ matrix :
15+ os : [ubuntu-latest]
16+ matlab-version : [R2022b]
17+
18+ runs-on : ${{ matrix.os }}
19+
20+ steps :
21+ - name : Check out MHKiT-MATLAB
22+ uses : actions/checkout@v4
23+
24+ - name : Set up MATLAB
25+ uses : matlab-actions/setup-matlab@v2
26+ with :
27+ release : ${{ matrix.matlab-version }}
28+
29+ # Create the cache and add a dummy file
30+ # The dummy file ensures that the artifact download
31+ - name : Setup mhkit_webread_cache
32+ shell : bash
33+ run : |
34+ mkdir mhkit_webread_cache
35+ touch mhkit_webread_cache/test.txt
36+ echo "Hello World" > mhkit_webread_cache/test.txt
37+
38+ - name : Run mhkit.install()
39+ uses : matlab-actions/run-command@v2
40+ with :
41+ command : |
42+ addpath(genpath('mhkit'));
43+ mhkit.install();
44+ startup-options : -noFigureWindows
45+
46+ - name : Add MATLAB test commands
47+ shell : bash
48+ run : echo "version,
49+ addpath(genpath('mhkit')),
50+ import matlab.unittest.TestSuite,
51+ import matlab.unittest.TestRunner,
52+ testFolder = ['mhkit' filesep 'tests'],
53+ suite = TestSuite.fromFolder(testFolder),
54+ runner = TestRunner.withTextOutput,
55+ results = runner.run(suite),
56+ assertSuccess(results)" >> run.m
57+
58+ - name : Output run.m
59+ shell : bash
60+ run : cat run.m
61+
62+ - name : Run MATLAB Unit Tests
63+ uses : matlab-actions/run-command@v2
64+ with :
65+ command : run
66+ startup-options : -noFigureWindows
67+
68+ - name : Save mhkit_webread_cache directory as an artifact
69+ uses : actions/upload-artifact@v4
70+ with :
71+ # GitHub Action "Name" of artifact
72+ name : mhkit_webread_cache
73+ # Filesystem path of directory
74+ path : mhkit_webread_cache
75+
76+ main :
77+ needs : cache_population
78+ strategy :
79+ fail-fast : false
80+
81+ matrix :
82+ os : [macos-13, ubuntu-latest]
83+ python-version : ["3.10", 3.11, 3.12]
84+ # Note: It is preferred to use an actual release name as opposed to 'latest'
85+ matlab-version : [R2022b, R2023a, R2023b, R2024a, R2024b]
86+ mhkit-python-version : ["0.9.0"]
87+ exclude :
88+ - python-version : " 3.10" # cache_population job
89+ matlab-version : R2022b
90+ os : ubuntu-latest
91+ # Python 3.12 + MATLAB incompatability
92+ - matlab-version : R2024a
93+ python-version : 3.12
94+ - matlab-version : R2023b
95+ python-version : 3.12
96+ - matlab-version : R2023a
97+ python-version : 3.12
98+ - matlab-version : R2022b
99+ python-version : 3.12
100+ # Python 3.11 + MATLAB incompatability
101+ - matlab-version : R2023a
102+ python-version : 3.11
103+ - matlab-version : R2022b
104+ python-version : 3.11
105+ # Specific MATLAB/Python/OS Errors
106+ # Error using _cythonized_array_utils>init
107+ # scipy.linalg._cythonized_array_utils (line 1)
108+ # Python Error: ValueError: numpy.dtype size changed, may indicate binary
109+ # incompatibility. Expected 96 from C header, got 88 from PyObject
110+ - matlab-version : R2024b
111+ python-version : 3.12
112+ os : macos-13
113+
114+ runs-on : ${{ matrix.os }}
115+
116+ env :
117+ MHKIT_PYTHON_VERSION : ${{ matrix.mhkit-python-version }}
118+ steps :
119+ - name : Check out MHKiT-MATLAB
120+ uses : actions/checkout@v4
121+
122+ - name : Download mhkit_webread_cache artifact
123+ uses : actions/download-artifact@v4
124+ with :
125+ name : mhkit_webread_cache
126+ path : mhkit_webread_cache
127+
128+ - name : Display structure mhkit_webread_cache
129+ run : ls -R
130+ working-directory : .
131+
132+ - name : Set up MATLAB
133+ uses : matlab-actions/setup-matlab@v2
134+ with :
135+ release : ${{ matrix.matlab-version }}
136+
137+ - name : Run mhkit.install()
138+ uses : matlab-actions/run-command@v2
139+ with :
140+ command : |
141+ addpath(genpath('mhkit'));
142+ mhkit.install();
143+ startup-options : -noFigureWindows
144+
145+ - name : Add MATLAB test commands
146+ shell : bash
147+ run : echo "version,
148+ addpath(genpath('mhkit')),
149+ import matlab.unittest.TestSuite,
150+ import matlab.unittest.TestRunner,
151+ testFolder = ['mhkit' filesep 'tests'],
152+ suite = TestSuite.fromFolder(testFolder),
153+ runner = TestRunner.withTextOutput,
154+ results = runner.run(suite),
155+ assertSuccess(results)" >> run.m
156+
157+ - name : Output run.m
158+ shell : bash
159+ run : cat run.m
160+
161+ - name : Run MATLAB Unit Tests
162+ uses : matlab-actions/run-command@v2
163+ with :
164+ command : run
165+ startup-options : -noFigureWindows
0 commit comments