sudo: required
language: node_js
cache: yarn
node_js:
  - 8
  - 9
install:
  - sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
  - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
  - sudo apt-get update -qq
  - sudo apt-get install -y -qq yarn=1.5.1-1
script:
  - yarn test

sudo: required
language: node_js
before_install:
  - sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
  - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
  - sudo apt-get update -qq
  - sudo apt-get install -y -qq yarn=1.5.1-1
cache: yarn
node_js:
  - 8
  - 9
install:
  - yarn
script:
  - yarn test

Move installation of yarn to before_install
CI: Move installation of yarn to before_install
