# CI Config for ltaftpy / gitlab
stages:
  - build
  - test

# Global runner/docker image definition
image: ubuntu:latest

# Global caching 
cache:
  key: "cache"
  paths:
# apt
    - apt-cache
# build
    - build
  
before_script:
  - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
  - export SITE_PACKAGES=`pwd`/site_packages && mkdir -pv $SITE_PACKAGES
  - rm -rf $SITE_PACKAGES
#  - export PYTHONPATH=$PYTHONPATH:$SITE_PACKAGES
#  - export PATH=$PATH:$SITE_PACKAGES
  - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake libfftw3-dev
  - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y liblapack-dev python3.5 python3.5-dev python3-pip
  - pip3 install --upgrade pip
#  - pip3 install --target=$SITE_PACKAGES scipy matplotlib
  - pip3 install scipy matplotlib nose coverage

# Main build 
build: 
  stage: build
  tags:
    - docker
  script:
    - pip3 install -e .

# Tests 
test:
  stage: test
  tags:
    - docker
  dependencies:
    - build
  script:
    - nosetests
  artifacts:
    paths:
      # Tests report
      - build/nosetests.xml
      # Tests coverage report
      - build/htmlcov/
    expire_in: 8d