Skip to content

Commit

Permalink
Update run_unit_tests.yml to Cache matlab
Browse files Browse the repository at this point in the history
  • Loading branch information
johmedr authored Nov 21, 2024
1 parent 868b349 commit d4238fe
Showing 1 changed file with 61 additions and 61 deletions.
122 changes: 61 additions & 61 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,74 +31,74 @@ jobs:
release: ${{matrix.matlab}}
cache: True

- name: Extract MATLAB path to file
uses: matlab-actions/run-command@v2
with:
command: |
fileID = fopen('matlab_path.txt', 'w')
matlabpath = matlabroot;
fprintf(fileID, matlabpath)
fclose(fileID)
# sometimes this step hangs when closing matlab, automatically terminating after 2 minutes solves the issue
timeout-minutes: 2
continue-on-error: true
# - name: Extract MATLAB path to file
# uses: matlab-actions/run-command@v2
# with:
# command: |
# fileID = fopen('matlab_path.txt', 'w')
# matlabpath = matlabroot;
# fprintf(fileID, matlabpath)
# fclose(fileID)
# # sometimes this step hangs when closing matlab, automatically terminating after 2 minutes solves the issue
# timeout-minutes: 2
# continue-on-error: true

- name: Set environment variable with MATLAB path
shell: bash # Works on Windows as well because of shell: bash
run: |
matlab_path=$(cat matlab_path.txt)
echo "MATLAB_PATH=$matlab_path" >> $GITHUB_ENV
# - name: Set environment variable with MATLAB path
# shell: bash # Works on Windows as well because of shell: bash
# run: |
# matlab_path=$(cat matlab_path.txt)
# echo "MATLAB_PATH=$matlab_path" >> $GITHUB_ENV

- name: Setup path on Linux
if: matrix.os_name == 'Linux'
run: |
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}\
${{ env.MATLAB_PATH }}/runtime/glnxa64:\
${{ env.MATLAB_PATH }}/bin/glnxa64:\
${{ env.MATLAB_PATH }}/sys/os/glnxa64:\
${{ env.MATLAB_PATH }}/extern/bin/glnxa64"
# - name: Setup path on Linux
# if: matrix.os_name == 'Linux'
# run: |
# export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}\
# ${{ env.MATLAB_PATH }}/runtime/glnxa64:\
# ${{ env.MATLAB_PATH }}/bin/glnxa64:\
# ${{ env.MATLAB_PATH }}/sys/os/glnxa64:\
# ${{ env.MATLAB_PATH }}/extern/bin/glnxa64"

- name: Setup path on Mac Apple Silicon
if: matrix.os_name == 'macOS_Apple_Silicon'
run: |
export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}\
${{ env.MATLAB_PATH }}/runtime/maca64:\
${{ env.MATLAB_PATH }}/bin/maca64:\
${{ env.MATLAB_PATH }}/sys/os/maca64:\
${{ env.MATLAB_PATH }}/extern/bin/maca64"
# - name: Setup path on Mac Apple Silicon
# if: matrix.os_name == 'macOS_Apple_Silicon'
# run: |
# export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}\
# ${{ env.MATLAB_PATH }}/runtime/maca64:\
# ${{ env.MATLAB_PATH }}/bin/maca64:\
# ${{ env.MATLAB_PATH }}/sys/os/maca64:\
# ${{ env.MATLAB_PATH }}/extern/bin/maca64"

- name: Setup path on Mac Intel
if: matrix.os_name == 'macOS_Intel'
run: |
export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}\
${{ env.MATLAB_PATH }}/runtime/maci64:\
${{ env.MATLAB_PATH }}/bin/maci64:\
${{ env.MATLAB_PATH }}/sys/os/maci64:\
${{ env.MATLAB_PATH }}/extern/bin/maci64"
# - name: Setup path on Mac Intel
# if: matrix.os_name == 'macOS_Intel'
# run: |
# export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}\
# ${{ env.MATLAB_PATH }}/runtime/maci64:\
# ${{ env.MATLAB_PATH }}/bin/maci64:\
# ${{ env.MATLAB_PATH }}/sys/os/maci64:\
# ${{ env.MATLAB_PATH }}/extern/bin/maci64"

- name: Setup path on Windows
if: matrix.os_name == 'Windows'
run: |
set PATH=%PATH%;$env:MATLAB_PATH\runtime\win64
# - name: Setup path on Windows
# if: matrix.os_name == 'Windows'
# run: |
# set PATH=%PATH%;$env:MATLAB_PATH\runtime\win64

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# cache: 'pip' # caching pip dependencies

- name: Check out repository
uses: actions/checkout@v4
# - name: Check out repository
# uses: actions/checkout@v4

- name: Install repository
run: pip install -e .
# - name: Install repository
# run: pip install -e .

- name: Run tests on Mac
shell: bash
if: runner.os == 'Mac'
run: mwpython -m unittest discover tests -v
# - name: Run tests on Mac
# shell: bash
# if: runner.os == 'Mac'
# run: mwpython -m unittest discover tests -v

- name: Run tests on Linux
shell: bash
if: runner.os == 'Linux'
run: python -m unittest discover tests -v
# - name: Run tests on Linux
# shell: bash
# if: runner.os == 'Linux'
# run: python -m unittest discover tests -v

0 comments on commit d4238fe

Please sign in to comment.