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

# 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
  - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake libfftw3-dev liblapack-dev
  - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y python3.5 python3.5-dev python3-pip python3-tk
  - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y python3-matplotlib
  - pip3 install --upgrade pip
  - pip3 install scipy nose coverage pytest pytest-cov Sphinx sphinxcontrib-bibtex
  - pip3 list

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

# Tests 
#test:
#  stage: test
#  tags:
#    - docker
#  script:
#    - pip3 install -e .
#    - nosetests
#  artifacts:
#    when: always
#    untracked: true
#    paths:
#      - build/
#    expire_in: 8d

# Doc generation
pages:
  stage: doc
  tags:
    - docker
  script:
    - pip3 install -e .
    - python3 setup.py build_sphinx
    - cp -r build/sphinx/html public
  artifacts:
    paths:
      - public
