# https://app.travis-ci.com/mpi4py/mpi4py

language: python
python:
  - "2.7"
  - "3.5"
  - "3.6"
  - "3.7"
  - "3.8"
  - "3.9"
 #- "3.10"
arch:
  - arm64
  - ppc64le

os: linux
dist: xenial
sudo: required

env:
  global:
    - HYDRA_LAUNCHER=fork
    - OMPI_MCA_plm=isolated
    - OMPI_MCA_rmaps_base_oversubscribe=true
  matrix:
    - MPI=mpich
    - MPI=openmpi

branches:
  only:
    - master
    - maint
    - ci/all
    - ci/travis

git:
  depth: 3

cache:
  apt: true

addons:
  apt:
    update: true
  homebrew:
    update: true

before_install:
  - python -m pip install Cython
  - python -m pip install numpy
  - source .azure/install-$MPI.sh
  - python --version
  - python -m cython --version
  - python -c "import numpy;print(numpy.__version__)"
  - if [[ "$MPI" == "mpich"   ]]; then mpichversion; fi
  - if [[ "$MPI" == "openmpi" ]]; then ompi_info;    fi
install:
  - python -m pip -vvv install .

before_script:
  - echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
  - if [[ "$MPI" == "mpich" ]]; then P=2; else P=5; fi
script:
  - mpiexec -n 1  python $PWD/test/runtests.py -v
  - mpiexec -n $P python $PWD/test/runtests.py -v -f -e spawn
  - mpiexec -n 1  python $PWD/demo/futures/test_futures.py -v
  - mpiexec -n $P python $PWD/demo/futures/test_futures.py -v
  - mpiexec -n 1  python -m mpi4py.futures $PWD/demo/futures/test_futures.py -v
  - mpiexec -n $P python -m mpi4py.futures $PWD/demo/futures/test_futures.py -v

#notifications:
#  email: false
