parameters:
  name: ''
  vmImage: ''

jobs:
- job: ${{ parameters.name }}
  pool:
    vmImage: ${{ parameters.vmImage }}
  strategy:
    matrix:
      node8:
        nodeVersion: 8.x
      node10:
        nodeVersion: 10.x
      node11:
        nodeVersion: 11.x
  steps:
  - task: NodeTool@0
    displayName: Use Node
    inputs:
      versionSpec: $(nodeVersion)
      checkLatest: true

  - task: Npm@1
    displayName: npm install
    inputs:
      verbose: false

  - task: Gulp@0
    displayName: gulp build
    inputs:
      targets: build
      publishJUnitResults: true

  - task: Npm@1
    displayName: npm test
    inputs:
      command: custom
      verbose: false
      customCommand: test

  - task: Gulp@0
    displayName: gulp tslint
    inputs:
      targets: tslint

  - ${{ if eq(parameters.name, 'Windows') }}:
    - task: RichCodeNavIndexer@0
      continueOnError: true
      inputs:
        serviceConnection: 'rich-nav'
        githubServiceConnection: 'Github connection 1'
        languages: 'typescript'
