Skip to content

Commit

Permalink
Revert "Remove CI to build faster"
Browse files Browse the repository at this point in the history
This reverts commit bea2ceb.
  • Loading branch information
JCGoran committed Nov 11, 2024
1 parent bea2ceb commit 3e7434c
Show file tree
Hide file tree
Showing 8 changed files with 1,203 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
version: 2.1

orbs:
python: circleci/[email protected]

jobs:
manylinux2014-aarch64:

parameters:
NRN_PYTHON_VERSION:
type: string
NRN_NIGHTLY_UPLOAD:
type: string

machine:
image: default

resource_class: arm.medium

steps:
- checkout
- run:
name: Build manylinux AArch64 wheel
command: |
docker run --rm \
-w /root/nrn \
-v $PWD:/root/nrn \
-v /opt/nrnwheel/mpt:/nrnwheel/mpt \
-e NEURON_NIGHTLY_TAG \
-e NRN_NIGHTLY_UPLOAD \
-e NRN_RELEASE_UPLOAD \
-e SETUPTOOLS_SCM_PRETEND_VERSION \
-e NRN_BUILD_FOR_UPLOAD=1 \
'neuronsimulator/neuron_wheel:latest-gcc9-aarch64' \
packaging/python/build_wheels.bash linux << parameters.NRN_PYTHON_VERSION >> coreneuron
- store_artifacts:
path: ./wheelhouse
destination: artifacts

- run:
name: Test manylinux AArch64 wheel
command: |
# install mpi dependencies
sudo apt update
sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev
# choose available python versions from pyenv
pyenv_py_ver=""
case << parameters.NRN_PYTHON_VERSION >> in
38) pyenv_py_ver="3.8" ;;
39) pyenv_py_ver="3.9" ;;
310) pyenv_py_ver="3.10" ;;
311) pyenv_py_ver="3.11" ;;
312) pyenv_py_ver="3.12" ;;
*) echo "Error: pyenv python version not specified or not supported." && exit 1;;
esac
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $pyenv_py_ver --force
pyenv global $pyenv_py_ver
export PYTHON_EXE=$(which python)
# test wheel
packaging/python/test_wheels.sh $PYTHON_EXE $(ls -t wheelhouse/*.whl)
- run:
name: Upload nightly wheel to pypi.org
command: |
if [ "<< parameters.NRN_NIGHTLY_UPLOAD >>" == "true" ]; then
python -m pip install --upgrade pip
python -m pip install twine
python -m twine upload --verbose --skip-existing -u $TWINE_USERNAME -p $TWINE_PASSWORD wheelhouse/*.whl
else
echo "Skipping pypi.org upload!"
fi
workflows:

build-workflow:
jobs:
- manylinux2014-aarch64:
filters:
branches:
only:
- /release\/.*/
- /circleci\/.*/
matrix:
parameters:
NRN_PYTHON_VERSION: ["312"]
NRN_NIGHTLY_UPLOAD: ["false"]

nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- manylinux2014-aarch64:
matrix:
parameters:
NRN_PYTHON_VERSION: ["38", "39", "310", "311", "312"]
NRN_NIGHTLY_UPLOAD: ["true"]
193 changes: 193 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.8'
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 }}
80 changes: 80 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: NEURON Documentation

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/**

env:
DEFAULT_PY_VERSION: '3.12'

jobs:
documentation:
runs-on: ubuntu-20.04

name: Documentation

timeout-minutes: 25

steps:

- name: Install apt packages
run: |
sudo apt-get update --fix-missing
sudo apt-get install build-essential libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin
sudo apt-get install ffmpeg doxygen pandoc
shell: bash

- name: Set up Python@${{ env.DEFAULT_PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PY_VERSION }}

- uses: actions/checkout@v4

- name: Install Python dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install --upgrade pip -r nrn_requirements.txt
- name: Install Python documentation dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install --upgrade -r docs/docs_requirements.txt
- name: Documentation
id: documentation
shell: bash
working-directory: ${{runner.workspace}}/nrn
run: |
echo "-------- NEURON wheel --------";
python setup.py build_ext bdist_wheel;
neuron_wheel=dist/NEURON*.whl;
echo "-------- install wheel --------"
python -m pip install $neuron_wheel;
echo "-------- now build docs--------";
python setup.py docs;
echo "-------- disable jekyll--------";
pushd docs/_build;
touch .nojekyll;
echo "-------- OK to deploy! --------";
echo "OK_TO_DEPLOY_DOCS=true" >> $GITHUB_ENV
# This step will set up an SSH connection on tmate.io for live debugging.
# To enable it, you have to:
# * add 'live-debug-docs' 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/docs.yml`)
if: failure() && contains(github.event.pull_request.title, 'live-debug-docs')
uses: mxschmitt/action-tmate@v3
Loading

0 comments on commit 3e7434c

Please sign in to comment.