Launching nrniv -python with Python 3.13.0 does not allow use of gui.… #9031
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: NEURON Code Coverage | |
concurrency: | |
# Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow | |
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
on: | |
merge_group: | |
push: | |
branches: | |
- master | |
- release/** | |
pull_request: | |
branches: | |
- master | |
- release/** | |
# TODO : https://github.com/neuronsimulator/nrn/issues/1063 | |
# paths-ignore: | |
# - '**.md' | |
# - '**.rst' | |
# - 'docs/**' | |
env: | |
PY_MIN_VERSION: '3.9' | |
PY_MID_VERSION: '3.10' | |
PY_MAX_VERSION: '3.12' | |
jobs: | |
coverage: | |
runs-on: ubuntu-22.04 | |
name: Code Coverage | |
timeout-minutes: 60 | |
env: | |
DISPLAY: ${{ ':0' }} | |
MUSIC_INSTALL_DIR: /opt/MUSIC | |
MUSIC_VERSION: 1.2.0 | |
steps: | |
- name: Install apt packages | |
run: | | |
sudo apt-get install xfonts-100dpi build-essential doxygen lcov libboost-all-dev libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin gpg ninja-build flex bison libfl-dev | |
shell: bash | |
- name: Setup Caliper profiler | |
run: | | |
git clone https://github.com/LLNL/Caliper.git | |
cd Caliper | |
mkdir build && cd build | |
cmake .. | |
make && sudo make install | |
- name: Setup MUSIC@${{ env.MUSIC_VERSION }} | |
run: | | |
python3 -m venv music-venv | |
source music-venv/bin/activate | |
python3 -m pip install 'mpi4py<4' cython numpy setuptools | |
sudo mkdir -p $MUSIC_INSTALL_DIR | |
sudo chown -R $USER $MUSIC_INSTALL_DIR | |
curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/refs/tags/${MUSIC_VERSION}.zip | |
unzip MUSIC.zip && mv MUSIC-* MUSIC && cd MUSIC | |
./autogen.sh | |
./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource | |
make -j install | |
deactivate | |
working-directory: ${{runner.temp}} | |
- name: Setup Xvfb | |
run: | | |
sudo apt-get install xvfb | |
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1600x1200x24 -noreset -nolock -shmem & # run in bg | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Clone nmodl | |
working-directory: ${{runner.workspace}}/nrn | |
run: | | |
git submodule update --init --recursive --force --depth 1 -- external/nmodl | |
- name: Set up Python@${{ env.PY_MIN_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PY_MIN_VERSION }} | |
- name: Install Python@${{ env.PY_MIN_VERSION }} dependencies | |
working-directory: ${{runner.workspace}}/nrn | |
run: | | |
python -m pip install --upgrade -r external/nmodl/requirements.txt | |
python -m pip install --upgrade -r ci_requirements.txt | |
python -m pip install --upgrade pip -r nrn_requirements.txt | |
- name: Set up Python@${{ env.PY_MID_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PY_MID_VERSION }} | |
- name: Set up Python@${{ env.PY_MAX_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PY_MAX_VERSION }} | |
- name: Install Python@${{ env.PY_MAX_VERSION }} dependencies | |
working-directory: ${{runner.workspace}}/nrn | |
run: | | |
python -m pip install --upgrade -r external/nmodl/requirements.txt | |
python -m pip install --upgrade -r ci_requirements.txt | |
python -m pip install --upgrade pip -r nrn_requirements.txt | |
- name: Build & Test | |
id: build-test | |
shell: bash | |
working-directory: ${{runner.workspace}}/nrn | |
run: | | |
export SHELL="/bin/bash" | |
# Compiler setup | |
export CC=gcc | |
export CXX=g++ | |
# Python setup | |
export PYTHON_MIN=$(which $PYTHON_MIN_NAME); | |
export PYTHON_MID=$(which $PYTHON_MID_NAME); | |
export PYTHON_MAX=$(which $PYTHON_MAX_NAME); | |
mkdir build && cd build; | |
# CMake options & flags | |
cmake_args=(-G Ninja \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_C_COMPILER="$CC" \ | |
-DCMAKE_CXX_COMPILER="$CXX" \ | |
-DNRN_ENABLE_BACKTRACE=ON \ | |
-DNRN_ENABLE_CORENEURON=ON \ | |
-DNRN_ENABLE_COVERAGE=ON \ | |
-DNRN_ENABLE_INTERVIEWS=ON \ | |
-DNRN_ENABLE_MPI=ON \ | |
-DNRN_ENABLE_PERFORMANCE_TESTS=OFF \ | |
-DNRN_ENABLE_PROFILING=ON \ | |
-DNRN_ENABLE_PYTHON=ON \ | |
-DNRN_ENABLE_PYTHON_DYNAMIC=ON \ | |
-DNRN_PYTHON_DYNAMIC="${PYTHON_MIN};${PYTHON_MAX}" \ | |
-DNRN_PYTHON_EXTRA_FOR_TESTS=${PYTHON_MID} \ | |
-DNRN_ENABLE_TESTS=ON \ | |
-DNRN_ENABLE_MUSIC=ON \ | |
-DCMAKE_PREFIX_PATH="${MUSIC_INSTALL_DIR}" \ | |
-DMUSIC_ROOT="${MUSIC_INSTALL_DIR}") | |
cmake .. "${cmake_args[@]}" | |
# Coverage | |
# The Linux runners apparently have 2 cores, but jobs were being killed when we did not specify this explicitly. | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
# By default we get a modern version of CMake that understands --parallel. | |
cmake --build . --parallel 2 | |
cmake --build . --target cover_baseline | |
xvfb-run ctest --rerun-failed --output-on-failure; | |
for python in "${PYTHON_MIN}" "${PYTHON_MAX}" | |
do | |
echo "Using ${python}" | |
NEURONHOME="${PWD}/share/nrn" \ | |
PYTHONPATH="${PWD}/lib/python:${PYTHONPATH}" \ | |
PATH="${PWD}/bin:${PATH}" \ | |
LD_LIBRARY_PATH="${PWD}/lib:${LD_LIBRARY_PATH}" \ | |
DYLD_LIBRARY_PATH="${PWD}/lib:${DYLD_LIBRARY_PATH}" \ | |
"${python}" -c "from neuron import h; import neuron; neuron.test();neuron.test_rxd();" | |
done | |
cmake --build . --target cover_collect | |
cmake --build . --target cover_combine | |
env: | |
MATRIX_EVAL: "CC=gcc CXX=g++" | |
PYTHON_MIN_NAME: "python${{ env.PY_MIN_VERSION }}" | |
PYTHON_MID_NAME: "python${{ env.PY_MID_VERSION }}" | |
PYTHON_MAX_NAME: "python${{ env.PY_MAX_VERSION }}" | |
# This step will set up an SSH connection on tmate.io for live debugging. | |
# To enable it, you have to: | |
# * add 'live-debug-coverage' to your PR title | |
# * push something to your PR branch (note that just re-running the pipeline disregards the title update) | |
- name: live debug session on failure (manual steps required, check `.github/coverage.yml`) | |
if: failure() && contains(github.event.pull_request.title, 'live-debug-coverage') | |
uses: mxschmitt/action-tmate@v3 | |
- uses: codecov/codecov-action@v4 | |
with: | |
directory: ./build | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} |