###################
# This is property of eXtremeSHOK.com
# You are free to use, modify and distribute, however you may not remove this notice.
# Copyright (c) Adrian Jon Kriel :: admin@extremeshok.com
# License: BSD (Berkeley Software Distribution)
##################
language: bash

# Required travis ci environment variables
#ci_securiteinfo_authorisation_signature=[secure]
#ci_malwarepatrol_receipt_code=[secure]
#ci_malwarepatrol_product_code=[secure]
#ci_malwarepatrol_list=[secure]
#ci_malwarepatrol_free=[secure]


#Enable modern build platform, not container based.
sudo: required
dist: bionic

# Apparently caching is disabled, since we used modern build platform as we require clamav and sudo ;/
# caching the /var/lib/clamav/ will save +/-9mins of run time and allow the use of freshclam signatures

#Enable Caching
#cache:
#  directories:
#    - tmp/cache

before_install:
  - sudo apt-get update -qq
  - sudo apt-get install -y ca-certificates curl wget rsync p7zip-full shellcheck -qq
  #- sudo pip install bashate
  # - "sudo mkdir -p tmp/cache/"
  # - "ls -laFh tmp/cache/clamav-dbs"
  # - "sudo rsync -rlptDv tmp/cache/  /var/lib/clamav/"
  # - "sudo freshclam"
  # - "ls -laFh /var/lib/clamav/"
  # - "sudo rsync -rlptDav /var/lib/clamav/ tmp/cache/"
  # - "sudo chown -R travis:travis tmp/cache"
  # - "sudo chmod -R 777 tmp/cache/"
  # - "ls -laFh tmp/cache/clamav-dbs/"

install:
  - sudo mkdir -p /etc/clamav-unofficial-sigs
  - sudo cp -f config/master.conf /etc/clamav-unofficial-sigs/master.conf
  - sudo cp -f config/os/os.ubuntu.conf /etc/clamav-unofficial-sigs/os.conf
  - sudo cp -f clamav-unofficial-sigs.sh /usr/sbin/clamav-unofficial-sigs

script:
  - sudo sh -e .t/ci-shellcheck.sh
  - sudo sh -e .t/ci-clamav-download-default-databases.sh
  #- sudo sh -e .t/ci-clamav-download-default-databases-git.sh
  - sudo sh -e .t/ci-clamav-install-default.sh
  - sudo sh -e .t/ci-clamav-install-default-database.sh
  - sudo cp -f .t/tests/user.conf /etc/clamav-unofficial-sigs/user.conf
  - sudo sh -e .t/ci-test.sh

addons:
  code_climate:
    repo_token: 270be84579d01fcbe78b21b91719c2c55cd627f074c8abb83699a8319c980b60
