Skip to content

Commit 18fa5b5

Browse files
authored
Fix code coverage (#8694)
* use latest master * show the content of $(Pipeline.Workspace) * Copy the newly downloaded coverage reports * copy coverage artifacts * now copy on one line * create .nyc_output folder * Check the content of Pipeline.Workspace * ls -la instead of ls -dlU * copy nyc_output * whoops copied one level too deep * Copy .nyc_output without creating folder first * Re-enable generate_upload_coverage * Reset some pipeline changes * Undo PR validation pipeline change * Re-add reports stage to PR validation * Re-add coverage step to CI pipelines * Whitespace * Whitespace
1 parent 28b1e1c commit 18fa5b5

File tree

7 files changed

+61
-2
lines changed

7 files changed

+61
-2
lines changed

build/ci/templates/jobs/coverage.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
jobs:
2+
- job: Coverage
3+
pool:
4+
vmImage: "ubuntu-16.04"
5+
variables:
6+
TestsToRun: 'testUnitTests'
7+
steps:
8+
- template: ../steps/merge_upload_coverage.yml

build/ci/templates/steps/generate_upload_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ steps:
1515
summaryFileLocation: "$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml"
1616
reportDirectory: "$(System.DefaultWorkingDirectory)/coverage"
1717

18-
- bash: cat ./coverage/lcov.info | ./node_modules/.bin/codecov --pipe
18+
- bash: cat ./coverage/cobertura-coverage.xml | ./node_modules/.bin/codecov --pipe
1919
displayName: 'Upload coverage to codecov'
2020
continueOnError: true
2121
condition: contains(variables['TestsToRun'], 'testUnitTests')
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
steps:
2+
- template: initialization.yml
3+
parameters:
4+
workingDirectory: $(Build.SourcesDirectory)
5+
compile: 'false'
6+
7+
# Download previously generated coverage artifacts
8+
- task: DownloadPipelineArtifact@2
9+
inputs:
10+
patterns: '**/.nyc_output/**'
11+
displayName: "Download .nyc_output coverage artifacts"
12+
condition: always()
13+
14+
# Now that we have downloaded artifacts from `coverage-output-`, copy them
15+
# into the root directory (they'll go under `.nyc_output/...`)
16+
# These are the coverage output files that can be merged and then we can generate a report from them.
17+
# This step results in downloading all individual `./nyc_output` results in coverage
18+
# from all different test outputs.
19+
# Running the process of generating reports, will result in generation of
20+
# reports from all coverage data, i.e. we're basically combining all to generate a single merged report.
21+
- bash: |
22+
cp -r $(Pipeline.Workspace)/coverage-output-*/.nyc_output/ ./
23+
cd .nyc_output/
24+
ls -dlU .*/ */
25+
ls
26+
displayName: "Copy ./.nyc_output"
27+
condition: always()
28+
29+
- template: generate_upload_coverage.yml

build/ci/vscode-python-ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,10 @@ stages:
296296
steps:
297297
- template: templates/test_phases.yml
298298

299+
- stage: Reports
300+
dependsOn:
301+
- Smoke
302+
- Tests
303+
condition: always()
304+
jobs:
305+
- template: templates/jobs/coverage.yml

build/ci/vscode-python-nightly-ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,3 +464,10 @@ stages:
464464
steps:
465465
- template: templates/test_phases.yml
466466

467+
- stage: Reports
468+
dependsOn:
469+
- Smoke
470+
- Tests
471+
condition: always()
472+
jobs:
473+
- template: templates/jobs/coverage.yml

build/ci/vscode-python-pr-validation.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,11 @@ stages:
123123

124124
steps:
125125
- template: templates/test_phases.yml
126+
127+
- stage: Reports
128+
dependsOn:
129+
- Smoke
130+
- Tests
131+
condition: always()
132+
jobs:
133+
- template: templates/jobs/coverage.yml

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,7 @@
26782678
"test:unittests:cover": "nyc --silent --no-clean --nycrc-path build/.nycrc mocha --opts ./build/.mocha.unittests.ts.opts",
26792679
"test:functional": "mocha --require source-map-support/register --opts ./build/.mocha.functional.opts",
26802680
"test:functional:cover": "npm run test:functional",
2681-
"test:cover:report": "nyc --nycrc-path build/.nycrc report --reporter=lcov --reporter=text --reporter=html --reporter=text-summary --reporter=cobertura",
2681+
"test:cover:report": "nyc --nycrc-path build/.nycrc report --reporter=text --reporter=html --reporter=text-summary --reporter=cobertura",
26822682
"testDebugger": "node ./out/test/testBootstrap.js ./out/test/debuggerTest.js",
26832683
"testSingleWorkspace": "node ./out/test/testBootstrap.js ./out/test/standardTest.js",
26842684
"testMultiWorkspace": "node ./out/test/testBootstrap.js ./out/test/multiRootTest.js",

0 commit comments

Comments
 (0)