Skip to content

Commit 9b5940d

Browse files
committed
Install: Ensure that pyenv is set for actions MATLAB
1 parent c6989fa commit 9b5940d

2 files changed

Lines changed: 85 additions & 25 deletions

File tree

.github/workflows/unix_unit_tests_mhkit_install.yml

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,30 @@ jobs:
4343
mhkit.install();
4444
startup-options: -noFigureWindows
4545

46+
- name: Configure MATLAB Python Environment for Health Check
47+
shell: bash -l {0}
48+
run: |
49+
# Get Python executable from mhkit-matlab-env
50+
PYTHON_PATH=$(conda run -n mhkit-matlab-env python -c "import sys; print(sys.executable)")
51+
echo "Python path: $PYTHON_PATH"
52+
53+
# Create health check script with Python configuration
54+
cat > health_check.m << EOF
55+
addpath(genpath('mhkit'));
56+
pyenv(Version='$PYTHON_PATH', ExecutionMode='OutOfProcess');
57+
success = mhkit.check_health();
58+
if ~success
59+
error('MHKiT health check failed - installation has issues');
60+
end
61+
EOF
62+
63+
echo "Health check script content:"
64+
cat health_check.m
65+
4666
- name: Validate Installation Health
4767
uses: matlab-actions/run-command@v2
4868
with:
49-
command: |
50-
addpath(genpath('mhkit'));
51-
success = mhkit.check_health();
52-
if ~success
53-
error('MHKiT health check failed - installation has issues');
54-
end
69+
command: health_check
5570
startup-options: -noFigureWindows
5671

5772
- name: Add MATLAB test commands
@@ -153,15 +168,30 @@ jobs:
153168
mhkit.install();
154169
startup-options: -noFigureWindows
155170

171+
- name: Configure MATLAB Python Environment for Health Check
172+
shell: bash -l {0}
173+
run: |
174+
# Get Python executable from mhkit-matlab-env
175+
PYTHON_PATH=$(conda run -n mhkit-matlab-env python -c "import sys; print(sys.executable)")
176+
echo "Python path: $PYTHON_PATH"
177+
178+
# Create health check script with Python configuration
179+
cat > health_check.m << EOF
180+
addpath(genpath('mhkit'));
181+
pyenv(Version='$PYTHON_PATH', ExecutionMode='OutOfProcess');
182+
success = mhkit.check_health();
183+
if ~success
184+
error('MHKiT health check failed - installation has issues');
185+
end
186+
EOF
187+
188+
echo "Health check script content:"
189+
cat health_check.m
190+
156191
- name: Validate Installation Health
157192
uses: matlab-actions/run-command@v2
158193
with:
159-
command: |
160-
addpath(genpath('mhkit'));
161-
success = mhkit.check_health();
162-
if ~success
163-
error('MHKiT health check failed - installation has issues');
164-
end
194+
command: health_check
165195
startup-options: -noFigureWindows
166196

167197
- name: Add MATLAB test commands
@@ -184,4 +214,4 @@ jobs:
184214
uses: matlab-actions/run-command@v2
185215
with:
186216
command: run
187-
startup-options: -noFigureWindows
217+
startup-options: -noFigureWindows

.github/workflows/windows_unit_tests_mhkit_install.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,30 @@ jobs:
4141
mhkit.install();
4242
startup-options: -noFigureWindows
4343

44+
- name: Configure MATLAB Python Environment for Health Check
45+
shell: bash -l {0}
46+
run: |
47+
# Get Python executable from mhkit-matlab-env
48+
PYTHON_PATH=$(conda run -n mhkit-matlab-env python -c "import sys; print(sys.executable)")
49+
echo "Python path: $PYTHON_PATH"
50+
51+
# Create health check script with Python configuration
52+
cat > health_check.m << EOF
53+
addpath(genpath('mhkit'));
54+
pyenv(Version='$PYTHON_PATH', ExecutionMode='OutOfProcess');
55+
success = mhkit.check_health();
56+
if ~success
57+
error('MHKiT health check failed - installation has issues');
58+
end
59+
EOF
60+
61+
echo "Health check script content:"
62+
cat health_check.m
63+
4464
- name: Validate Installation Health
4565
uses: matlab-actions/run-command@v2
4666
with:
47-
command: |
48-
addpath(genpath('mhkit'));
49-
success = mhkit.check_health();
50-
if ~success
51-
error('MHKiT health check failed - installation has issues');
52-
end
67+
command: health_check
5368
startup-options: -noFigureWindows
5469

5570
- name: Add MATLAB test commands
@@ -140,15 +155,30 @@ jobs:
140155
mhkit.install();
141156
startup-options: -noFigureWindows
142157

158+
- name: Configure MATLAB Python Environment for Health Check
159+
shell: bash -l {0}
160+
run: |
161+
# Get Python executable from mhkit-matlab-env
162+
PYTHON_PATH=$(conda run -n mhkit-matlab-env python -c "import sys; print(sys.executable)")
163+
echo "Python path: $PYTHON_PATH"
164+
165+
# Create health check script with Python configuration
166+
cat > health_check.m << EOF
167+
addpath(genpath('mhkit'));
168+
pyenv(Version='$PYTHON_PATH', ExecutionMode='OutOfProcess');
169+
success = mhkit.check_health();
170+
if ~success
171+
error('MHKiT health check failed - installation has issues');
172+
end
173+
EOF
174+
175+
echo "Health check script content:"
176+
cat health_check.m
177+
143178
- name: Validate Installation Health
144179
uses: matlab-actions/run-command@v2
145180
with:
146-
command: |
147-
addpath(genpath('mhkit'));
148-
success = mhkit.check_health();
149-
if ~success
150-
error('MHKiT health check failed - installation has issues');
151-
end
181+
command: health_check
152182
startup-options: -noFigureWindows
153183

154184
- name: Add MATLAB test commands

0 commit comments

Comments
 (0)