158 lines
5.4 KiB
YAML
158 lines
5.4 KiB
YAML
# This setup tests ICF-related software and workflows. There are two elements
|
||
# that have to be kept aligned with ICF's environment:
|
||
#
|
||
# 1. The input data structure should match the data that ICF receives from
|
||
# acquisition sides.
|
||
#
|
||
# 2. The software environment should match the environment on ICF's machines,
|
||
# i.e. the versions of: `git`, `git-annex`, `python`, `datalad`, and
|
||
# `datalad-next`.
|
||
|
||
|
||
# This version of Ubuntu is based on debian bullseye
|
||
image: Ubuntu2004
|
||
|
||
hosts:
|
||
data.inm-icf.de: 127.0.0.2
|
||
|
||
environment:
|
||
# Set this to `post-install` to activate the ssh login after the
|
||
# install-steps are executed.
|
||
# Set it to 'pre-tests' to activate ssh login just before the tests are
|
||
# executed.
|
||
# This requires setting `APPVEYOR_SSH_KEY` and `APPVEYOR_SSH_BLOCK`
|
||
ACTIVATE_SSH_LOGIN: no
|
||
|
||
# The following variables should be kept in sync with INM-ICF's
|
||
# system configuration.
|
||
ICF_PYTHON_VERSION: 3.9
|
||
ICF_GIT_VERSION: 2.30.2
|
||
ICF_GIT_ANNEX_VERSION: 10.20221003
|
||
|
||
INSTALL_GITANNEX: git-annex -m snapshot
|
||
|
||
# The root for study data and the studies that we simulate. These variables
|
||
# are available throughout ``install:´´ and in the executed scripts.
|
||
FROM_SCANNER: /data/incoming
|
||
STUDIES_DIR: /data/archive
|
||
STUDIES: "study_1 study_2"
|
||
|
||
skip_commits:
|
||
files:
|
||
- docs/
|
||
- README.md
|
||
- .readthedocs.yaml
|
||
|
||
# In `install` we prep the test system with any non-DataLad tooling
|
||
install:
|
||
# Bootstrap ICF-like system installation
|
||
- sudo .appveyor/install_apt_pkgs
|
||
- .appveyor/apache_enable_user_dir
|
||
# Install tooling for data ingestion.
|
||
# ICF uses a system installation via APT. Here we only match the respective
|
||
# versions of Debian bullseye (the Ubuntu 2004 base image is too old)
|
||
- sudo python3 -m pip install pydicom==2.0.0 tqdm==4.57.0
|
||
|
||
# Bootstrap ICF data organization
|
||
# Create data input directory and populate it
|
||
- sudo mkdir -p "$FROM_SCANNER"
|
||
- sh:
|
||
for s in $STUDIES; do
|
||
sudo .appveyor/data_create_scanner_output $FROM_SCANNER $s 10 20;
|
||
done
|
||
# Create study directories
|
||
- sh:
|
||
for s in $STUDIES; do
|
||
sudo mkdir -p "$STUDIES_DIR"/$s;
|
||
done
|
||
# Create user http content and create links to the studies in. The http server
|
||
# is configured to follow only links if the owner of the link matches the
|
||
# owner of the target. Therefore, user ``root´´ has to create the links.
|
||
- mkdir ~/public_html
|
||
- sh:
|
||
for s in $STUDIES; do
|
||
sudo ln -s "$STUDIES_DIR"/$s /home/appveyor/public_html/$s;
|
||
done
|
||
# Enable basic authentication and authorization for the study directories. The
|
||
# username is ``test.user´´, the password is ``secret_1´´.
|
||
- sh:
|
||
.appveyor/apache_enable_authentication
|
||
$STUDIES_DIR
|
||
test.user secret_1
|
||
$STUDIES
|
||
|
||
# Run the non-DataLad DICOM data ingestion script. Create two visits, i.e.
|
||
# ``visit_a´´ and ``visit_b´´, for each study defined in ${STUDIES}
|
||
- sh:
|
||
for s in $STUDIES; do
|
||
for v in visit_a visit_b; do
|
||
sudo bin/make_studyvisit_archive
|
||
--output-dir "$STUDIES_DIR"
|
||
--id $s $v
|
||
"$FROM_SCANNER";
|
||
done
|
||
done
|
||
|
||
# Enable external SSH access to CI worker on all other systems. This uses the
|
||
# public key defined in APPVEYOR_SSH_KEY. If APPVEYOR_SSH_BLOCK is ``true´´,
|
||
# the worker waits with the continuation of the build beyond this point until
|
||
# the file ``~/build.lock´´ is removed.
|
||
- sh:
|
||
if [ X"$ACTIVATE_SSH_LOGIN" == "Xpost-install" ]; then
|
||
curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -;
|
||
fi
|
||
|
||
|
||
# Disable automatic builds with MSBuild, we use custom build steps instead.
|
||
build: off
|
||
|
||
|
||
# In `build` and `*test*` we perform the actual deployment and validation
|
||
# of the DataLad-tooling
|
||
build_script:
|
||
# Set up git identification
|
||
- git config --global user.email "test@appveyor.land"
|
||
- git config --global user.name "Appveyor Almighty"
|
||
# Enable "next" extension for patching datalad core
|
||
- git config --global datalad.extensions.load next
|
||
|
||
# install into virtual env that matches the Python version on the ICF system
|
||
- . ~/venv3.9/bin/activate
|
||
# Install requirements
|
||
# git-annex
|
||
- .appveyor/install_git_annex ${INSTALL_GITANNEX}
|
||
# enable the git-annex provisioned by the installer
|
||
- "[ -f ${HOME}/dlinstaller_env.sh ] && . ${HOME}/dlinstaller_env.sh || true"
|
||
# all remaining deps after git-annex
|
||
- python -m pip install -r requirements-devel.txt
|
||
|
||
# Check program versions and report
|
||
- .appveyor/check_versions --warn-only ${ICF_PYTHON_VERSION} ${ICF_GIT_VERSION} ${ICF_GIT_ANNEX_VERSION}
|
||
|
||
|
||
before_test:
|
||
# simple call to see if datalad and git-annex are installed properly
|
||
- datalad wtf
|
||
|
||
|
||
test_script:
|
||
# run tests found in the $PROJECT_ROOT/test directory
|
||
- mkdir __testhome__
|
||
- cd __testhome__
|
||
- which python
|
||
- python --version
|
||
- sh:
|
||
if [ X"$ACTIVATE_SSH_LOGIN" == "Xpre-tests" ]; then
|
||
curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -;
|
||
fi
|
||
- python -m pytest -s -v ../tests
|
||
- sh:
|
||
if [ X"$ACTIVATE_SSH_LOGIN" == "Xpost-tests" ]; then
|
||
curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -;
|
||
touch $HOME/build.lock;
|
||
while [ -e $HOME/build.lock ]; do sleep 5; done;
|
||
fi;
|
||
|
||
# artifacts:
|
||
# - path: /data/archive/study_1/catalog
|
||
# name: TestCatalog
|