This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
137 lines (123 loc) · 4.44 KB
/
test-as-submodule.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
name: NEURON submodule
concurrency:
group: ${{ github.workflow }}#${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
- release/**
pull_request:
branches:
- master
- release/**
jobs:
ci:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
cores: 2
- os: macOS-11
cores: 3
fail-fast: false
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{matrix.cores}}
SDK_ROOT: $(xcrun --sdk macosx --show-sdk-path)
steps:
- name: Install homebrew packages
if: startsWith(matrix.os, 'macOS')
run: |
brew install bison coreutils flex ninja openmpi
python3 -m pip install --upgrade numpy pytest pytest-cov
echo /usr/local/opt/flex/bin:/usr/local/opt/bison/bin >> $GITHUB_PATH
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
- name: Install apt packages
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install bison cython3 flex libfl-dev libopenmpi-dev \
ninja-build openmpi-bin python3-dev
python3 -m pip install --upgrade numpy pytest pytest-cov
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
- name: Set NEURON branch
id: vars
env:
GITHUB_PR_BODY: ${{ github.event.pull_request.body }}
run: |
nrn_branch=$(echo "${GITHUB_PR_BODY}" | grep "^CI_BRANCHES" \
| awk -F '[:,]{1}NEURON_BRANCH=' '{print $2}' \
| awk -F ',' '{print $1}')
if [ -z "$nrn_branch" ]; then
nrn_branch=master
fi
echo "Will use neuron branch: $nrn_branch"
echo ::set-output name=neuron_branch::"${nrn_branch}"
- uses: actions/checkout@v3
name: Checkout NEURON
with:
path: nrn
repository: neuronsimulator/nrn
ref: ${{ steps.vars.outputs.neuron_branch }}
- name: Update CoreNEURON submodule
run: |
cd ${GITHUB_WORKSPACE}/nrn
coreneuron_sha=${{github.event.pull_request.head.sha}}
if [[ -z ${coreneuron_sha} ]]; then
# presumably we're running on a push event
coreneuron_sha=${{github.sha}}
fi
echo "Using CoreNEURON SHA ${coreneuron_sha}"
# https://stackoverflow.com/a/33575837
git update-index --cacheinfo 160000,${coreneuron_sha},external/coreneuron
git submodule update --init external/coreneuron
echo "NEURON status"
git status
git log -n 1
cd external/coreneuron
echo "CoreNEURON status"
git status
git log -n 1
- name: Configure NEURON
run: |
cd ${GITHUB_WORKSPACE}/nrn
mkdir build install
cd build
# NEURON CMake assumes this is defined.
export SHELL=$(command -v bash)
openMP=" -DCORENRN_ENABLE_OPENMP=ON"
if [[ "${{ startsWith(matrix.os, 'macOS') }}" = "true" ]]; then
openMP=" -DCORENRN_ENABLE_OPENMP=OFF"
fi
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=../install \
-DPYTHON_EXECUTABLE=$(command -v python3) \
-DNRN_ENABLE_CORENEURON=ON \
-DNRN_ENABLE_INTERVIEWS=OFF \
-DNRN_ENABLE_RX3D=OFF \
-DNRN_ENABLE_MPI_DYNAMIC=ON \
-DNRN_ENABLE_TESTS=ON ${openMP}
- name: Build NEURON
run: |
cd ${GITHUB_WORKSPACE}/nrn/build
cmake --build . --parallel
- name: Test NEURON
run: |
cd ${GITHUB_WORKSPACE}/nrn/build
ctest --output-on-failure
- name: Install NEURON
run: |
cd ${GITHUB_WORKSPACE}/nrn/build
cmake --build . --target install
# This step will set up an SSH connection on tmate.io for live debugging.
# To enable it, you have to:
# * add 'live-debug-ci' 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/workflows/test-as-submodule.yml`)
if: failure() && contains(github.event.pull_request.title, 'live-debug-ci')
uses: mxschmitt/action-tmate@v3