diff --git a/Jenkinsfile b/Jenkinsfile index 6099988a..9ce183cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -64,7 +64,11 @@ stage('build') { linux_node_debug: doDockerBuild('node Debug'), linux_node_release: doDockerBuild('node Release'), linux_test_runners: doDockerBuild('test-runners'), - macos_node_debug: doMacBuild('node Debug'), + macos_node_debug: doMacBuild('node Debug', true) { + withCredentials([string(credentialsId: 'codecov-token-js', variable: 'CODECOV_TOKEN')]) { + sh 'node_modules/.bin/codecov' + } + }, macos_node_release: doMacBuild('node Release'), //macos_realmjs_debug: doMacBuild('realmjs Debug'), //macos_realmjs_release: doMacBuild('realmjs Release'), @@ -172,7 +176,8 @@ def doAndroidBuild(target, postStep = null) { } } -def doDockerBuild(target, postStep = null) { +def doDockerBuild(target, coverage = false, postStep = null) { + def prefix = coverage?'node_modules/.bin/nyc ':'' return { node('docker') { deleteDir() @@ -182,7 +187,7 @@ def doDockerBuild(target, postStep = null) { reportStatus(target, 'PENDING', 'Build has started') docker.image('node:6').inside('-e HOME=/tmp') { - sh "scripts/test.sh ${target}" + sh "${prefix}scripts/test.sh ${target}" if(postStep) { postStep.call() } diff --git a/package.json b/package.json index 5a8fc6ff..fdf44485 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "set-version": "scripts/set-version.sh", "lint": "eslint", "test": "scripts/test.sh", + "test-cover": "npm install nyc && node_modules/.bin/nyc scripts/test.sh", "install": "node-pre-gyp install --fallback-to-build", "build-changes": "node-pre-gyp build --debug", "rebuild-changes": "node-pre-gyp rebuild --debug && cd tests && npm install", @@ -103,7 +104,9 @@ "rimraf": "^2.6.1", "semver": "^5.1.0", "shelljs": "^0.7.7", - "shx": "^0.2.2" + "shx": "^0.2.2", + "nyc": "^11.2.1", + "codecov": "^2.2.0" }, "rnpm": { "ios": {