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 
  - mkdir -p /usr/share/man/man1mkdir -p /usr/share/man/man1
  - apt-get -y install -f openjdk-16-jre-headless texlive-latex-extra dvipng
  - conda env create -f environment.yml
  - source activate resultsanalysis
  - conda install -c conda-forge phasexmlparser
  - ls
  - 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 'phasexmlcreator' ]]; then rm -r phasexmlcreator; fi
  - git clone git@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/ssimpleapps/phasexmlcreator.git
  - cd phasexmlcreator
  - pip install .
  - cd ../
  - if [[ -d 'puresolventinformation' ]]; then rm -r puresolventinformation; fi
  - git clone git@gitlab.developers.cam.ac.uk/ch/hunter/ssiptools/ssimpleapps/puresolventinformation.git
  - cd puresolventinformation
  - pip install .
  - cd ../
  - if [[ -d 'solventmapcreator' ]]; then rm -r solventmapcreator; fi
  - git clone git@gitlab.developers.cam.ac.uk:ch/hunter/ssiptools/ssimpleapps/solventmapcreator.git
  - cd solventmapcreator
  - pip install . --no-deps
  - cd ../phasecalculator
  - pip install . --no-deps


unittest:
  script:
    - pytest --pyargs phasecalculator
