branches:
    only:
        - master
        - /^v\d/
        - /-dev$/

notifications:
        email: false

sudo: required

language: perl

dist: trusty

perl:
    - "5.10"
    - "5.14"
    - "5.18"
    - "5.20"
    - "5.22"
#   - "5.24"
#   - "5.26"

before_install:
    - sudo sh -c 'echo "deb http://ppa.launchpad.net/gluster/glusterfs-3.8/ubuntu trusty main" >> /etc/apt/sources.list'
    - sudo sh -c 'echo "deb-src http://ppa.launchpad.net/gluster/glusterfs-3.8/ubuntu trusty main" >> /etc/apt/sources.list'
    - chmod 0600 ~/.gnupg/gpg.conf
    - chmod 0700 ~/.gnupg
    - gpg --keyserver pgpkeys.mit.edu --recv-key 13E01B7B3FE869A9
    - gpg -a --export 13E01B7B3FE869A9 | sudo apt-key add -
    - sudo apt-get update
    - sudo apt-get install -y glusterfs-server glusterfs-client libacl1 attr
    - sudo dpkg-query -L glusterfs-server
    - sudo dpkg-query -L glusterfs-client
    - sudo update-rc.d glusterfs-server defaults
    - sudo sh -c 'echo "node1	127.0.0.1" >> /etc/hosts'
    - sudo gluster peer probe node1
    - sudo mkdir -p /{export,mnt}/libgfapi-perl
    - sudo chmod -R 777 /{export,mnt}/libgfapi-perl
    - sudo gluster volume create libgfapi-perl transport tcp node1:/export/libgfapi-perl force
    - sudo gluster volume start libgfapi-perl
    - sudo gluster volume set libgfapi-perl allow-insecure on
    - sudo gluster volume status libgfapi-perl detail
    - sudo mount -t glusterfs -o log-level=DEBUG node1:/libgfapi-perl /mnt/libgfapi-perl
    - sudo ls -al /mnt/libgfapi-perl

install:
    - cpanm --quiet --notest --skip-satisfied --installdeps .

script:
    - perl Makefile.PL
    - make && make test TEST_VERBOSE=1 TEST_FUNCTION=1