Skip to content

Commit

Permalink
Actions: Try different methods to force python to load correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
simmsa committed Jan 31, 2025
1 parent 3d3300c commit fa1b5f7
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/unix_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,29 @@ jobs:
release: ${{ matrix.matlab-version }}

# OutOfProcess is required to properly call netcdf/hdf5 and works reliably on macos and ubuntu
# - name: Configure MATLAB Python Environment
# shell: bash -l {0}
# run: |
# conda activate mhkit_conda_env
# printf 'pyenv(Version="%s", ExecutionMode="OutOfProcess")\n' $(python -c "import sys; print(sys.executable)") > run.m

- name: Configure MATLAB Python Environment
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
printf 'pyenv(Version="%s", ExecutionMode="OutOfProcess")\n' $(python -c "import sys; print(sys.executable)") > run.m
echo "clear classes;" >> run.m
echo "try; pe = pyenv; clear pe; end" >> run.m
printf 'pyenv("Version","%s", "ExecutionMode","OutOfProcess");\n' $(python -c "import sys; print(sys.executable)") >> run.m
echo "pe = pyenv; assert(pe.Status==\"Loaded\", 'Python environment not loaded');" >> run.m
echo "setenv('PYTHONPATH', '$(python -c "import sys; print(':'.join(sys.path))")');" >> run.m
- name: Add Debug Commands
shell: bash
run: |
echo "disp('Python Environment:');" >> run.m
echo "pe = pyenv; disp(pe);" >> run.m
echo "disp('Python Path:');" >> run.m
echo "disp(getenv('PYTHONPATH'));" >> run.m
- name: Add MATLAB test commands
shell: bash
Expand Down

0 comments on commit fa1b5f7

Please sign in to comment.