Skip to content

Commit

Permalink
Merge pull request #200 from steffengraber/add-v36
Browse files Browse the repository at this point in the history
Add NEST v3.6 and start rework of CI
  • Loading branch information
steffengraber authored Sep 21, 2023
2 parents e232b28 + 016c438 commit a72cbf1
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 29 deletions.
3 changes: 1 addition & 2 deletions ci-templates/000_3.5.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Build_35:
stage: build
needs: ["Build_Base"]
rules:
- when: always
- when: never
script:
- docker pull $DOCKER_REGISTRY_IMAGE:3.5 || true
- docker build
Expand Down Expand Up @@ -35,7 +35,6 @@ Test_35:
Deploy_35:
stage: deploy
needs: ["Test_35"]
when: always
script:
- docker pull $DOCKER_REGISTRY_IMAGE:3.5.$CI_PIPELINE_ID
- docker tag $DOCKER_REGISTRY_IMAGE:3.5.$CI_PIPELINE_ID $DOCKER_REGISTRY_IMAGE:3.5
Expand Down
30 changes: 30 additions & 0 deletions ci-templates/000_3.6.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
###############################################
### v3.6 ###
###############################################

Build_36:
stage: build
needs: ["Build_Base"]
script:
- docker pull nest/nest-simulator:3.6 || true
- docker build
--cache-from nest/nest-simulator:3.6
--tag $DOCKER_REGISTRY_IMAGE:3.6.$CI_PIPELINE_ID
./src/3.6
# Simple test
- docker run -i --rm nest/nest-simulator:3.6 bash /opt/test-nest.sh
tags:
- shell-runner

Deploy_36:
stage: deploy
needs: ["Build_36"]
when: never
script:
- echo -n $DOCKERHUB_REGISTRY_TOKEN | docker login -u $DOCKERHUB_REGISTRY_USER --password-stdin
- docker push nest/nest-simulator:3.6
- docker logout $DOCKERHUB_REGISTRY
only:
- master
tags:
- shell-runner
33 changes: 6 additions & 27 deletions ci-templates/000_dev.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,21 @@ Build_Dev:
rules:
- when: always
script:
- docker pull $DOCKER_REGISTRY_IMAGE:dev || true
- docker pull push nest/nest-simulator:dev || true
- docker build
--cache-from $DOCKER_REGISTRY_IMAGE:dev
--tag $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID
--cache-from nest/nest-simulator:dev
--tag nest/nest-simulator:dev
./src/dev
- docker push $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID
tags:
- shell-runner

Test_Dev:
stage: test
needs: ["Build_Dev"]
rules:
- when: always
script:
- docker pull $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID
- docker stop $(docker ps -q) 2>/dev/null || true
- docker rm -f $(docker ps -aq) 2>/dev/null || true
- docker ps
- docker run -i -d --rm -e NEST_CONTAINER_MODE=nest-server -p 52425:52425
--name $CI_PIPELINE_ID $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID
- docker run -i --rm $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID bash /opt/test-nest.sh
- docker ps
# Simple test
- docker run -i --rm nest/nest-simulator:dev bash /opt/test-nest.sh
tags:
- shell-runner

Deploy_Dev:
stage: deploy
needs: ["Test_Dev"]
when: always
needs: ["Build_Dev"]
script:
- docker pull $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID
- docker tag $DOCKER_REGISTRY_IMAGE:dev.$CI_PIPELINE_ID $DOCKER_REGISTRY_IMAGE:dev
- docker push $DOCKER_REGISTRY_IMAGE:dev
- echo -n $DOCKERHUB_REGISTRY_TOKEN | docker login -u $DOCKERHUB_REGISTRY_USER --password-stdin
- docker tag $DOCKER_REGISTRY_IMAGE:dev nest/nest-simulator:dev
- docker push nest/nest-simulator:dev
- docker logout $DOCKERHUB_REGISTRY
only:
Expand Down
56 changes: 56 additions & 0 deletions src/3.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM docker-registry.ebrains.eu/nest/nest-simulator:nest-simulator-build-base as builder
LABEL maintainer="[email protected]"

ARG NEST_VERSION=3.6
ARG SRC_PATH=/tmp


# Install NEST and NESTML
RUN wget "https://github.com/nest/nest-simulator/archive/refs/tags/v${NEST_VERSION}.tar.gz" -P ${SRC_PATH} && \
cd ${SRC_PATH} && tar -xzf ${NEST_VERSION}.tar.gz && ls -l && \
python3 -m pip install -r ${SRC_PATH}/nest-simulator-${NEST_VERSION}/doc/requirements.txt && \
python3 -m pip install sphinx_gallery==0.10.1

RUN mkdir nest-build && cd nest-build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/nest \
-Dwith-warning=ON \
-Dwith-userdoc=ON \
-Dwith-boost=ON \
-Dwith-ltdl=ON \
-Dwith-gsl=ON \
-Dwith-readline=ON \
-Dwith-python=ON \
-Dwith-mpi=ON \
-Dwith-openmp=ON \
-Dwith-libneurosim=OFF \
-Dwith-music=/opt/music-install \
-Dwith-hdf5=ON \
${SRC_PATH}/nest-simulator-${NEST_VERSION} && \
make -j $(nproc) && \
make docs && \
make install



###############################################################################
# DEPLOY

FROM docker-registry.ebrains.eu/nest/nest-simulator:nest-simulator-deploy-base
LABEL maintainer="[email protected]"

COPY --from=builder /opt/nest /opt/nest
COPY --from=builder /opt/music-install /opt/music-install

RUN python3 -m pip install --upgrade pip && \
python3 -m pip install nest-desktop --pre && \
python3 -m pip uninstall nestml -y && \
python3 -m pip install https://github.com/nest/nestml/archive/refs/heads/master.zip --upgrade

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

COPY test-nest.sh /opt/test-nest.sh
RUN chmod +x /opt/test-nest.sh

EXPOSE 8080 52425 54286
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
55 changes: 55 additions & 0 deletions src/3.6/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
set -e
IP_ADDRESS=$(hostname --ip-address)

# NEST environment
source /opt/nest/bin/nest_vars.sh

# Running NEST to test and to copy the .nestrc into /home/nest
nest --help

export MUSIC_ROOT_DIR=/opt/music-install
export MUSIC_ROOT=${MUSIC_ROOT_DIR}
MUSIC_PATH=${MUSIC_ROOT_DIR}
export LD_LIBRARY_PATH=${MUSIC_PATH}/lib:$LD_LIBRARY_PATH
export PATH=${MUSIC_PATH}/bin:$PATH
export CPATH=${MUSIC_PATH}/include:$CPATH
export PYTHONPATH=${MUSIC_PATH}/lib/python3.8/site-packages:$PYTHONPATH

MODE="${NEST_CONTAINER_MODE:-$1}"
if [[ "${MODE}" = 'interactive' ]]; then
read -p "Your python script: " name
echo Starting: $name
# Start
mkdir -p /opt/data; cd /opt/data
exec python3 /opt/data/$name

elif [[ "${MODE}" = 'jupyterlab' ]]; then
mkdir -p /opt/data; cd /opt/data
exec /usr/local/bin/jupyter-lab --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root

elif [[ "${MODE}" = 'nest-desktop' ]]; then
export NEST_DESKTOP_HOST="${NEST_DESKTOP_HOST:-0.0.0.0}"
export NEST_DESKTOP_PORT="${NEST_DESKTOP_PORT:-54286}"
exec nest-desktop start

elif [[ "${MODE}" = 'nest-server' ]]; then
export NEST_SERVER_HOST="${NEST_SERVER_HOST:-0.0.0.0}"
export NEST_SERVER_MODULES="${NEST_SERVER_MODULES:-nest,numpy}"
export NEST_SERVER_PORT="${NEST_SERVER_PORT:-52425}"
export NEST_SERVER_RESTRICTION_OFF="${NEST_SERVER_RESTRICTION_OFF:-1}"
export NEST_SERVER_STDOUT="${NEST_SERVER_STDOUT:-1}"
exec nest-server start

elif [[ "${MODE}" = 'nest-server-mpi' ]]; then
export NEST_SERVER_HOST="${NEST_SERVER_HOST:-0.0.0.0}"
export NEST_SERVER_PORT="${NEST_SERVER_PORT:-52425}"
exec mpirun -np "${NEST_SERVER_MPI_NUM:-1}" nest-server-mpi

elif [[ "${MODE}" = 'notebook' ]]; then
mkdir -p /opt/data; cd /opt/data
exec jupyter-notebook --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root

else
exec "$@"
fi
13 changes: 13 additions & 0 deletions src/3.6/test-nest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# run mpiexec as root
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

# install what is needed
pip3 install pytest-xdist pytest-timeout junitparser

HDF5_DISABLE_VERSION_CHECK=1

cd /opt/nest/share/nest/testsuite/
bash do_tests.sh --prefix=/opt/nest --with-python=/usr/bin/python

0 comments on commit a72cbf1

Please sign in to comment.