-
Notifications
You must be signed in to change notification settings - Fork 118
193 lines (166 loc) · 7.13 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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 }}