<commit_before># Node.js
# Build a general Node.js application with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/vsts/pipelines/languages/javascript

jobs:
- job: Linux
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn test-unit-coverage --forbid-only
      EXIT_CODE=$?
      ./node_modules/.bin/nyc report --reporter=cobertura
      exit $EXIT_CODE
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'
  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
    displayName: 'Publish coverage'

- job: macOS
  pool:
    vmImage: 'xcode9-macos10.13'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: yarn test-unit --forbid-only
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'

- job: Windows
  pool:
    vmImage: 'vs2017-win2016'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: yarn test-unit --forbid-only
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'

- job: Linux_IntegrationTests
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn start &
      sleep 10
    displayName: 'Start test server'
  - script: yarn test-api-chromium --headless --forbid-only
    displayName: 'Integration tests (Chromium)'

- job: macOS_IntegrationTests<commit_msg>Install deps for webkit and firefox on Linux<commit_after># Node.js
# Build a general Node.js application with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/vsts/pipelines/languages/javascript

jobs:
- job: Linux
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn test-unit-coverage --forbid-only
      EXIT_CODE=$?
      ./node_modules/.bin/nyc report --reporter=cobertura
      exit $EXIT_CODE
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'
  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
    displayName: 'Publish coverage'

- job: macOS
  pool:
    vmImage: 'xcode9-macos10.13'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: yarn test-unit --forbid-only
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'

- job: Windows
  pool:
    vmImage: 'vs2017-win2016'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: yarn test-unit --forbid-only
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'

- job: Linux_IntegrationTests
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '10.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn2 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache node modules
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn start &
      sleep 10
    displayName: 'Start test server'
  - name: install required packages
    run: |
      sudo apt update
      sudo apt install libwoff1 libopus0 libwebp6 libwebpdemux2 libenchant1c2a libgudev-1.0-0 libsecret-1-0 libhyphen0 libgdk-pixbuf2.0-0 libegl1 libgles2 libevent-2.1-6 libnotify4 libxslt1.1
  - script: yarn test-api-chromium --headless --forbid-only
    displayName: 'Integration tests (Chromium)'
  - run: xvfb-run --auto-servernum -- bash -c "yarn test-api-firefox --headless --forbid-only"
    displayName: 'Integration tests (Firefox)'
    env:
      DEBUG: "*"
  - run: xvfb-run --auto-servernum -- bash -c "yarn test-api-webkit --headless --forbid-only"
    displayName: 'Integration tests (Webkit)'
    env:
      DEBUG: "*"

- job: macOS_IntegrationTests
{'fraction_non_alphanumeric': 0.11202792764201841, 'fraction_numerical': 0.018882894319263727, 'mean_word_length': 2.792418772563177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5141395', 'n_tokens_mistral': 2236, 'n_tokens_neox': 2123, 'n_words': 561}