Skip to content

Commit 0f47881

Browse files
edgardmessiasJohnstonCode
authored andcommitted
chore: Publish code coverage results (#509)
1 parent 81cc42e commit 0f47881

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
command: custom
2727
verbose: false
2828
customCommand: 'run build'
29+
- bash: sed -i.bak 's/"\*"//g' package.json
30+
displayName: 'Enable full coverage'
2931
- task: Npm@1
3032
displayName: 'Run tests'
3133
inputs:
@@ -39,6 +41,16 @@ jobs:
3941
testResultsFiles: 'test-reports/*.xml'
4042
mergeTestResults: true
4143
testRunTitle: '$(Agent.OS) $(Agent.JobName)'
44+
- task: PublishCodeCoverageResults@1
45+
displayName: 'Publish Code Coverage to Azure'
46+
inputs:
47+
codeCoverageTool: Cobertura
48+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml'
49+
reportDirectory: '$(System.DefaultWorkingDirectory)/coverage/lcov-report'
50+
- script: node_modules\.bin\codecov --disable=gcov
51+
displayName: 'Publish Code Coverage to Codecov'
52+
env:
53+
CODECOV_TOKEN: $(codecovToken)
4254
- job: macOS
4355
strategy:
4456
matrix:
@@ -66,6 +78,8 @@ jobs:
6678
command: custom
6779
verbose: false
6880
customCommand: 'run build'
81+
- bash: sed -i.bak 's/"\*"//g' package.json
82+
displayName: 'Enable full coverage'
6983
- task: Npm@1
7084
displayName: 'Run tests'
7185
inputs:
@@ -79,6 +93,16 @@ jobs:
7993
testResultsFiles: 'test-reports/*.xml'
8094
mergeTestResults: true
8195
testRunTitle: '$(Agent.OS) $(Agent.JobName)'
96+
- task: PublishCodeCoverageResults@1
97+
displayName: 'Publish Code Coverage to Azure'
98+
inputs:
99+
codeCoverageTool: Cobertura
100+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml'
101+
reportDirectory: '$(System.DefaultWorkingDirectory)/coverage/lcov-report'
102+
- script: node_modules/.bin/codecov --disable=gcov
103+
displayName: 'Publish Code Coverage to Codecov'
104+
env:
105+
CODECOV_TOKEN: $(codecovToken)
82106
- job: Linux
83107
strategy:
84108
matrix:
@@ -117,6 +141,8 @@ jobs:
117141
/usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 &
118142
disown -ar
119143
displayName: 'Start xvfb'
144+
- bash: sed -i.bak 's/"\*"//g' package.json
145+
displayName: 'Enable full coverage'
120146
- task: Npm@1
121147
displayName: 'Run tests'
122148
inputs:
@@ -132,6 +158,16 @@ jobs:
132158
testResultsFiles: 'test-reports/*.xml'
133159
mergeTestResults: true
134160
testRunTitle: '$(Agent.OS) $(Agent.JobName)'
161+
- task: PublishCodeCoverageResults@1
162+
displayName: 'Publish Code Coverage to Azure'
163+
inputs:
164+
codeCoverageTool: Cobertura
165+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml'
166+
reportDirectory: '$(System.DefaultWorkingDirectory)/coverage/lcov-report'
167+
- script: node_modules/.bin/codecov --disable=gcov
168+
displayName: 'Publish Code Coverage to Codecov'
169+
env:
170+
CODECOV_TOKEN: $(codecovToken)
135171
- job: Release
136172
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
137173
dependsOn:

coverconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"relativeCoverageDir": "../../coverage",
66
"ignorePatterns": ["**/node_modules/**", "test/**"],
77
"includePid": false,
8-
"reports": ["json", "html", "lcov"],
8+
"reports": ["json", "lcov", "cobertura"],
99
"verbose": false
1010
}

package-lock.json

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"@types/semver": "^5.5.0",
6363
"@types/tmp": "0.0.34",
6464
"@types/xml2js": "^0.4.3",
65+
"codecov": "^3.2.0",
6566
"commitizen": "^3.0.7",
6667
"cz-conventional-changelog": "^2.1.0",
6768
"decache": "^4.5.1",

0 commit comments

Comments
 (0)