Skip to content

Commit 5aba34a

Browse files
committed
Install: Add actions to test mhkit.install()
1 parent e954b3f commit 5aba34a

2 files changed

Lines changed: 318 additions & 0 deletions

File tree

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
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
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: MHKiT-MATLAB Windows 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+
matrix:
14+
os: [windows-latest]
15+
matlab-version: [R2023b]
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- name: Check out MHKiT-MATLAB
20+
uses: actions/checkout@v4
21+
22+
# Create the cache and add a dummy file
23+
# The dummy file ensures that the artifact download
24+
- name: Setup mhkit_webread_cache
25+
shell: bash
26+
run: |
27+
mkdir mhkit_webread_cache
28+
touch mhkit_webread_cache/test.txt
29+
echo "Hello World" > mhkit_webread_cache/test.txt
30+
31+
- name: Set up MATLAB
32+
uses: matlab-actions/setup-matlab@v2
33+
with:
34+
release: ${{ matrix.matlab-version }}
35+
36+
- name: Run mhkit.install()
37+
uses: matlab-actions/run-command@v2
38+
with:
39+
command: |
40+
addpath(genpath('mhkit'));
41+
mhkit.install();
42+
startup-options: -noFigureWindows
43+
44+
- name: Add MATLAB test commands
45+
shell: bash
46+
run: echo "version,
47+
addpath(genpath('mhkit')),
48+
import matlab.unittest.TestSuite,
49+
import matlab.unittest.TestRunner,
50+
testFolder = ['mhkit' filesep 'tests'],
51+
suite = TestSuite.fromFolder(testFolder),
52+
runner = TestRunner.withTextOutput,
53+
results = runner.run(suite),
54+
assertSuccess(results)" >> run.m
55+
56+
- name: Output Run.m
57+
shell: bash
58+
run: cat run.m
59+
60+
- name: Run MHKiT-MATLAB Unit Tests
61+
uses: matlab-actions/run-command@v2
62+
with:
63+
command: run
64+
startup-options: -noFigureWindows
65+
66+
- name: Save mhkit_webread_cache directory as an artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
# GitHub Action "Name" of artifact
70+
name: mhkit_webread_cache
71+
# Filesystem path of directory
72+
path: mhkit_webread_cache
73+
74+
main:
75+
needs: cache_population
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
os: [windows-latest]
80+
python-version: ["3.10", 3.11, 3.12]
81+
matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b]
82+
mhkit-python-version: ["0.9.0"]
83+
exclude:
84+
# Cache population job
85+
- matlab-version: R2023b
86+
python-version: "3.10"
87+
# Python 3.12 + MATLAB incompatability
88+
- matlab-version: R2024a
89+
python-version: 3.12
90+
- matlab-version: R2023b
91+
python-version: 3.12
92+
- matlab-version: R2023a
93+
python-version: 3.12
94+
- matlab-version: R2022b
95+
python-version: 3.12
96+
# Python 3.11 + MATLAB incompatability
97+
- matlab-version: R2023a
98+
python-version: 3.11
99+
- matlab-version: R2022b
100+
python-version: 3.11
101+
runs-on: ${{ matrix.os }}
102+
103+
env:
104+
MHKIT_PYTHON_VERSION: ${{ matrix.mhkit-python-version }}
105+
steps:
106+
- name: Check out MHKiT-MATLAB
107+
uses: actions/checkout@v4
108+
109+
- name: Download mhkit_webread_cache artifact
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: mhkit_webread_cache
113+
path: mhkit_webread_cache
114+
115+
- name: Display structure mhkit_webread_cache
116+
run: ls -R
117+
working-directory: .
118+
119+
- name: Set up MATLAB
120+
uses: matlab-actions/setup-matlab@v2
121+
with:
122+
release: ${{ matrix.matlab-version }}
123+
124+
- name: Run mhkit.install()
125+
uses: matlab-actions/run-command@v2
126+
with:
127+
command: |
128+
addpath(genpath('mhkit'));
129+
mhkit.install();
130+
startup-options: -noFigureWindows
131+
132+
- name: Add MATLAB test commands
133+
shell: bash
134+
run: echo "version,
135+
pyenv,
136+
addpath(genpath('mhkit')),
137+
import matlab.unittest.TestSuite,
138+
import matlab.unittest.TestRunner,
139+
testFolder = ['mhkit' filesep 'tests'],
140+
suite = TestSuite.fromFolder(testFolder),
141+
runner = TestRunner.withTextOutput,
142+
results = runner.run(suite),
143+
assertSuccess(results)" >> run.m
144+
145+
- name: Output Run.m
146+
shell: bash
147+
run: cat run.m
148+
149+
- name: Run MHKiT-MATLAB Unit Tests
150+
uses: matlab-actions/run-command@v2
151+
with:
152+
command: run
153+
startup-options: -noFigureWindows

0 commit comments

Comments
 (0)