sudo: required
dist: trusty

addons:
  apt:
    sources:
      - chef-current-trusty
    packages:
      - chefdk

# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"

branches:
  only:
    - master

services: docker

env:
  matrix:
  - INSTANCE=default-debian-9
  - INSTANCE=default-ubuntu-1804

before_script:
  - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
  - eval "$(chef shell-init bash)"
  - CHEF_LICENSE=accept-no-persist chef --version
  - cookstyle --version
  - foodcritic --version

script: CHEF_LICENSE=accept-no-persist KITCHEN_LOCAL_YAML=.kitchen.dokken.yml kitchen test ${INSTANCE}

matrix:
  include:
    - script:
      - CHEF_LICENSE=accept-no-persist chef exec delivery local all
      env: UNIT_AND_LINT=1
