Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 9ed34cc

Browse files
committed
test integration of apple m1 runner
1 parent c893da2 commit 9ed34cc

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.gitlab-ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,99 @@ include:
77
- project: hpc/gitlab-upload-logs
88
file: enable-upload.yml
99

10+
11+
# see https://gitlab.com/gitlab-org/gitlab/-/issues/263401 for why we specify the flags like this now
12+
# 130 characters seems to be the point at which jobs refuse to run
13+
.matrix:
14+
parallel:
15+
matrix:
16+
- build_mode: cmake
17+
cmake_coreneuron: "ON"
18+
cmake_interviews: "OFF"
19+
cmake_rx3d: "OFF"
20+
sanitizer: address
21+
22+
mac_m1_cmake_build:
23+
stage: build
24+
extends: .matrix
25+
cache:
26+
# either CI_MERGE_REQUEST_SOURCE_BRANCH_NAME or CI_COMMIT_BRANCH will be available,
27+
# depending on whether this pipeline runs for a merge request or on a branch
28+
# either way, we get the active branch in the cache key
29+
key: ${CI_JOB_NAME}-${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}${CI_COMMIT_BRANCH}
30+
paths:
31+
- ./ccache
32+
variables:
33+
CCACHE_BASEDIR: ${CI_PROJECT_DIR}/nrn
34+
CCACHE_DIR: ${CI_PROJECT_DIR}/ccache
35+
CMAKE_BUILD_PARALLEL_LEVEL: 3
36+
CTEST_PARALLEL_LEVEL: 3
37+
tags:
38+
- macos-arm64
39+
script:
40+
- python3 -m virtualenv venv
41+
- venv/bin/pip install --upgrade pip -r nrn_requirements.txt
42+
- venv/bin/python --version
43+
- 'venv/bin/python -c "import os,matplotlib; f = open(os.path.join(os.path.dirname(matplotlib.__file__), \"mpl-data/matplotlibrc\"),\"a\"); f.write(\"backend: TkAgg\");f.close();"'
44+
- 'export CXX=${CXX:-g++}'
45+
- 'export CC=${CC:-gcc}'
46+
- export PYTHON=$(pwd)/venv/bin/python3
47+
- export INSTALL_DIR=$(pwd)/install
48+
- echo $LANG
49+
- echo $LC_ALL
50+
- source venv/bin/activate
51+
- 'export PYTHONPATH=$(${PYTHON} -c "import site; print(\":\".join(site.getsitepackages()))")'
52+
- 'export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python/'
53+
- ${PYTHON} -c 'import os,sys; os.set_blocking(sys.stdout.fileno(), True)'
54+
- cmake_args=(-G Ninja)
55+
- if [[ -n "${sanitizer}" ]]; then
56+
- cmake_args+=(-DCMAKE_BUILD_TYPE=Custom
57+
-DCMAKE_C_FLAGS="-O1 -g"
58+
-DCMAKE_CXX_FLAGS="-O1 -g"
59+
-DNRN_SANITIZERS=$(echo ${sanitizer} | sed -e 's/-/,/g'))
60+
- fi
61+
- cmake_args+=(-DCMAKE_C_COMPILER="${CC}"
62+
-DCMAKE_C_COMPILER_LAUNCHER=ccache
63+
-DCMAKE_CXX_COMPILER="${CXX}"
64+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
65+
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
66+
-DNRN_ENABLE_TESTS=ON
67+
-DNRN_ENABLE_CORENEURON=${cmake_coreneuron}
68+
-DNRN_ENABLE_INTERVIEWS=${cmake_interviews}
69+
-DNRN_ENABLE_RX3D=${cmake_rx3d}
70+
-DCORENRN_SANITIZERS=${sanitizer})
71+
- cmake_args+=(-DPYTHON_EXECUTABLE="${PYTHON}")
72+
- git clone https://github.com/neuronsimulator/nrn.git && cd nrn
73+
- mkdir build && cd build
74+
- echo "Building with ${cmake_args[@]}"
75+
- cmake .. "${cmake_args[@]}"
76+
- ccache -z
77+
- ccache -vs 2>/dev/null
78+
- cmake --build . --parallel
79+
- ccache -vs 2>/dev/null
80+
- echo $'[install]\nprefix='>src/nrnpython/setup.cfg
81+
- cat src/nrnpython/setup.cfg
82+
- ctest --output-on-failure
83+
- cmake --build . --target install
84+
- 'export PATH=${INSTALL_DIR}/bin:${PATH}'
85+
- if [[ -f "${INSTALL_DIR}/bin/nrn-enable-sanitizer" ]]; then
86+
- echo --- bin/nrn-enable-sanitizer ---
87+
- cat bin/nrn-enable-sanitizer
88+
- echo ---
89+
- nrn_enable_sanitizer=${INSTALL_DIR}/bin/nrn-enable-sanitizer
90+
- nrn_enable_sanitizer_preload="${nrn_enable_sanitizer} --preload"
91+
- else
92+
- echo nrn-enable-sanitizer not found, not using it
93+
- fi
94+
- if [[ ! "${cmake_args[*]}" =~ "NRN_ENABLE_PYTHON=OFF" ]]; then
95+
- $PYTHON --version && ${nrn_enable_sanitizer_preload} python -c 'import neuron; neuron.test()'
96+
- fi;
97+
- ${nrn_enable_sanitizer} neurondemo -nogui -c 'demo(4)' -c 'run()' -c 'quit()'
98+
- if [[ ! "${cmake_args[*]}" =~ "NRN_ENABLE_RX3D=OFF"
99+
&& ! "${cmake_args[*]}" =~ "NRN_ENABLE_CORENEURON=ON" ]]; then
100+
- ${nrn_enable_sanitizer_preload} python ../share/lib/python/neuron/rxdtests/run_all.py
101+
- fi;
102+
10103
variables:
11104
NEURON_BRANCH:
12105
description: Branch of NEURON to build against CoreNEURON (NEURON_COMMIT and NEURON_TAG also possible)

0 commit comments

Comments
 (0)