Skip to content

Commit

Permalink
Switch to using conda over pip. Remove brille-0.7.0 pin
Browse files Browse the repository at this point in the history
  • Loading branch information
mducle committed Aug 29, 2024
1 parent 97cca83 commit cec3547
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
36 changes: 8 additions & 28 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
9 changes: 8 additions & 1 deletion test/set_up_dependencies.m
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -28,4 +35,4 @@
% Set flags on Linux to avoid segfault with libraries
if ~ispc
py.sys.setdlopenflags(int32(10))
end
end

0 comments on commit cec3547

Please sign in to comment.