dist: trusty
sudo: true
language: c
services:
- docker

stages:
- test
- build
- name: packaging
  if: branch = master AND type != pull_request AND type != cron
- name: nightlies
  if: branch = master AND type = cron

jobs:
  include:
  - stage: test
    name: C
    install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev
    script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it --enable-plugin-nfacct --enable-plugin-freeipmi --disable-lto && $HOME/netdata/usr/sbin/netdata -W unittest
    env: CFLAGS='-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1'
  - name: coverity
    install: sudo apt-get install -y zlib1g-dev uuid-dev libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev
    script: ./coverity-scan.sh || echo "Coverity failed :("
    env: INSTALL_COVERITY="true"
    if: type = cron

  - stage: build
    name: OSX
    install: brew install fakeroot ossp-uuid
    script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it
    os: osx
  - name: ubuntu 14.04 (not containerized)
    install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot
    script: fakeroot ./netdata-installer.sh --dont-wait --dont-start-it --install $HOME
  - name: ubuntu 18.04
    script: ".travis/containerized_build.sh ubuntu1804"
  - name: CentOS 7
    script: ".travis/containerized_build.sh centos7"
  - name: CentOS 6
    script: ".travis/containerized_build.sh centos6"
  - name: alpine
    script: ".travis/containerized_build.sh alpine"

  - stage: packaging
    name: Create release
    install: sudo apt update -y && sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot python-pip && sudo apt install -y --only-upgrade docker-ce && docker info
    before_script: sudo pip install git-semver
    script: ".travis/releaser.sh"
    git:
      depth: false

  - stage: nightlies
    name: tarball and self-extractor build
    install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
    script: ".travis/firehol_create_artifacts.sh"
  - name: docker images
    install: sudo apt update -y && sudo apt install -y --only-upgrade docker-ce && docker info
    script: "docker/build.sh"
    env: REPOSITORY="netdata/netdata"
  - name: changelog generation
    script: ".travis/generate_changelog.sh"
  - name: labeler # This job should be replaced with GitHub Actions when they hit GA
    script: ".travis/labeler.sh"

notifications:
  webhooks: https://app.fossa.io/hooks/travisci
  slack:
    rooms:
      - secure: "NuW1p7s+WGLcyhEceeiLRSV1JgAc6N47zgdSsYoxrjSFRQHDfc8jensypDcEJwgs1K2Hcve9iKRaAddEHEw7AkS6rie9gFR5HmmbKXfW2GFMqOr6maYTFsvaECPqiWk1n9/XnRLsAi5kZ8HxH+a8ldb/eaVoFQesY1jPXgh11BM5DwvpXjEtwg0WGASsKiymvnXFS3KcC+sR7Lln2GX1a8vfCX2I3TEmOedKMlSHUy5JilGGC3AWA0SWS8tR8PUH0u3dHL5j0RNIr1RO3Yx24QgUpg/YpvKymnW/iIIEOq2vb2mBhhiKEQjJ1djUL4VSPzjIDpUzThVpKaHk3syOp6W9qZEHKhR/sqjc5Yk2XRjsw1cM0nS60gaCgxtKhEMKWcjtvWf04oJAVrmcUwcYXj0eA+jgRCZl5VhyufK/fUJavjOfsQGjwhdjxQfwDCw33W17ypJUt4GZngdb6jbIhEOcKHSLQDu1vuHTw82hJJkthkmR59PX30qJdl/MEGcfVLdN/fkCokjR/qwfmkNwQm+wYSKsK/Jq4RgBT0/oZwY3e8nkCq2ov7lBbDO3/0rzQKWZ9Uy//tnoCM3vGhDwGHQxsHshv7g6KwdhYTcmm7WWWIucfLupcjFUO1HbRuJ+7ZnvxRRwKiV+MGkFT2SNJkS8q1/jCu9KGbmktd0WUSE="
