From cec35474d96dc510cde59ce12c994d30de65058c Mon Sep 17 00:00:00 2001 From: Duc Le Date: Thu, 29 Aug 2024 09:56:04 +0100 Subject: [PATCH] Switch to using conda over pip. Remove brille-0.7.0 pin --- .github/workflows/run_tests.yml | 36 ++++++++------------------------- test/set_up_dependencies.m | 9 ++++++++- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 9cfacff..1d54d35 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -39,48 +39,28 @@ jobs: uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python_version }} - - name: Set Python environment variable for access by Matlab - if: ${{ matrix.os != 'windows-latest' }} - run: echo "PYTHON_EX_PATH=`which python`" >> $GITHUB_ENV - - name: Set Python environment variable for access by Matlab (Windows) - if: ${{ matrix.os == 'windows-latest' }} - shell: powershell + auto-update-conda: true + conda-solver: libmamba + channels: conda-forge + - name: Set Python environment run: | - $pypath = (Get-Command python).Path - echo "PYTHON_EX_PATH=$pypath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - - name: Update pip and create Matlab toolbox - run: | - python -m pip install --upgrade pip && - python -m pip install requests && - python create_mltbx.py + conda install euphonic scipy psutil pyyaml h5py requests + echo "PYTHON_EX_PATH=`which python`" >> $GITHUB_ENV + - name: Create Matlab toolbox + run: python create_mltbx.py - name: create_toolbox uses: matlab-actions/run-command@v2 with: command: cd('mltbx'); create_mltbx() - - name: Install base Euphonic - run: | - python -m pip install numpy==1.26.4 && - python euphonic_sqw_models/apply_requirements.py ${{ matrix.euphonic_version }} - name: Run tests with base Euphonic uses: matlab-actions/run-command@v2 with: command: cd('test'); set_up_dependencies; run_tests('not', 'phonopy_reader', 'not', 'brille') - - name: Install Euphonic phonopy_reader - if: always() - run: python euphonic_sqw_models/apply_requirements.py ${{ matrix.euphonic_version}} --extras phonopy_reader - name: Run tests with Euphonic and phonopy_reader - if: always() uses: matlab-actions/run-command@v2 with: command: cd('test'); set_up_dependencies; run_tests('phonopy_reader') - - name: Install brille (Windows) - if: ${{ matrix.os == 'windows-latest' }} - run: python -m pip install brille==0.7.0 - - name: Install brille (Linux) - if: ${{ matrix.os == 'ubuntu-latest' }} - run: python euphonic_sqw_models/apply_requirements.py ${{ matrix.euphonic_version}} --extras brille - name: Run tests with Euphonic and Brille - if: always() uses: matlab-actions/run-command@v2 with: command: cd('test'); set_up_dependencies; run_tests('brille') diff --git a/test/set_up_dependencies.m b/test/set_up_dependencies.m index ce1489c..2c7def4 100644 --- a/test/set_up_dependencies.m +++ b/test/set_up_dependencies.m @@ -1,6 +1,13 @@ % Set up Python py_ex_path = getenv('PYTHON_EX_PATH'); disp(py_ex_path) +if ispc && isempty(strfind(py_ex_path, ':')) + % For case of git-bash or msys style strings + py_ex_path = regexprep(py_ex_path, '^\/([A-z])\/', '$1:/'); + if ~strcmp(py_ex_path(end-3:end), '.exe') + py_ex_path = [py_ex_path '.exe'] + end +end try % Pyenv only introduced in 2019b pyenv('Version', py_ex_path) @@ -28,4 +35,4 @@ % Set flags on Linux to avoid segfault with libraries if ~ispc py.sys.setdlopenflags(int32(10)) -end \ No newline at end of file +end