Add tests for python 3.9 to 3.12 #450
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: neurodamus build and test | |
on: | |
schedule: | |
# every evening at 20:00 UTC | |
- cron: '0 20 * * *' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
NEURON_BRANCH: | |
description: 'NEURON branch to use' | |
required: false | |
LIBSONATA_REPORT_BRANCH: | |
description: 'libsonatareport branch to use' | |
required: false | |
jobs: | |
simulation: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-latest] | |
python-version: [3.9, 3.10, 3.11, 3.12] | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout neurodamus repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-v1 | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Get HEAD commit message and look for branches | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
echo $COMMIT_MESSAGE | |
NEURON_BRANCH=$(echo $COMMIT_MESSAGE | grep -Po 'NEURON_BRANCH=\K[0-9a-zA-Z/_.\-]*' || true) | |
if [[ ! -z $NEURON_BRANCH ]]; then echo "NEURON_BRANCH=$NEURON_BRANCH" >> $GITHUB_ENV; fi | |
LIBSONATA_REPORT_BRANCH=$(echo $COMMIT_MESSAGE | grep -Po 'LIBSONATA_REPORT_BRANCH=\K[0-9a-zA-Z/_.\-]*' || true) | |
if [[ ! -z $LIBSONATA_REPORT_BRANCH ]]; then echo "LIBSONATA_REPORT_BRANCH=$LIBSONATA_REPORT_BRANCH" >> $GITHUB_ENV; fi | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y mpich libmpich-dev libhdf5-mpich-dev hdf5-tools flex libfl-dev bison ninja-build | |
- name: Upgrade pip and install base Python packages | |
run: | | |
python -m pip install --upgrade pip setuptools | |
pip install cython numpy wheel pkgconfig | |
- name: Install libsonata | |
run: | | |
CC=mpicc CXX=mpic++ pip install git+https://github.com/BlueBrain/libsonata | |
- name: Install libsonatareport | |
run: | | |
git clone --branch="${LIBSONATA_REPORT_BRANCH:-master}" https://github.com/BlueBrain/libsonatareport.git --recursive --depth=1 | |
cd libsonatareport | |
mkdir build && cd build | |
cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DCMAKE_BUILD_TYPE=Release -DSONATA_REPORT_ENABLE_SUBMODULES=ON -DSONATA_REPORT_ENABLE_MPI=ON .. | |
cmake --build . --parallel | |
cmake --build . --target install | |
- name: Install NEURON | |
run: | | |
export SONATAREPORT_DIR=$(pwd)/libsonatareport/build/install | |
git clone https://github.com/BlueBrain/nmodl.git --depth=1 | |
git clone --branch="${NEURON_BRANCH:-master}" https://github.com/neuronsimulator/nrn.git --depth=1 | |
python -m pip install --upgrade pip -r nrn/nrn_requirements.txt | |
python -m pip install --upgrade -r nmodl/requirements.txt | |
mkdir -p nrn/build && cd nrn/build | |
cmake -G Ninja \ | |
-DPYTHON_EXECUTABLE=$(which python) \ | |
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \ | |
-DNRN_ENABLE_MPI=ON \ | |
-DNRN_ENABLE_INTERVIEWS=OFF \ | |
-DNRN_ENABLE_CORENEURON=ON \ | |
-DCMAKE_C_COMPILER=gcc \ | |
-DCMAKE_CXX_COMPILER=g++ \ | |
-DCORENRN_ENABLE_REPORTING=ON \ | |
-DCMAKE_PREFIX_PATH=$SONATAREPORT_DIR .. | |
cmake --build . --parallel | |
cmake --build . --target install | |
- name: Build h5py with the local hdf5 | |
run: | | |
MPICC="mpicc -shared" pip install --no-cache-dir --no-binary=mpi4py mpi4py | |
CC="mpicc" HDF5_MPI="ON" HDF5_INCLUDEDIR=/usr/include/hdf5/mpich HDF5_LIBDIR=/usr/lib/x86_64-linux-gnu/hdf5/mpich \ | |
pip install --no-cache-dir --no-binary=h5py h5py --no-build-isolation | |
- name: Install neurodamus | |
run: | | |
pip install . | |
- name: Build models | |
run: | | |
export SONATAREPORT_DIR=$(pwd)/libsonatareport/build/install | |
export PATH=$(pwd)/nrn/build/install/bin:$PATH | |
# copy mod files from the Zenodo link | |
wget --output-document="O1_mods.xz" --quiet "https://zenodo.org/record/8026353/files/O1_mods.xz?download=1" | |
tar -xf O1_mods.xz | |
cp -r mod tests/share/ | |
cp core/mod/*.mod tests/share/mod/ | |
./docker/build_neurodamus.sh tests/share/mod | |
- name: Example run | |
run: | | |
export PYTHONPATH=$(pwd)/nrn/build/lib/python:$PYTHONPATH | |
cp core/hoc/* tests/share/hoc/ | |
export HOC_LIBRARY_PATH=$(pwd)/tests/share/hoc | |
# launch simulation with NEURON | |
mpirun -np 2 ./x86_64/special -mpi -python init.py --configFile=tests/simulations/usecase3/simulation_sonata.json | |
ls tests/simulations/usecase3/reporting/*.h5 | |
# launch simulation with CORENEURON | |
mpirun -np 2 ./x86_64/special -mpi -python init.py --configFile=tests/simulations/usecase3/simulation_sonata_coreneuron.json | |
ls tests/simulations/usecase3/reporting_coreneuron/*.h5 | |
# - name: live debug session, comment out | |
# if: failure() | |
# uses: mxschmitt/action-tmate@v3 |