after_success:
  - "if [[ \"$TRAVIS_BRANCH\" == \"master\" && \"$TRAVIS_PULL_REQUEST\" = \"false\" ]]; then make travis-build; fi"
before_install:
  - "rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable"
  - "nvm install 10.17.0"
  - "nvm use 10.17.0 --default"
before_script:
  - "mysql -e 'CREATE DATABASE IF NOT EXISTS test;'"
  - "psql -c 'create database test;' -U postgres"
branches:
  only:
    - master
    - dev
env:
  global:
    - "PATH=$HOME/.local/bin:$PATH"
    - DB_HOST=localhost
    - DB_USER=travis
    - DB_PASS=
    - DB_DATABASE=test
    - GO_ENV=test
    - STATPING_DIR=$GOPATH/src/github.com/statping/statping
go: 1.14
go_import_path: github.com/statping/statping
install:
  - "npm install -g sass newman cross-env wait-on @sentry/cli"
  - "pip install --user awscli"
  - "go get github.com/mattn/goveralls"
  - "go mod download"
  - "go mod verify"
  - "make test-deps yarn clean compile install"
language: go
addons:
  apt:
    packages:
      - libgconf-2-4
matrix:
  allow_failures:
    - go: master
  fast_finish: true
notifications:
  email: true
os:
  - linux
script:
  - "if [[ \"$TRAVIS_BRANCH\" == \"dev\" && \"$TRAVIS_PULL_REQUEST\" = \"false\" ]]; then make dockerhub-dev; fi"
  - "travis_retry make clean test-ci"
  - "if [[ \"$TRAVIS_BRANCH\" == \"master\" && \"$TRAVIS_PULL_REQUEST\" = \"false\" ]]; then make coverage; fi"
services:
  - docker
  - postgresql
  - mysql
  - mongodb
