<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'
  variables:
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: yarn test-unit --forbid-only
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'
  - script: |
      NODE_PATH=$(pwd)/out ./node_modules/.bin/nyc ./node_modules/.bin/mocha './out/*test.js' './out/**/*test.js'
      ./node_modules/.bin/nyc report --reporter=cobertura
    displayName: 'Coverage report'
  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
    displayName: 'Publish coverage'
  - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@6
    displayName: 'Check build quality'
    inputs:
      checkCoverage: true
      coverageType: lines
      coverageThreshold: 60
      coverageFailOption: fixed

- job: macOS
  pool:
    vmImage: 'xcode9-macos10.13'
  variables:
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - 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'
  variables:
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - 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'
  variables:
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn start &
      sleep 10
      yarn test-api --headless --forbid-only
    displayName: 'Linux Integration tests'

- job: macOS_IntegrationTests
  pool:
    vmImage: 'xcode9-macos10.13'
  variables:
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn start &
      sleep 10
      yarn test-api --headless --forbid-only
    displayName: 'MacOS Integration tests'

- job: Release
  dependsOn:
  - Linux
  - macOS
  - Windows
  - Linux_IntegrationTests
  - macOS_IntegrationTests
  condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['FORCE_RELEASE'], 'true')))
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js
    displayName: 'Package and publish to npm'<commit_msg>New cache key<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'
  variables:
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn1 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: yarn test-unit --forbid-only
    displayName: 'Unit tests'
  - script: yarn lint
    displayName: 'Lint'
  - script: |
      NODE_PATH=$(pwd)/out ./node_modules/.bin/nyc ./node_modules/.bin/mocha './out/*test.js' './out/**/*test.js'
      ./node_modules/.bin/nyc report --reporter=cobertura
    displayName: 'Coverage report'
  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
    displayName: 'Publish coverage'
  - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@6
    displayName: 'Check build quality'
    inputs:
      checkCoverage: true
      coverageType: lines
      coverageThreshold: 60
      coverageFailOption: fixed

- job: macOS
  pool:
    vmImage: 'xcode9-macos10.13'
  variables:
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn1 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - 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'
  variables:
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn1 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - 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'
  variables:
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn1 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn start &
      sleep 10
      yarn test-api --headless --forbid-only
    displayName: 'Linux Integration tests'

- job: macOS_IntegrationTests
  pool:
    vmImage: 'xcode9-macos10.13'
  variables:
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: CacheBeta@1
    inputs:
      key: yarn1 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: |
      yarn start &
      sleep 10
      yarn test-api --headless --forbid-only
    displayName: 'MacOS Integration tests'

- job: Release
  dependsOn:
  - Linux
  - macOS
  - Windows
  - Linux_IntegrationTests
  - macOS_IntegrationTests
  condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['FORCE_RELEASE'], 'true')))
  pool:
    vmImage: 'ubuntu-16.04'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '8.x'
    displayName: 'Install Node.js'
  - task: YarnInstaller@3
    inputs:
      versionSpec: '1.x'
    displayName: 'Install Yarn'
  - task: CacheBeta@1
    inputs:
      key: yarn1 | $(Agent.OS) | yarn.lock
      path: node_modules
    displayName: Cache Yarn packages
  - script: yarn --frozen-lockfile
    displayName: 'Install dependencies and build'
  - script: NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js
    displayName: 'Package and publish to npm'
{'fraction_non_alphanumeric': 0.11291018998272884, 'fraction_numerical': 0.01468048359240069, 'mean_word_length': 2.8749477206189877, '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': '2053266', 'n_tokens_mistral': 3287, 'n_tokens_neox': 3130, 'n_words': 777}