Skip to content

Feature: Add MHKiT-MATLAB Installation Command #2

Feature: Add MHKiT-MATLAB Installation Command

Feature: Add MHKiT-MATLAB Installation Command #2

name: MHKiT-MATLAB Unix Unit Tests (mhkit.install)
on:
push:
branches: [ master, develop, feat_add_mhkit_python_install_script ]
pull_request:
branches: [ master, develop, feat_add_mhkit_python_install_script ]
jobs:
cache_population:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
matlab-version: [R2022b]
runs-on: ${{ matrix.os }}
steps:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab-version }}
# Create the cache and add a dummy file
# The dummy file ensures that the artifact download
- name: Setup mhkit_webread_cache
shell: bash
run: |
mkdir mhkit_webread_cache
touch mhkit_webread_cache/test.txt
echo "Hello World" > mhkit_webread_cache/test.txt
- name: Run mhkit.install()
uses: matlab-actions/run-command@v2
with:
command: |
addpath(genpath('mhkit'));
mhkit.install();
startup-options: -noFigureWindows
- name: Add MATLAB test commands
shell: bash
run: echo "version,
addpath(genpath('mhkit')),
import matlab.unittest.TestSuite,
import matlab.unittest.TestRunner,
testFolder = ['mhkit' filesep 'tests'],
suite = TestSuite.fromFolder(testFolder),
runner = TestRunner.withTextOutput,
results = runner.run(suite),
assertSuccess(results)" >> run.m
- name: Output run.m
shell: bash
run: cat run.m
- name: Run MATLAB Unit Tests
uses: matlab-actions/run-command@v2
with:
command: run
startup-options: -noFigureWindows
- name: Save mhkit_webread_cache directory as an artifact
uses: actions/upload-artifact@v4
with:
# GitHub Action "Name" of artifact
name: mhkit_webread_cache
# Filesystem path of directory
path: mhkit_webread_cache
main:
needs: cache_population
strategy:
fail-fast: false
matrix:
os: [macos-13, ubuntu-latest]
python-version: ["3.10", 3.11, 3.12]
# Note: It is preferred to use an actual release name as opposed to 'latest'
matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b]
mhkit-python-version: ["0.9.0"]
exclude:
- python-version: "3.10" # cache_population job
matlab-version: R2022b
os: ubuntu-latest
# Python 3.12 + MATLAB incompatability
- matlab-version: R2024a
python-version: 3.12
- matlab-version: R2023b
python-version: 3.12
- matlab-version: R2023a
python-version: 3.12
- matlab-version: R2022b
python-version: 3.12
# Python 3.11 + MATLAB incompatability
- matlab-version: R2023a
python-version: 3.11
- matlab-version: R2022b
python-version: 3.11
# Specific MATLAB/Python/OS Errors
# Error using _cythonized_array_utils>init
# scipy.linalg._cythonized_array_utils (line 1)
# Python Error: ValueError: numpy.dtype size changed, may indicate binary
# incompatibility. Expected 96 from C header, got 88 from PyObject
- matlab-version: R2024b
python-version: 3.12
os: macos-13
runs-on: ${{ matrix.os }}
env:
MHKIT_PYTHON_VERSION: ${{ matrix.mhkit-python-version }}
steps:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4
- name: Download mhkit_webread_cache artifact
uses: actions/download-artifact@v4
with:
name: mhkit_webread_cache
path: mhkit_webread_cache
- name: Display structure mhkit_webread_cache
run: ls -R
working-directory: .
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab-version }}
- name: Run mhkit.install()
uses: matlab-actions/run-command@v2
with:
command: |
addpath(genpath('mhkit'));
mhkit.install();
startup-options: -noFigureWindows
- name: Add MATLAB test commands
shell: bash
run: echo "version,
addpath(genpath('mhkit')),
import matlab.unittest.TestSuite,
import matlab.unittest.TestRunner,
testFolder = ['mhkit' filesep 'tests'],
suite = TestSuite.fromFolder(testFolder),
runner = TestRunner.withTextOutput,
results = runner.run(suite),
assertSuccess(results)" >> run.m
- name: Output run.m
shell: bash
run: cat run.m
- name: Run MATLAB Unit Tests
uses: matlab-actions/run-command@v2
with:
command: run
startup-options: -noFigureWindows