|
| 1 | +name: CoreNEURON CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - live-debug* |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + |
| 12 | +env: |
| 13 | + BUILD_TYPE: Release |
| 14 | + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer |
| 15 | + DEFAULT_PY_VERSION: 3.8 |
| 16 | + |
| 17 | +jobs: |
| 18 | + ci: |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + |
| 21 | + name: ${{ matrix.os }} - ${{ toJson(matrix.config) }}) |
| 22 | + |
| 23 | + env: |
| 24 | + INSTALL_DIR: install |
| 25 | + SDK_ROOT: $(xcrun --sdk macosx --show-sdk-path) |
| 26 | + |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + os: [ ubuntu-16.04, macOS-10.15 ] |
| 30 | + config: |
| 31 | + - {cmake_option: "-DCORENRN_ENABLE_MPI=ON", documentation: ON } |
| 32 | + - {cmake_option: "-DCORENRN_ENABLE_MPI=OFF"} |
| 33 | + - {cmake_option: "-DCORENRN_ENABLE_SOA=ON"} |
| 34 | + - {cmake_option: "-DCORENRN_ENABLE_SOA=OFF"} |
| 35 | + - {use_nmodl: ON, py_version: 3.6.7} |
| 36 | + - {use_nmodl: ON} |
| 37 | + - {use_ispc: ON, py_version: 3.6.7} |
| 38 | + - {gcc_version: 9} |
| 39 | + fail-fast: false |
| 40 | + |
| 41 | + steps: |
| 42 | + |
| 43 | + - name: Install homebrew packages |
| 44 | + if: startsWith(matrix.os, 'macOS') |
| 45 | + run: | |
| 46 | + brew install coreutils bison flex boost openmpi |
| 47 | + shell: bash |
| 48 | + |
| 49 | + - name: Install apt packages |
| 50 | + if: startsWith(matrix.os, 'ubuntu') |
| 51 | + run: | |
| 52 | + sudo apt-get install doxygen bison flex libboost-all-dev libopenmpi-dev openmpi-bin python3-dev python3-pip |
| 53 | + shell: bash |
| 54 | + |
| 55 | + - name: Install specific apt packages |
| 56 | + if: startsWith(matrix.os, 'ubuntu') && matrix.config.gcc_version |
| 57 | + run: | |
| 58 | + sudo apt-get install g++-${GCC_VERSION} |
| 59 | + shell: bash |
| 60 | + env: |
| 61 | + GCC_VERSION: ${{ matrix.config.gcc_version }} |
| 62 | + |
| 63 | + - name: Set up Python3 |
| 64 | + uses: actions/setup-python@v2 |
| 65 | + with: |
| 66 | + python-version: ${{ env.PYTHON_VERSION }} |
| 67 | + env: |
| 68 | + PYTHON_VERSION: ${{ matrix.config.py_version || env.DEFAULT_PY_VERSION }} |
| 69 | + |
| 70 | + - name: Install ISPC |
| 71 | + if: ${{ matrix.config.use_ispc == 'ON' }} |
| 72 | + working-directory: ${{runner.workspace}} |
| 73 | + run: | |
| 74 | + ispc_version="v1.12.0"; |
| 75 | + if [ "${{ startsWith(matrix.os, 'ubuntu') }}" == "true" ]; then |
| 76 | + url_os="linux"; |
| 77 | + ispc_version_suffix="b"; |
| 78 | + else |
| 79 | + url_os="macOS"; |
| 80 | + ispc_version_suffix=""; |
| 81 | + fi; |
| 82 | + url="https://github.com/ispc/ispc/releases/download/${ispc_version}/ispc-${ispc_version}${ispc_version_suffix}-${url_os}.tar.gz"; |
| 83 | + wget -O ispc.tar.gz $url; |
| 84 | + mkdir ispc && tar -xvzf ispc.tar.gz -C ispc --strip 1; |
| 85 | + - name: Install NMODL dependencies |
| 86 | + if: ${{ matrix.config.use_nmodl == 'ON' || matrix.config.use_ispc == 'ON' }} |
| 87 | + run: | |
| 88 | + python3 -m pip install --upgrade pip jinja2 pyyaml pytest "sympy<1.6"; |
| 89 | + |
| 90 | + - uses: actions/checkout@v2 |
| 91 | + |
| 92 | + - name: Install Python3 documentation dependencies |
| 93 | + if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.config.documentation == 'ON' }} |
| 94 | + working-directory: ${{runner.workspace}}/CoreNeuron |
| 95 | + run: | |
| 96 | + python3 -m pip install --upgrade pip |
| 97 | + python3 -m pip install --upgrade -r docs/docs_requirements.txt |
| 98 | + |
| 99 | + - name: Build and Test |
| 100 | + id: build-test |
| 101 | + shell: bash |
| 102 | + working-directory: ${{runner.workspace}}/CoreNeuron |
| 103 | + run: | |
| 104 | + if [ -n "$GCC_VERSION" ]; then |
| 105 | + export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; |
| 106 | + fi |
| 107 | + |
| 108 | + if [[ "${{ startsWith(matrix.os, 'macOS') }}" = "true" ]]; then |
| 109 | + git submodule update --init -- external/Random123 |
| 110 | + export PATH=${{runner.workspace}}/CoreNeuron/external/Random123:/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH; |
| 111 | + export CXX=g++; |
| 112 | + export CC=gcc; |
| 113 | + fi |
| 114 | + |
| 115 | + echo "------- Build, Test and Install -------" |
| 116 | + mkdir build && cd build |
| 117 | + if [[ "$USE_ISPC" == "ON" ]]; then |
| 118 | + cmake -DCORENRN_ENABLE_ISPC=ON -DCMAKE_ISPC_COMPILER=${{runner.workspace}}/ispc/bin/ispc -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPYTHON_EXECUTABLE=$(which python3) ..; |
| 119 | + elif [[ "$USE_NMODL" == "ON" ]]; then |
| 120 | + cmake -DCORENRN_ENABLE_NMODL=ON -DCORENRN_NMODL_FLAGS="sympy --analytic" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPYTHON_EXECUTABLE=$(which python3) ..; |
| 121 | + else |
| 122 | + cmake ${cmake_option} -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPYTHON_EXECUTABLE=$(which python3) ..; |
| 123 | + fi |
| 124 | + make |
| 125 | + ctest --output-on-failure |
| 126 | + make install |
| 127 | + env: |
| 128 | + cmake_option: ${{ matrix.config.cmake_option }} |
| 129 | + USE_ISPC: ${{ matrix.config.use_ispc }} |
| 130 | + USE_NMODL: ${{ matrix.config.use_nmodl }} |
| 131 | + INSTALL_DIR: ${{ runner.workspace }}/install |
| 132 | + GCC_VERSION: ${{ matrix.config.gcc_version }} |
| 133 | + PYTHON_VERSION: ${{ matrix.config.py_version || env.DEFAULT_PY_VERSION }} |
| 134 | + |
| 135 | + # This step will set up an SSH connection on tmate.io for live debugging. |
| 136 | + # To trigger it, simply prefix your branch name with `live-debug` |
| 137 | + # i.e.: live-debug-hocfix |
| 138 | + - name: live debug session on failure |
| 139 | + if: failure() && startsWith(github.ref, 'refs/heads/live-debug') |
| 140 | + uses: mxschmitt/action-tmate@v3 |
| 141 | + |
| 142 | + - name: Documentation |
| 143 | + if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.config.documentation == 'ON' }} |
| 144 | + id: documentation |
| 145 | + working-directory: ${{runner.workspace}}/CoreNeuron |
| 146 | + run: | |
| 147 | + echo "------- Build Doxygen Documentation -------"; |
| 148 | + pushd build; |
| 149 | + make docs; |
| 150 | + echo "-------- Disable jekyll --------"; |
| 151 | + pushd docs; |
| 152 | + touch .nojekyll; |
| 153 | + echo ::set-output name=status::done |
| 154 | + |
| 155 | +# - name: Deploy 🚀 |
| 156 | +# uses: JamesIves/[email protected] |
| 157 | +# if: steps.documentation.outputs.status == 'done' |
| 158 | +# with: |
| 159 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 160 | +# BRANCH: gh-pages # The branch the action should deploy to. |
| 161 | +# FOLDER: ${{runner.workspace}}/nrn/build/docs # The folder the action should deploy. |
| 162 | +# CLEAN: false # Automatically remove deleted files from the deploy branch |
0 commit comments