dist: xenial
version: ~> 1.0
language: php
php:
# the latest and greatest, has some issues that are excluded below in matrix.allow_failures
- 7.3
- 7.2
- 7.1
# the 7.0 build demonstrates that everything is basically ok for 7.0, users might want to wait for 7.1 to run it
- 7.0
# folks who prefer running on 5.x should be using 5.6 in most cases, 5.4 is no in the matrix since noone should use it
- 5.6
services:
- postgresql
- rabbitmq
env:
  global:
  - ENVIRONMENT=testing
  - LIBRETIME_LOG_DIR=/tmp/log/libretime
  jobs:
  - PYTHON=false
  - PYTHON=true
jobs:
  allow_failures:
  # there are currently some testing issues with DateTime precision on 7.1
  - env: PYTHON=false
    php: 7.1
  # there are some issues with phpunit as well as some deep in zf1 on 7.2
  - env: PYTHON=false
    php: 7.2
  # there are some issues with phpunit as well as some deep in zf1 on 7.3
  - env: PYTHON=false
    php: 7.3
  exclude:
  # we need to explicitly exclude python for every version of php other than 7.3 to  make way to just run python tests in one seperate instance
  - env: PYTHON=true
    php: 7.2
  - env: PYTHON=true
    php: 7.1
  - env: PYTHON=true
    php: 7.0
  - env: PYTHON=true
    php: 5.6
  - env: PYTHON=true
    php: 5.4
addons:
  apt:
    packages:
    - silan
    - libgirepository1.0-dev
    - gir1.2-gstreamer-1.0
    - gstreamer1.0-plugins-base
    - gstreamer1.0-plugins-good
    - gstreamer1.0-plugins-bad
    - gstreamer1.0-plugins-ugly
    - libcairo2-dev
    - liquidsoap
    - liquidsoap-plugin-mad
    - liquidsoap-plugin-taglib
    - liquidsoap-plugin-flac
    - liquidsoap-plugin-ogg
    - liquidsoap-plugin-lame
    - liquidsoap-plugin-faad
    - liquidsoap-plugin-vorbis
    - liquidsoap-plugin-opus
    - python3
    - python3-nose
    - python3-gst-1.0
    - python3-magic
    - dos2unix
install:
- >
    if [[ "$PYTHON" == false ]]; then
      composer install
    fi
- >
    if [[ "$PYTHON" == true ]]; then
      pyenv local 3.7
      pip3 install -U pip wheel
      # pip3 install --user mkdocs
      pip3 install --user rgain3
      pushd python_apps/airtime_analyzer
      python3 setup.py install --dry-run --no-init-script
      popd
    fi
before_script:
# prepare the database as per docs/testing.md
- psql -c 'CREATE DATABASE libretime;' -U postgres
- psql -c "CREATE USER libretime WITH PASSWORD 'libretime';" -U postgres
- psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;' -U postgres
- psql -c 'ALTER USER libretime CREATEDB;' -U postgres
- mkdir -p /tmp/log/libretime
script:
- ./travis/php.sh
- ./travis/python.sh
#deploy:
#- provider: pages
#  skip_cleanup: true
#  local_dir: build/docs
#  github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
#  target_branch: master
#  repo: LibreTime/LibreTime.github.io
#  project_name: LibreTime
#  fqdn: libretime.org
#  name: R. LibreTime DocBot
#  on:
#    branch: master
#    condition: $PYTHON = true
#- provider: script
#  skip_cleanup: true
#  script: ./travis/release.sh
#  on:
#    tags: true
#    condition: $PYTHON = true
#- provider: releases
#  skip_cleanup: true
#  api_key: $GITHUB_TOKEN
#  file_glob: true
#  file: build/libretime-*.tar.gz
#  on:
#    tags: true
#    condition: $PYTHON = true