# --- Travis config ---

# - runner os. Default on Travis is ubuntu16.04 - 
dist: bionic # 18.04

# - services to start on the runner -
services:
  - docker

# - Default language -
language: python
python: 3.7
sudo: required

# TASK line is of the form <config>:<parameters>
# where <config> is a known config in tasks.py
#
# A job will be created by Travis for each task in the list below.
# 
# TASK line must be of the form <config>:<parameters>
# where :
# - <config> is a known config in tasks.py
# - <parameters> is a list (comma separated) of parameters, each of them being of
# the form <kwd>=<value> or <kwd>+=<values> or <kwd>-=<values>.
# 
# With:
#   - <kwd> is a named keyword accepted by ci_task.copy function
#   - <value> can be:
#       - a string
#       - a list if ',' is present (i.e. "value," is the list [value] of one element)
#
#   - <kwd>+= is the same as add_<kwd>=
#   - <kwd>-= is the same as remove_<kwd>=
#
# If kwd is present several times, associated values must be lists. In
# this case a dictionary is incrementally built with the first element of the list as
# the key, and the remaining as the associated internal value. This
# concerns the targets keyword.
#
# Distributions are passed as lists of two elements, the first element
# is the name and the second the version.

env:
  - TASK=default:distrib=ubuntu,18.04
  - TASK=default:distrib=debian,latest
  - TASK=default:distrib=fedora,30
  - TASK=default:pkgs+=lpsolve,
  - TASK=default:ci_config=with_mumps_par:pkgs+=mumps-par,
  - TASK=default:ci_config=with_umfpack:pkgs+=umfpack,

# not finalized yet
#  - TASK=default:ci_config=nix:distrib=nixos/nix,latest:targets=.,docker-build,docker-cmd:pkgs=cmake,make,siconos-nix-default,

before_script:
  - case $TASK in
      *docker=false*)
        pip install lxml;
        pip install scipy
        ;;
      *)
        pip install pyyaml
        ;;
    esac
  - mkdir -p build
  - cd build

script:
  - if test "$TRAVIS" = true; then
      ../ci_travis/driver.py --run --root-dir=.. --task="$TASK";
    else
      ../ci_travis/driver.py --run --root-dir=..;
    fi

