# Builds forked-daapd in the latest Ubuntu LTS docker container
# Configuration based on https://romanvm.pythonanywhere.com/post/using-docker-travis-continuous-integration-25/

language: c
sudo: required
dist: xenial

services:
  - docker

env:
  matrix:
    - SH="docker exec -t ubuntu-lts bash -c" CFG=""
    - SH="docker exec -t ubuntu-lts bash -c" CFG="--enable-lastfm --disable-verification"
    - SH="docker exec -t ubuntu-lts bash -c" CFG="--enable-spotify --disable-verification"
    - SH="docker exec -t ubuntu-lts bash -c" CFG="--enable-chromecast --disable-verification"
    - SH="docker exec -t ubuntu-lts bash -c" CFG="--with-pulseaudio --disable-verification"

before_install:
  - docker run -d --name ubuntu-lts -v $(pwd):/travis -w /travis ubuntu:latest tail -f /dev/null
  - docker ps

install:
  - $SH "apt-get -qq update"
  - $SH "apt-get install -y wget gnupg2"
  - $SH "wget -q -O - https://apt.mopidy.com/mopidy.gpg | apt-key add -"
  - $SH "wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/stretch.list"
  - $SH "apt-get -qq update"
  - $SH "DEBIAN_FRONTEND=noninteractive apt-get install -yq build-essential clang clang-tools git autotools-dev autoconf libtool gettext gawk gperf antlr3 libantlr3c-dev libconfuse-dev libunistring-dev libsqlite3-dev libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev libevent-dev libplist-dev libsodium-dev libcurl4-openssl-dev libjson-c-dev libprotobuf-c-dev libpulse-dev libwebsockets-dev libgnutls28-dev libspotify-dev"

script:
  - $SH "autoreconf -fi"
  - $SH "./configure $CFG"
  - $SH "make"
  - $SH "make clean"
  - $SH "scan-build --status-bugs -disable-checker deadcode.DeadStores make"

# Disable email notification
notifications:
  email: false
