16
16
17
17
env :
18
18
BUILD_TYPE : Release
19
- DEVELOPER_DIR : /Applications/Xcode_11.3.1.app/Contents/Developer
20
19
DEFAULT_PY_VERSION : 3.8
20
+ MACOSX_DEPLOYMENT_TARGET : 11.0
21
21
22
22
jobs :
23
23
ci :
@@ -26,22 +26,34 @@ jobs:
26
26
name : ${{ matrix.os }} - ${{ toJson(matrix.config) }})
27
27
28
28
env :
29
- INSTALL_DIR : install
30
29
SDK_ROOT : $(xcrun --sdk macosx --show-sdk-path)
31
30
32
31
strategy :
33
32
matrix :
34
- os : [ ubuntu-20.04, macOS-10.15 ]
33
+ os : [ubuntu-20.04, macOS-11 ]
35
34
config :
36
35
# Defaults: CORENRN_ENABLE_MPI=ON
37
- - {cmake_option: "-DCORENRN_ENABLE_MPI=ON -DCORENRN_ENABLE_DEBUG_CODE=ON", documentation: ON}
38
- - {cmake_option: "-DCORENRN_ENABLE_MPI_DYNAMIC=ON"}
36
+ - {cmake_option: "-DCORENRN_ENABLE_MPI_DYNAMIC=ON", flag_warnings: ON}
39
37
- {cmake_option: "-DCORENRN_ENABLE_MPI_DYNAMIC=ON -DCORENRN_ENABLE_SHARED=OFF"}
40
38
- {cmake_option: "-DCORENRN_ENABLE_MPI=OFF"}
41
39
- {use_nmodl: ON, py_version: 3.6.7}
42
40
- {use_nmodl: ON}
43
41
- {use_ispc: ON, py_version: 3.6.7}
44
- - {gcc_version: 9}
42
+ include :
43
+ - os : ubuntu-20.04
44
+ config :
45
+ gcc_version : 10
46
+ - os : ubuntu-20.04
47
+ config :
48
+ cmake_option : -DCORENRN_ENABLE_DEBUG_CODE=ON
49
+ documentation : ON
50
+ - os : ubuntu-22.04
51
+ config :
52
+ sanitizer : address
53
+ - os : ubuntu-22.04
54
+ config :
55
+ flag_warnings : ON
56
+ sanitizer : undefined
45
57
fail-fast : false
46
58
47
59
steps :
@@ -50,29 +62,31 @@ jobs:
50
62
if : startsWith(matrix.os, 'macOS')
51
63
run : |
52
64
brew update
53
- brew install coreutils bison flex boost openmpi
65
+ brew install bison boost ccache coreutils flex ninja openmpi
66
+ echo /usr/local/opt/flex/bin:/usr/local/opt/bison/bin >> $GITHUB_PATH
54
67
shell : bash
55
68
56
69
- name : Install apt packages
57
70
if : startsWith(matrix.os, 'ubuntu')
58
71
run : |
59
- sudo apt-get install doxygen bison flex libboost-all-dev libopenmpi-dev openmpi-bin python3-dev python3-pip libfl-dev
72
+ sudo apt-get install bison ccache doxygen flex libboost-all-dev \
73
+ libfl-dev libopenmpi-dev ninja-build openmpi-bin
60
74
shell : bash
61
75
62
76
- name : Install specific apt packages
63
77
if : startsWith(matrix.os, 'ubuntu') && matrix.config.gcc_version
64
78
run : |
65
- sudo apt-get install g++-${GCC_VERSION}
79
+ sudo apt-get install gcc-${{matrix.config.gcc_version}}
80
+ echo CC="gcc-${{matrix.config.gcc_version}}" >> $GITHUB_ENV
81
+ echo CXX="g++-${{matrix.config.gcc_version}}" >> $GITHUB_ENV
66
82
shell : bash
67
- env :
68
- GCC_VERSION : ${{ matrix.config.gcc_version }}
69
83
70
84
- name : Set up Python3
71
85
uses : actions/setup-python@v3
72
86
with :
73
87
python-version : ${{ env.PYTHON_VERSION }}
74
88
env :
75
- PYTHON_VERSION : ${{ matrix.config.py_version || env.DEFAULT_PY_VERSION }}
89
+ PYTHON_VERSION : ${{matrix.config.py_version || env.DEFAULT_PY_VERSION}}
76
90
77
91
- name : Install ISPC
78
92
if : ${{ matrix.config.use_ispc == 'ON' }}
@@ -89,56 +103,116 @@ jobs:
89
103
url="https://github.com/ispc/ispc/releases/download/${ispc_version}/ispc-${ispc_version}${ispc_version_suffix}-${url_os}.tar.gz";
90
104
wget -O ispc.tar.gz $url;
91
105
mkdir ispc && tar -xvzf ispc.tar.gz -C ispc --strip 1;
106
+
92
107
- name : Install NMODL dependencies
93
108
if : ${{ matrix.config.use_nmodl == 'ON' || matrix.config.use_ispc == 'ON' }}
94
109
run : |
95
110
python3 -m pip install --upgrade pip jinja2 pyyaml pytest sympy
96
111
97
112
- uses : actions/checkout@v3
98
113
99
- - name : Install Python3 documentation dependencies
100
- if : ${{ startsWith( matrix.os, 'ubuntu') && matrix. config.documentation == 'ON' }}
114
+ - name : Install documentation dependencies
115
+ if : ${{matrix.config.documentation == 'ON'}}
101
116
working-directory : ${{runner.workspace}}/CoreNeuron
102
117
run : |
118
+ sudo apt-get install doxygen
103
119
python3 -m pip install --upgrade pip
104
120
python3 -m pip install --upgrade -r docs/docs_requirements.txt
105
121
122
+ - name : Register compiler warning problem matcher
123
+ if : ${{matrix.config.flag_warnings == 'ON'}}
124
+ run : echo "::add-matcher::.github/problem-matchers/gcc.json"
125
+
126
+ - name : Register sanitizer problem matcher
127
+ if : ${{matrix.config.sanitizer}}
128
+ run : echo "::add-matcher::.github/problem-matchers/${{matrix.config.sanitizer}}.json"
129
+
130
+ - name : Hash config dictionary
131
+ run : |
132
+ cat << EOF > matrix.json
133
+ ${{toJSON(matrix.config)}}
134
+ EOF
135
+ echo matrix.config JSON:
136
+ cat matrix.json
137
+ echo -----
138
+
139
+ - name : Restore compiler cache
140
+ uses : pat-s/always-upload-cache@v3
141
+ with :
142
+ path : |
143
+ ${{runner.workspace}}/ccache
144
+ key : ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}-${{github.sha}}
145
+ restore-keys : |
146
+ ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}-
147
+ ${{matrix.os}}-${{hashfiles('matrix.json')}}-
148
+
106
149
- name : Build and Test
107
150
id : build-test
108
151
shell : bash
109
152
working-directory : ${{runner.workspace}}/CoreNeuron
110
153
run : |
111
- if [ -n "$GCC_VERSION" ]; then
112
- export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}";
113
- fi
114
-
115
- openmp=" -DCORENRN_ENABLE_OPENMP=ON"
154
+ cmake_args=(${{matrix.config.cmake_option}})
116
155
if [[ "${{ startsWith(matrix.os, 'macOS') }}" = "true" ]]; then
117
- export PATH=/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH;
118
- export CXX=g++;
119
- export CC=gcc;
120
- openmp=" -DCORENRN_ENABLE_OPENMP=OFF";
156
+ cmake_args+=(-DCORENRN_ENABLE_OPENMP=OFF)
157
+ else
158
+ cmake_args+=(-DCORENRN_ENABLE_OPENMP=ON)
159
+ fi
160
+
161
+ if [[ "${{matrix.config.flag_warnings}}" == "ON" ]]; then
162
+ cmake_args+=(-DCORENRN_EXTRA_CXX_FLAGS="-Wall")
163
+ fi
164
+
165
+ if [[ -n "${{matrix.config.sanitizer}}" ]]; then
166
+ CC=$(command -v clang-14)
167
+ CXX=$(command -v clang++-14)
168
+ symbolizer_path=$(realpath $(command -v llvm-symbolizer-14))
169
+ cmake_args+=(-DCMAKE_BUILD_TYPE=Custom \
170
+ -DCMAKE_C_FLAGS="-O1 -g -Wno-writable-strings" \
171
+ -DCMAKE_CXX_FLAGS="-O1 -g -Wno-writable-strings" \
172
+ -DLLVM_SYMBOLIZER_PATH="${symbolizer_path}" \
173
+ -DCORENRN_SANITIZERS=$(echo ${{matrix.config.sanitizer}} | sed -e 's/-/,/g'))
174
+ else
175
+ CC=${CC:-gcc}
176
+ CXX=${CXX:-g++}
121
177
fi
122
178
123
179
echo "------- Build, Test and Install -------"
124
180
mkdir build && cd build
125
181
if [[ "$USE_ISPC" == "ON" ]]; then
126
- cmake ${openmp} -DCORENRN_ENABLE_ISPC=ON -DCMAKE_ISPC_COMPILER=${{runner.workspace}}/ispc/bin/ispc -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPYTHON_EXECUTABLE=$(which python3) ..;
182
+ cmake_args+=( -DCORENRN_ENABLE_ISPC=ON -DCMAKE_ISPC_COMPILER=${{runner.workspace}}/ispc/bin/ispc)
127
183
elif [[ "$USE_NMODL" == "ON" ]]; then
128
- cmake ${openmp} -DCORENRN_ENABLE_NMODL=ON -DCORENRN_NMODL_FLAGS="sympy --analytic" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPYTHON_EXECUTABLE=$(which python3) ..;
129
- else
130
- cmake ${cmake_option} ${openmp} -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPYTHON_EXECUTABLE=$(which python3) ..;
184
+ cmake_args+=(-DCORENRN_ENABLE_NMODL=ON "-DCORENRN_NMODL_FLAGS=sympy --analytic")
185
+ fi
186
+ cmake .. -G Ninja "${cmake_args[@]}" \
187
+ -DCMAKE_C_COMPILER="${CC}" \
188
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
189
+ -DCMAKE_CXX_COMPILER="${CXX}" \
190
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
191
+ "-DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install" \
192
+ -DPYTHON_EXECUTABLE=$(command -v python3)
193
+ if ccache --version | grep -E '^ccache version 4\.(4|4\.1)$'
194
+ then
195
+ echo "------- Disable ccache direct mode -------"
196
+ # https://github.com/ccache/ccache/issues/935
197
+ export CCACHE_NODIRECT=1
131
198
fi
132
- make
133
- ctest --output-on-failure
134
- make install
199
+ ccache -z
200
+ # Older versions don't support -v (verbose)
201
+ ccache -vs 2>/dev/null || ccache -s
202
+ cmake --build . --parallel
203
+ ccache -vs 2>/dev/null || ccache -s
204
+ ctest -T Test --output-on-failure
205
+ cmake --build . --target install
135
206
env :
136
- cmake_option : ${{ matrix.config.cmake_option }}
137
- USE_ISPC : ${{ matrix.config.use_ispc }}
138
- USE_NMODL : ${{ matrix.config.use_nmodl }}
139
- INSTALL_DIR : ${{ runner.workspace }}/install
140
- GCC_VERSION : ${{ matrix.config.gcc_version }}
141
- PYTHON_VERSION : ${{ matrix.config.py_version || env.DEFAULT_PY_VERSION }}
207
+ CCACHE_BASEDIR : ${{runner.workspace}}/CoreNeuron
208
+ CCACHE_DIR : ${{runner.workspace}}/ccache
209
+ USE_ISPC : ${{matrix.config.use_ispc}}
210
+ USE_NMODL : ${{matrix.config.use_nmodl}}
211
+
212
+ - uses : actions/upload-artifact@v3
213
+ with :
214
+ name : ctest-results-${{hashfiles('matrix.json')}}-sanitizer
215
+ path : ${{runner.workspace}}/CoreNeuron/build/Testing/*/Test.xml
142
216
143
217
# This step will set up an SSH connection on tmate.io for live debugging.
144
218
# To enable it, you have to:
@@ -151,11 +225,10 @@ jobs:
151
225
- name : Documentation
152
226
if : ${{ startsWith(matrix.os, 'ubuntu') && matrix.config.documentation == 'ON' }}
153
227
id : documentation
154
- working-directory : ${{runner.workspace}}/CoreNeuron
228
+ working-directory : ${{runner.workspace}}/CoreNeuron/build
155
229
run : |
156
230
echo "------- Build Doxygen Documentation -------";
157
- pushd build;
158
- make docs;
231
+ cmake --build . --target docs
159
232
echo "-------- Disable jekyll --------";
160
233
pushd docs;
161
234
touch .nojekyll;
0 commit comments