# travisci config
env:
  global:
  - MIAB_LDAP_PROJECT=true
  - DOWNLOAD_NEXTCLOUD_FROM_GITHUB=true
  - SKIP_SYSTEM_UPDATE=1

language: shell
os: linux
dist: bionic

jobs:
  fast_finish: true
  include:
  # JOB: MiaB-LDAP connected to a remote Nextcloud
  - env:
      - PRIMARY_HOSTNAME=box1.abc.com
      - FEATURE_MUNIN=false
    name: remote-nextcloud-docker
    before_install:
      - echo "==== ENVIRONMENT ===="
      - env | sort
      - echo "UMASK=$(umask)"
      - echo "==== AppArmor Status ===="
      - (sudo aa-status; true)
      - echo "==== NETWORK INFO ===="
      - hostname -I
      - hostname -i
      - hostname
      - hostname --fqdn
      - ip add
      - sysctl -a 2>/dev/null | grep -i ipv6 | grep disable
    install:
      # setup with 'basic' data before setting up again using
      # a remote nextcloud to verify ownCloud contacts are still
      # available
      - sudo tests/system-setup/remote-nextcloud-docker.sh upgrade basic
    script:
      # launch automated tests, but skip tests that require remote
      # smtp support because Travis-CI blocks outgoing port 25
      - sudo tests/runner.sh -dumpoutput -no-smtp-remote default remote-nextcloud upgrade-basic

  # JOB: Upgrade from upstream install
  - env:
      - PRIMARY_HOSTNAME=box2.abc.com
      - UPSTREAM_TAG=master
    name: upgrade-from-upstream
    install:
      - sudo tests/system-setup/upgrade-from-upstream.sh basic totpuser
    script:
      # launch automated tests, but skip tests that require remote
      # smtp support because Travis-CI blocks outgoing port 25
      - sudo tests/runner.sh -dumpoutput -no-smtp-remote upgrade-basic upgrade-totpuser default

  # JOB: unsetvars
  - env:
      - PRIMARY_HOSTNAME=box3.abc.com
      - NONINTERACTIVE=1
      - PUBLIC_IP=auto
      - PUBLIC_IPV6=auto
      - SKIP_NETWORK_CHECKS=1
    name: unsetvars
    install:
      - sudo setup/start.sh -v -v
      - sudo bash -c '. /etc/mailinabox.conf; . tests/lib/all.sh tests/lib; . tests/system-setup/setup-funcs.sh; init_test_system; init_miab_testing'
    script:
      - sudo tests/runner.sh -dumpoutput -no-smtp-remote default