name: $(BuildID)

resources:
  repositories:
    - repository: apt
      type: github
      name: futagoza/apt
      endpoint: futagoza

variables:
- group: 'env-variables'

jobs:

- template: eslint.yml@apt

- template: node-test.yml@apt
  parameters:
    after:
    - script: yarn coverage
      displayName: 'Publish code coverage results (coveralls.io)'
      env:
        COVERALLS_SERVICE_NAME: $(COVERALLS_SERVICE_NAME)
        COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
        GIT_BRANCH: $(Build.SourceBranch)
        GIT_COMMIT_SHA: $(Build.SourceVersion)
    publish_test_results_to_pipelines: True
    publish_code_coverage_to_pipelines: True

name: $(BuildID)

resources:
  repositories:
    - repository: apt
      type: github
      name: futagoza/apt
      endpoint: futagoza

variables:
- group: 'env-variables'

jobs:

- template: eslint.yml@apt

- template: node-test.yml@apt
  parameters:
    before:
    - script: |
        curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
        chmod +x ./cc-test-reporter
        ./cc-test-reporter before-build
      displayName: 'Download and Initialize Code Climate Test Reporter'
    success_script: cc-test-reporter after-build --exit-code 0
    fail_script: cc-test-reporter after-build --exit-code 1
    after:
    - script: yarn coverage
      displayName: 'Publish code coverage results (coveralls.io)'
      env:
        COVERALLS_SERVICE_NAME: $(COVERALLS_SERVICE_NAME)
        COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
        GIT_BRANCH: $(Build.SourceBranch)
        GIT_COMMIT_SHA: $(Build.SourceVersion)
    publish_test_results_to_pipelines: True
    publish_code_coverage_to_pipelines: True

Add test script hooks for CC
Pipelines: Add test script hooks for CC
