Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 86f0302

Browse files
author
BruceHaley
authored
Publish cobertura code coverage to codecov.io (#850)
* Introduce jest * Install jest * Add jest.config.js * Rename to jest.config.json * Fix dir workspace * Fix dir workspace * Install coveralls earlier * Add run mocha lcov reporter * Disable jest --coverage * Remove path "node_modules/.bin/" from jscover command * Try rush report-coverage * Ren script report-coverage to reportcoverage * Try "coverage", look for .coverage files * Fix Copy .coverage files * Fix rush coverage * Add rush report -v * Add rush reportcoverage * Separate rush coverage and rush report * Add set COVERALLS_REPO_TOKEN * Show env vars * Use var TokenForCoveralls to set env var * Send coverage to ../../coverage/commandcoverage.lcov * Add Create coverage folder * Mocha redirect without reporter spec * Return to reportcoverage * Publish coverage artifacts * Fix copy files * Try 2 reporters * Add .nycrc files * Restore report scripts * Add dependency nock * Dependencies tweaks * Dummy change. * Set up codecov reporting * Fix codecov url * Fix codecov target url again * Add task to Populate Code Coverage tab * Add coverage url build tag * Clean up .yml * Clean up .yml 2 * clean up scripts * Cleanup 3 * Cleanup 4 * Set script "coverage": "nyc npm run test" * Add html reporter back * Remove nock from package.json files * Revert "Remove nock from package.json files" This reverts commit 3db34f0.
1 parent fdf269e commit 86f0302

File tree

24 files changed

+150
-80
lines changed

24 files changed

+150
-80
lines changed

build/botframework-cli.yml

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ pr:
1212
branches:
1313
include:
1414
- master
15-
paths:
16-
include:
17-
- '*'
18-
exclude:
19-
- README.md
20-
- specs/*
21-
- PortingMap.md
22-
- ToolLifetimeSchedule.md
23-
- AzureCli.md
24-
- CONTRIBUTING.md
25-
- LICENSE
26-
- PRIVACY.md
2715

2816
jobs:
2917
- job: CLI
@@ -37,15 +25,14 @@ jobs:
3725
inputs:
3826
tags: 'Version=$(_version)'
3927
continueOnError: true
40-
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'False'))
4128

4229
- task: NodeTool@0
4330
displayName: 'Use Node 12.x'
4431
inputs:
4532
versionSpec: 12.x
4633

4734
- task: Npm@1
48-
displayName: 'Install rush'
35+
displayName: 'npm install --global @microsoft/rush'
4936
inputs:
5037
command: custom
5138
verbose: false
@@ -55,10 +42,41 @@ jobs:
5542
displayName: 'rush update'
5643

5744
- script: 'rush build -p 2'
58-
displayName: 'rush build'
45+
displayName: 'rush build -p 2'
46+
47+
- script: 'rush coverage -v'
48+
displayName: 'rush coverage -v'
5949

60-
- script: 'rush test -p 2 -v'
61-
displayName: 'rush test'
50+
- bash: 'bash <(curl -s https://codecov.io/bash)'
51+
displayName: 'push coverage report to codecov.io - https://codecov.io/github/microsoft/botframework-cli/commit/$(Build.SourceVersion)'
52+
env:
53+
CODECOV_TOKEN: $(TokenForCodecov)
54+
55+
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
56+
displayName: 'Tag Build with coverage url'
57+
inputs:
58+
tags: 'https://codecov.io/gh/microsoft/botframework-cli/tree/$(Build.SourceVersion)/packages'
59+
continueOnError: true
60+
61+
- task: PublishCodeCoverageResults@1
62+
displayName: 'Populate Code Coverage tab'
63+
inputs:
64+
codeCoverageTool: 'cobertura' # Options: cobertura, jaCoCo
65+
summaryFileLocation: $(System.DefaultWorkingDirectory)/packages/*/coverage/cobertura-coverage.xml
66+
continueOnError: true
67+
68+
- task: CopyFiles@2
69+
displayName: 'Copy coverage files to: $(Build.StagingDirectory)/coverage'
70+
inputs:
71+
SourceFolder: '$(Build.SourcesDirectory)/packages'
72+
Contents: '*/coverage/**'
73+
TargetFolder: '$(Build.StagingDirectory)/coverage'
74+
75+
- task: PublishBuildArtifacts@1
76+
displayName: 'Publish Artifact: coverage'
77+
inputs:
78+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/coverage'
79+
ArtifactName: coverage
6280

6381
- script: 'rush posttest'
6482
displayName: 'rush posttest'
@@ -67,21 +85,23 @@ jobs:
6785
displayName: 'Version and Pack'
6886

6987
- task: CopyFiles@2
70-
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
88+
displayName: 'Copy packages to: $(Build.ArtifactStagingDirectory)/drop'
7189
inputs:
7290
SourceFolder: ./.output
7391
Contents: '**/*.tgz'
74-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
92+
TargetFolder: '$(Build.ArtifactStagingDirectory)/drop'
7593
flattenFolders: true
7694

7795
- task: PublishBuildArtifacts@1
7896
displayName: 'Publish Artifact: drop'
7997
inputs:
80-
artifactName: 'drop'
98+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/drop'
99+
ArtifactName: drop
81100

82101
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
83102
displayName: 'Component Detection'
84103

85-
- script: 'rush report:coverage'
86-
displayName: 'rush report:coverage'
87-
enabled: false
104+
- powershell: 'Get-ChildItem .. -ErrorAction Continue -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}'
105+
displayName: 'Dir workspace except node_modules'
106+
continueOnError: true
107+
condition: succeededOrFailed()

common/config/rush/command-line.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"commandKind": "global",
3030
"name": "pack",
3131
"summary": "Create .tgz packages for publishing in CI",
32-
"description":"This doesn't currently work because rush doesn't allow the passing of arbitrary commands like version numbers yet. \n Use node ./common/scripts/version-and-pack.js --version X.X.X-tag instead.",
32+
"description": "This doesn't currently work because rush doesn't allow the passing of arbitrary commands like version numbers yet. \n Use node ./common/scripts/version-and-pack.js --version X.X.X-tag instead.",
3333
"shellCommand": "node -e \"throw new Error(`Not supported yet. \\nUse node ./common/scripts/version-and-pack.js --version X.X.X-tag instead`)\""
3434
},
3535
/**

packages/chatdown/.nycrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"**/*.d.ts"
1414
],
1515
"reporter": [
16-
"text",
17-
"html"
16+
"html",
17+
"lcov",
18+
"text"
1819
],
1920
"all": true,
2021
"cache": true,
2122
"extends": "@istanbuljs/nyc-config-typescript",
2223
"check-coverage": false
23-
}
24+
}

packages/chatdown/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"author": "Microsoft",
66
"bugs": "https://github.com/microsoft/botframework-cli",
77
"dependencies": {
8+
"@microsoft/bf-cli-command": "1.0.0",
89
"@oclif/command": "~1.5.19",
910
"@oclif/config": "~1.13.3",
1011
"botframework-schema": "^4.5.1",
1112
"chalk": "2.4.1",
12-
"@microsoft/bf-cli-command": "1.0.0",
1313
"cli-table3": "^0.5.1",
1414
"fs-extra": "^5.0.0",
1515
"glob": "^7.1.3",
@@ -69,13 +69,12 @@
6969
"prepack": "npm run clean && npm run build && npm run doc:readme",
7070
"postpack": "rimraf oclif.manifest.json",
7171
"posttest": "tslint -p test -t stylish",
72-
"build":"tsc -b",
73-
"clean":"rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
72+
"build": "tsc -b",
73+
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
7474
"test": "mocha",
7575
"coverage": "nyc npm run test",
76-
"report:coverage":"npm run coverage && nyc report --reporter=text-lcov | coveralls",
7776
"doc": "npm run build && npm run doc:readme && rimraf oclif.manifest.json",
78-
"doc:readme":"oclif-dev manifest && oclif-dev readme",
77+
"doc:readme": "oclif-dev manifest && oclif-dev readme",
7978
"version": "npm run doc:readme && git add README.md"
8079
}
8180
}

packages/cli/.nycrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"**/*.d.ts"
1414
],
1515
"reporter": [
16-
"text",
17-
"html"
16+
"html",
17+
"lcov",
18+
"text"
1819
],
1920
"all": true,
2021
"cache": true,
2122
"extends": "@istanbuljs/nyc-config-typescript",
2223
"check-coverage": false
23-
}
24+
}

packages/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
5050
"test": "mocha",
5151
"coverage": "nyc npm run test",
52-
"report:coverage": "npm run coverage && nyc report --reporter=text-lcov | coveralls",
5352
"doc": "npm run clean && npm run build && npm run doc:readme && rimraf oclif.manifest.json",
5453
"doc:readme": "oclif-dev manifest && oclif-dev readme",
5554
"version": "oclif-dev manifest"
@@ -82,10 +81,12 @@
8281
"@types/chai": "^4.1.7",
8382
"@types/fs-extra": "^5.0.5",
8483
"@types/mocha": "^5.2.6",
84+
"@types/nock": "^11.1.0",
8585
"@types/node": "^10.14.6",
8686
"chai": "^4.2.0",
8787
"globby": "^8.0.2",
8888
"mocha": "^6.2.2",
89+
"nock": "^11.7.0",
8990
"nyc": "^14.1.1",
9091
"rimraf": "^2.6.3",
9192
"ts-node": "^8.1.0",

packages/command/.nycrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
"**/*.d.ts"
1414
],
1515
"reporter": [
16-
"text",
17-
"html"
16+
"html",
17+
"lcov",
18+
"text"
1819
],
1920
"all": true,
2021
"cache": true,

packages/command/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
"prepack": "",
1919
"postpack": "",
2020
"posttest": "",
21-
"build":"tsc -b",
22-
"clean":"rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
21+
"build": "tsc -b",
22+
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
2323
"test": "mocha",
2424
"coverage": "nyc npm run test",
25-
"report:coverage":"npm run coverage && nyc report --reporter=text-lcov | coveralls",
2625
"doc": "",
27-
"doc:readme":"",
26+
"doc:readme": "",
2827
"version": ""
2928
},
3029
"types": "./lib/index.d.ts",
@@ -55,6 +54,7 @@
5554
"chai": "^4.2.0",
5655
"fancy-test": "^1.4.3",
5756
"mocha": "^6.2.2",
57+
"nock": "^11.7.0",
5858
"nyc": "^14.1.1",
5959
"proxyquire": "^2.1.0",
6060
"rimraf": "^2.6.3",

packages/config/.nycrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"**/*.d.ts"
1414
],
1515
"reporter": [
16-
"text",
17-
"html"
16+
"html",
17+
"lcov",
18+
"text"
1819
],
1920
"all": true,
2021
"cache": true,
2122
"extends": "@istanbuljs/nyc-config-typescript",
2223
"check-coverage": false
23-
}
24+
}

packages/config/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@
2727
"scripts": {
2828
"postpack": "rimraf oclif.manifest.json",
2929
"posttest": "tslint -p test -t stylish",
30-
"build":"tsc -b",
31-
"clean":"rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
30+
"build": "tsc -b",
31+
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
3232
"test": "mocha",
3333
"coverage": "nyc npm run test",
34-
"report:coverage":"npm run coverage && nyc report --reporter=text-lcov | coveralls",
3534
"doc": "npm run build && npm run doc:readme && rimraf oclif.manifest.json",
36-
"doc:readme":"oclif-dev manifest && oclif-dev readme",
35+
"doc:readme": "oclif-dev manifest && oclif-dev readme",
3736
"version": "npm run doc:readme && git add README.md"
3837
},
3938
"telemetry": null,

0 commit comments

Comments
 (0)