Skip to content

MAINT: Added conditionals to install openmpi according to matrix.os #187

MAINT: Added conditionals to install openmpi according to matrix.os

MAINT: Added conditionals to install openmpi according to matrix.os #187

Workflow file for this run

name: Unit tests
on:
push:
branches: ['**']
pull_request:
branches: ['**']
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04,macos-14]
python-version: [3.8,3.9]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: cp310
with:
python-version: ${{ matrix.python-version }}
- name: Install ubuntu dependencies
if: contains(matrix.os, 'ubuntu')
shell: bash -el {0}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libopenmpi-dev openmpi-bin
- name: Install MacOs dependencies
if: contains(matrix.os, 'macos')
shell: bash -el {0}
run: |
brew install open-mpi
- name: Install dependencies
shell: bash -el {0}
run: |
'${{ steps.cp310.outputs.python-path }}' -m pip install --upgrade pip
'${{ steps.cp310.outputs.python-path }}' -m pip install mpi4py openmpi
- name: Check MPI version
shell: bash -el {0}
run: |
mpiexec --version
- name: Check Python version
shell: bash -el {0}
run: |
'${{ steps.cp310.outputs.python-path }}' --version
- name: Install HNN-core
shell: bash -el {0}
run: |
'${{ steps.cp310.outputs.python-path }}' -m pip install --verbose '.[opt, parallel, test, gui]'
- name: Set Env Variables
shell: bash -el {0}
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
echo "List /opt/homebrew/lib"
ls /opt/homebrew/lib
echo "MPI_LIB_NRN_PATH=/opt/homebrew/lib/libmpi.dylib" >> $GITHUB_ENV
fi;
# - name: Run MPI application
# shell: bash -el {0}
# run: |
# mpiexec -np 2 '${{ steps.cp310.outputs.python-path }}' ./hnn_core/mpi_test.py
- name: Verify NEURON installation
shell: bash -el {0}
run: |
nrniv -python -nobanner -mpi '${{ steps.cp310.outputs.python-path }}' "from neuron import h; print(h)"
# - name: Run MPI application with NEURON
# shell: bash -el {0}
# run: |
# mpiexec -np 2 -verbose nrniv -python -mpi -nobanner '${{ steps.cp310.outputs.python-path }}' ./hnn_core/mpi_test.py
# - name: Lint with flake8
# shell: bash -el {0}
# run: |
# flake8 --count hnn_core
- name: Test with pytest
shell: bash -el {0}
run: |
'${{ steps.cp310.outputs.python-path }}' -m pytest ./hnn_core/tests/ --cov=hnn_core --cov-report=xml
# - name: Upload coverage to Codecov
# shell: bash -el {0}
# run: |
# bash <(curl -s https://codecov.io/bash) -f ./coverage.xml