-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Run tInstall in R2020b on Ubuntu against Python 3.8 | ||
|
||
name: Test R2020b | ||
|
||
on: | ||
push: | ||
branches: | ||
- R2020b | ||
|
||
pull_request: | ||
branches: | ||
- R2020b | ||
|
||
# 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: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Set up MATLAB | ||
uses: matlab-actions/setup-matlab@v1 | ||
with: | ||
release: R2020b | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Run tests | ||
uses: matlab-actions/run-tests@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 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 |