148 lines
5.1 KiB
YAML
148 lines
5.1 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 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
|
||
|
||
cache:
|
||
# we reuse the image unless the recipe or the scripts change
|
||
# ATTN: This means that updates to software dependencies will not
|
||
# trigger an image update!! If that is desired, the build cache needs
|
||
# to be wiped first:
|
||
# https://www.appveyor.com/docs/build-cache/#cleaning-up-cache
|
||
- icf.sif -> singularity/icf.def, bin/*
|
||
- singularity-container_3.8.7_amd64.deb
|
||
|
||
artifacts:
|
||
- path: icf.sif
|
||
name: ICF utils singularity image
|
||
type: File
|
||
|
||
# In `install` we prep the test system with any non-DataLad tooling
|
||
install:
|
||
- curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -;
|
||
# Bootstrap ICF-like system installation
|
||
- sudo hostname data.inm-icf.de
|
||
- sudo .appveyor/install_apt_pkgs
|
||
- .appveyor/apache_enable_ssl
|
||
- .appveyor/apache_enable_user_dir
|
||
# build the singularity image, unless we got it from the cache
|
||
- sh: "[ ! -f icf.sif ] && singularity build --fakeroot icf.sif singularity/icf.def || true"
|
||
# install image as `icf-utils` (mounting the ICF /data store on-run)
|
||
- sh: echo -e '#!/bin/sh\nset -e -u\nsingularity run -B /data /home/appveyor/projects/inm-icf-utilities/icf.sif "$@"' > icf-utils
|
||
- sudo install -t /usr/bin icf-utils
|
||
|
||
# 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 ICF store
|
||
- sudo mkdir /data/archive
|
||
# we use the 'appveyor' group as a placeholder for the actual ICF group
|
||
# which has write access on the real system
|
||
- sudo chown :appveyor /data/archive
|
||
- sudo chmod g+ws /data/archive
|
||
|
||
# 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
|
||
icf-utils make_studyvisit_archive
|
||
--output-dir "$STUDIES_DIR"
|
||
--id $s $v
|
||
"$FROM_SCANNER";
|
||
done
|
||
done
|
||
# show the full store/incoming content before any DataLad business
|
||
- tree /data/
|
||
|
||
# Create user http content and create links to the studies in.
|
||
- .appveyor/apache_enable_user_dir
|
||
- mkdir ~/public_html
|
||
- sh:
|
||
for s in $STUDIES; do
|
||
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
|
||
|
||
# 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"
|
||
|
||
before_test:
|
||
# simple call to see if datalad and git-annex are installed properly
|
||
- icf-utils datalad wtf
|
||
|
||
|
||
test_script:
|
||
# run tests found in the $PROJECT_ROOT/test directory
|
||
- mkdir __testhome__
|
||
- cd __testhome__
|
||
- 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
|
||
- icf-utils python3 -m pytest -s -v ../tests
|
||
|
||
|
||
on_finish:
|
||
# conditionally block the exit of a CI run for direct debugging
|
||
- sh: while [ -f ~/BLOCK ]; do sleep 5; done
|