image: continuumio/miniconda:latest

variables:
  CONDA_PKGS_DIRS: "${CI_PROJECT_DIR}/conda/pkgs"
  GIT_SUBMODULE_STRATEGY: recursive

cache:
  paths:
    - $CONDA_PKGS_DIRS

before_script:
  - apt-get update -y && apt-get -y install libgl1-mesa-glx
  - conda update -y conda
  - mkdir -p /usr/share/man/man1mkdir -p /usr/share/man/man1
  - apt-get -y install -f openjdk-11-jre-headless texlive-latex-extra dvipng
  - conda env create -f environment.yml
  - source activate resultsanalysis
  - ls
  - cd ../
  - if [[ ! -d 'xmlvalidator' ]]; then git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/utils/xmlvalidator.git; fi
  - cd xmlvalidator
  - pip install .
  - cd ../
  - if [[ ! -d 'resultsanalysis' ]]; then git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/utils/resultsanalysis.git; fi
  - cd resultsanalysis
  - pip install .
  - cd ../
  - if [[ ! -d 'phasexmlparser' ]]; then rm -r phasexmlparser; fi
  - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/utils/phasexmlparser.git
  - cd phasexmlparser
  - pip install .
  - cd ../
  - if [[ ! -d 'phasexmlcreator' ]]; then git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/ssimpleapps/phasexmlcreator.git; fi
  - cd phasexmlcreator
  - pip install .
  - cd ../
  - if [[ ! -d 'puresolventinformation' ]]; then git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/ssimpleapps/puresolventinformation.git; fi
  - cd puresolventinformation
  - pip install .
  - cd ../
  - if [[ -d 'solventmapcreator' ]]; then rm -r solventmapcreator; fi
  - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/ssimpleapps/solventmapcreator.git
  - cd solventmapcreator
  - pip install .
  - cd ../phasecalculator


unittest:
  script:
    - pytest phasecalculator/test/*test/*test.py
