language: node_js
node_js: "10"
cache:
  yarn: true
branches:
  except:
    - /^v\d/

install:
  - yarn install

jobs:
  include:
    - stage: lint & test
      script:
        - yarn run lint
        - yarn run test

    - stage: lighthouse test
      script:
        - yarn global add firebase-tools
        - yarn run build
        - firebase deploy --token $FIREBASE_TOKEN --project abdonrd-develop
        - yarn run lh https://abdonrd-develop.firebaseapp.com

    - stage: deploy to staging
      script: yarn run build
      deploy:
        provider: firebase
        token: $FIREBASE_TOKEN
        skip_cleanup: true
        project: abdonrd-develop
        on:
          branch: develop

    - stage: deploy to production
      script: yarn run build:production
      deploy:
        provider: firebase
        token: $FIREBASE_TOKEN
        skip_cleanup: true
        project: project-8848054472830093819
        on:
          branch: master

stages:
  - name: lint & test

  - name: lighthouse test
    if: type IN (pull_request)

  - name: deploy to staging
    if: branch = develop AND (NOT type IN (pull_request))
    env: NODE_ENV=staging

  - name: deploy to production
    if: branch = master AND (NOT type IN (pull_request))
    env: NODE_ENV=production

language: node_js
node_js: "10"
cache:
  yarn: true
branches:
  except:
    - /^v\d/

before_install:
  - npm install -g yarn

install:
  - yarn install

jobs:
  include:
    - stage: lint & test
      script:
        - yarn run lint
        - yarn run test

    - stage: lighthouse test
      script:
        - yarn global add firebase-tools
        - yarn run build
        - firebase deploy --token $FIREBASE_TOKEN --project abdonrd-develop
        - yarn run lh https://abdonrd-develop.firebaseapp.com

    - stage: deploy to staging
      script: yarn run build
      deploy:
        provider: firebase
        token: $FIREBASE_TOKEN
        skip_cleanup: true
        project: abdonrd-develop
        on:
          branch: develop

    - stage: deploy to production
      script: yarn run build:production
      deploy:
        provider: firebase
        token: $FIREBASE_TOKEN
        skip_cleanup: true
        project: project-8848054472830093819
        on:
          branch: master

stages:
  - name: lint & test

  - name: lighthouse test
    if: type IN (pull_request)

  - name: deploy to staging
    if: branch = develop AND (NOT type IN (pull_request))
    env: NODE_ENV=staging

  - name: deploy to production
    if: branch = master AND (NOT type IN (pull_request))
    env: NODE_ENV=production

Install yarn with npm to have the last version
Install yarn with npm to have the last version
