Skip to content

Add test for R2023a #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/qualify_23a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Run tInstall on Ubuntu against python versions 3.10, 3.9 and 3.8

name: Test R2023a

on:
push:
branches:
- R2023a

pull_request:
branches:
- R2023a

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:



# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test-python-engine:
strategy:
matrix:
python: ["3.10", "3.9", "3.8"]

runs-on: ubuntu-latest

steps:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}

- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: R2023a

- uses: actions/checkout@v3

- name: Run tests
uses: matlab-actions/run-tests@v1
39 changes: 39 additions & 0 deletions test/tInstall.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
classdef tInstall < matlab.unittest.TestCase
% Verify installation of matlab engine

% Copyright 2023 Mathworks, Inc.

properties (Constant)
MATLABVersion = string(ver('MATLAB').Version) % Example: 9.14
end

methods (Test)
function installNoVersionSpecified(testCase)
[status, out] = system("pip install matlabengine");
addTeardown(testCase, @system, "pip uninstall -y matlabengine");
verifyEqual(testCase, status, 0, out)
verifyInstallation(testCase)
end

function installMatchingEngine(testCase)
[status, out] = system("pip install matlabengine==" + testCase.MATLABVersion + ".*");
addTeardown(testCase, @system, "pip uninstall -y matlabengine");
verifyEqual(testCase, status, 0, out)
verifyInstallation(testCase)
end
end

methods
function verifyInstallation(testCase)
% Verify installation by calling functions in matlab engine
% Share this session and see if find_matlab can find it.
sharedEngineName = matlab.engine.engineName;
if isempty(sharedEngineName)
sharedEngineName = 'MATLAB_tInstall';
matlab.engine.shareEngine(sharedEngineName)
end
pySharedEngineName = char(py.matlab.engine.find_matlab());
verifySubstring(testCase, pySharedEngineName, sharedEngineName)
end
end
end