Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server: Transition plugin from Girder 2.x to Girder 3.x #78

Merged
merged 4 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
204 changes: 44 additions & 160 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,171 +1,55 @@
version: 2

---
version: 2.1
jobs:

build:
test:
docker:
- image: circleci/python:2.7
- image: mongo:3.6

working_directory: /home/circleci/project # as $CIRCLE_WORKING_DIRECTORY

environment:
- GIRDER_VERSION: 5cac713462c32b9b4704bc89df5638d3ae875d5e
- image: girder/girder_test:latest
- image: circleci/mongo:4.0-ram
command: ["mongod", "--storageEngine", "ephemeralForTest", "--dbpath", "/dev/shm/mongo"]

steps:
- checkout
- run:
name: Install Node.js
command: |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g npm
- run:
name: Install Girder dependencies
command: sudo apt-get install -y cmake

- run:
name: Clone Girder
#command: git clone --depth 1 --branch $GIRDER_VERSION -- https://github.com/girder/girder.git girder
command: |
git clone https://github.com/girder/girder.git girder
git -C girder checkout $GIRDER_VERSION

- run:
name: Create and activate virtualenv
command: |
virtualenv venv
echo "source $CIRCLE_WORKING_DIRECTORY/venv/bin/activate" >> $BASH_ENV

- run:
name: Install Girder
command: |
pip install -e .
pip install -r ./requirements-dev.txt
# pytest_girder requires that install be run from this directory
working_directory: girder

- checkout:
path: girder/plugins/slicer_package_manager

- run:
name: Install slicer_package_manager
command: girder-install plugin girder/plugins/slicer_package_manager

- restore_cache:
key: npm-{{ arch }}-{{ checksum "girder/package.json" }}-{{ checksum "girder/plugins/slicer_package_manager/plugin.json" }}

- run:
name: Build Girder web client
command: girder-install web --dev --plugins=slicer_package_manager
environment:
- npm_config_cache: /home/circleci/project/npm_cache
- save_cache:
paths: npm_cache
key: npm-{{ arch }}-{{ checksum "girder/package.json" }}-{{ checksum "girder/plugins/slicer_package_manager/plugin.json" }}
name: Run server tests
command: tox

- run:
name: Create Girder build directory
command: mkdir girder_build
- run:
name: Run CMake
command: |
cmake -DPYTHON_COVERAGE:BOOL=ON -DCOVERAGE_MINIMUM_PASS:STRING=40 -DPYTHON_VERSION:STRING=2.7 \
-DRUN_CORE_TESTS:BOOL=OFF -DTEST_PLUGINS:STRING="slicer_package_manager" $CIRCLE_WORKING_DIRECTORY/girder
make
working_directory: girder_build
test-cli:
docker:
- image: circleci/python:3.8
- image: circleci/mongo:4.0-ram
command: ["mongod", "--storageEngine", "ephemeralForTest", "--dbpath", "/dev/shm/mongo"]

steps:
- checkout
- run:
name: Run CTest
command: ctest -V -R slicer_package_manager
working_directory: girder_build

name: Install pytest_girder
command: pip install pytest_girder
- run:
name: Install python_client
command: pip install -e .
working_directory: girder/clients/python

name: Install server plugin
command: pip install .
- run:
name: Install slicer_package_manager_client
name: Install CLI
command: pip install -e .
working_directory: girder/plugins/slicer_package_manager/python_client

- run:
name: Start & configure the server and run python client Tests
command: |
girder-server &
echo "SLEEPING"
exit=0
num=0
while [ $exit -ne 1 ]; do
sleep 10
if curl -X GET --header 'Accept: application/json' \
--header 'Girder-Token: xHoENAkEUNo8Ye0N33Kccm9ihdEQlJv8AkLmagAEsGNxXPoixXUTu2XrWsPAltkz' \
'http://127.0.0.1:8080/api/v1/system/check?mode=basic'; then
exit=1
fi;
num=$(($num + 10))
if (($num > 100)); then
echo "TIMEOUT"
exit 1
fi;
done
echo "SERVER READY"
python config.py
sleep 50

pytest --tb=long test_python_client.py
pytest --tb=long test_client_cli.py
. slicer_package_manager_client_test.sh

working_directory: girder/plugins/slicer_package_manager/plugin_tests/python_client_tests

- setup_remote_docker

- run:
name: Install Docker client
command: |
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
sudo mv /tmp/docker/* /usr/bin

- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/bin

- run:
name: Build the image and run the docker container
command: docker-compose up -d
working_directory: girder/plugins/slicer_package_manager

- run:
name: Loop until the Girder server is ready to be used
command: |
echo "SLEEPING"
exit=0
num=0
while [ $exit -ne 1 ]; do
sleep 120
if docker exec slicerpackagemanager_girder_1 curl -X GET --header 'Accept: application/json' \
--header 'Girder-Token: xHoENAkEUNo8Ye0N33Kccm9ihdEQlJv8AkLmagAEsGNxXPoixXUTu2XrWsPAltkz' \
'http://0.0.0.0:8080/api/v1/system/check?mode=basic'; then
exit=1
fi;
num=$(($num + 120))
if (($num > 600)); then
echo "TIMEOUT"
exit 1
fi;
done
echo "SERVER READY"

- run:
name: Stop the docker container
command: |
cd girder/plugins/slicer_package_manager

docker-compose stop
working_directory: python_client
- run:
name: Run CLI tests
command: pytest --tb=long
working_directory: plugin_tests

workflows:
version: 2
ci:
jobs:
- test
- test-cli
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- test
- test-cli
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
root = true

[*]
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.py]
indent_size = 4
max_line_length = 100

[*.js]
indent_size = 4

[*.json]
indent_size = 4

[*.pug]
indent_size = 2

[*.styl]
indent_size = 2

[*.yml]
indent_size = 2
37 changes: 0 additions & 37 deletions .flake8

This file was deleted.

77 changes: 55 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,58 @@
# Build outputs
build/
docs/_build
docs/_output
girder-*.tar.gz
node_modules/
*.egg-info

# Toolchain generated
__pycache__
.eslintcache
/npm-debug.log
.vagrant
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
**/*.retry
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# pyenv
.python-version

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# IDE / OS generated
.DS_Store
.idea/
.PyCharm50/
.*.swo
.*.swp
# IDE junk
.idea/*
*.swp
.vscode/*

# Dev tools
docs/*.sh
# External data
tests/.external_data
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
#
# docker exec -ti $(docker-compose ps -q NAME) /bin/bash
#
FROM girder/girder:latest
FROM girder/girder:3.1.0-py3
MAINTAINER Kitware, Inc. <kitware@kitware.com>

RUN pip install girder-client ansible
RUN ansible-galaxy install girder.girder

COPY server /girder/plugins/slicer_package_manager/server/
COPY web_client /girder/plugins/slicer_package_manager/web_client/
COPY plugin.cmake /girder/plugins/slicer_package_manager/
COPY plugin.json /girder/plugins/slicer_package_manager/
COPY README.rst /girder/plugins/slicer_package_manager/
COPY MANIFEST.in /slicer_package_manager/MANIFEST.in
COPY README.rst /slicer_package_manager/README.rst
COPY setup.cfg /slicer_package_manager/setup.cfg
COPY setup.py /slicer_package_manager/setup.py
COPY slicer_package_manager /slicer_package_manager/slicer_package_manager

RUN girder-install web --dev --plugins slicer_package_manager
RUN pip install /slicer_package_manager

RUN girder build