message: Collect android unit test results and fix diff-cover branch
diff: @@ -40,10 +40,8 @@ timeout(time: 1, unit: 'HOURS') {
  }
  }
  - stage 'check'
  -
  - parallelExecutors = [
  - checkLinuxRelease : doBuildInDocker('Release'),
  + stage('check') {
  + parallelExecutors = [checkLinuxRelease : doBuildInDocker('Release'),
  checkLinuxDebug : doBuildInDocker('Debug'),
  buildMacOsDebug : doBuildMacOs('Debug'),
  buildMacOsRelease : doBuildMacOs('Release'),
  @@ -85,6 +83,7 @@ timeout(time: 1, unit: 'HOURS') {
  }
  parallel parallelExecutors
  + }
  if (isPublishingRun) {
  stage('publish-packages') {
  @@ -162,6 +161,7 @@ def doAndroidBuildInDocker(String abi, String buildType, boolean runTestsInEmula
  } finally {
  collectCompilerWarnings('gcc', true )
  }
  + try {
  sh '''
  cd $(find . -type d -maxdepth 1 -name build-android*)
  adb connect emulator
  @@ -173,6 +173,13 @@ def doAndroidBuildInDocker(String abi, String buildType, boolean runTestsInEmula
  adb shell \'cd /data/local/tmp; ./realm-tests || echo __ADB_FAIL__\' | tee adb.log
  ! grep __ADB_FAIL__ adb.log
  '''
  + } finally {
  + sh '''
  + cd $(find . -type d -maxdepth 1 -name build-android*)/test
  + adb pull /data/local/tmp/unit-test-report.xml
  + '''
  + recordTests('android')
  + }
  }
  }
  }
  @@ -224,15 +231,15 @@ def buildDiffCoverage() {
  ninja
  cd test
  ./realm-tests
  - gcovr --filter='.*src/realm.*' -x >gcovr.xml
  + gcovr --filter=\'.*src/realm.*\' -x >gcovr.xml
  mkdir coverage
  '''
  def coverageResults = sh(returnStdout: true, script: """
  - diff-cover gcovr.xml \\
  + diff-cover build-dir/test/gcovr.xml \\
  --compare-branch=origin/${env.CHANGE_TARGET} \\
  - --html-report coverage/diff-coverage-report.html \\
  + --html-report build-dir/test/coverage/diff-coverage-report.html \\
  | grep Coverage: | head -n 1 > diff-coverage
  - """)
  + """).trim()
  publishHTML(target: [
  allowMissing : false,
  @@ -244,9 +251,11 @@ def buildDiffCoverage() {
  ])
  withCredentials([[$class: 'StringBinding', credentialsId: 'bot-github-token', variable: 'githubToken']]) {
  - sh "curl -H \"Authorization: token ${env.githubToken}\" " +
  - "-d '{ \"body\": \"${coverageResults}\\n\\nPlease check your coverage here: ${env.BUILD_URL}Diff_Coverage\"}' " +
  - "\"https://api.github.com/repos/realm/realm-core/issues/${env.CHANGE_ID}/comments\""
  + sh """
  + curl -H \"Authorization: token ${env.githubToken}\" \\
  + -d '{ \"body\": \"${coverageResults}\\n\\nPlease check your coverage here: ${env.BUILD_URL}Diff_Coverage\"}' \\
  + \"https://api.github.com/repos/realm/realm-core/issues/${env.CHANGE_ID}/comments\"
  + """
  }
  }
  }
  