No coverage report found

Hi!
I have a Android’s project in bitrise, and I want view my test coverage with codecov, but I have a problem in my workFlow:

±-----------------------------------------------------------------------------+

| (7) codecov@2 |
±-----------------------------------------------------------------------------+
| id: codecov |
| version: 2.0.2 |
| collection: GitHub - bitrise-io/bitrise-steplib: New Bitrise StepLib |
| toolkit: bash |
| time: 2021-07-13T19:27:20Z |
±-----------------------------------------------------------------------------+
| |
codecov: OK
codecov: OK
codecov: OK
./codecov: option requires an argument – C


/ | | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / ` |/ _ / / _ \ \ / /
| |
| (
) | (
| | __/ (
| (
) \ V /
______/ _,|_|____/ _/
Bash-1.0.4
==> git version 2.25.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> Bitrise CI detected.
project root: .
→ token set from env
Yaml found at: .codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .
→ No coverage report found.
Please visit Codecov uploader and supported languages
WARN[19:27:20] Step (codecov@2) failed, but was marked as skippable
| |
±–±--------------------------------------------------------------±---------+
| ! | codecov@2 (exit code: 1) | 1.78 sec |
±–±--------------------------------------------------------------±---------+
| Issue tracker: https://community.codecov.io |
| Source: GitHub - codecov/codecov-bitrise |
±–±--------------------------------------------------------------±---------+

When I do it from Android Studio’s Terminal with the command: “bash <(curl -s https://codecov.io/bash) -X fix -t $TOKEN”, It sends successfully, but in bitrise I have an error.

and I use Jacoco too.

Jacoco.Gradle:
apply plugin: ‘jacoco’

jacoco {
toolVersion = “0.8.5”
// Custom reports directory can be specfied like this:
reportsDir = file(“$buildDir/outputs/jacoco/”)
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = [‘jdk.internal.*’]
// see related issue https://github.com/gradle/gradle/issues/5184#issuecomment-457865951
}

project.afterEvaluate {

(android.hasProperty('applicationVariants')
        ? android.'applicationVariants'
        : android.'libraryVariants')
        .all { variant ->
            def variantName = variant.name
            def unitTestTask = "test${variantName.capitalize()}UnitTest"
            def androidTestCoverageTask = "create${variantName.capitalize()}CoverageReport"

            tasks.create(name: "${unitTestTask}Coverage", type: JacocoReport, dependsOn: [
                    "$unitTestTask",
                    "$androidTestCoverageTask"
            ]) {
                group = "Reporting"
                description = "Generate Jacoco coverage reports for the ${variantName.capitalize()} build"

                reports {
                    html.enabled = true
                    xml.enabled = true
                    csv.enabled = true
                }

                def excludes = [
                        // data binding
                        'android/databinding/**/*.class',
                        '**/android/databinding/*Binding.class',
                        '**/android/databinding/*',
                        '**/androidx/databinding/*',
                        '**/BR.*',
                        // android
                        '**/R.class',
                        '**/R$*.class',
                        '**/BuildConfig.*',
                        '**/Manifest*.*',
                        '**/*Test*.*',
                        'android/**/*.*',
                        // butterKnife
                        '**/*$ViewInjector*.*',
                        '**/*$ViewBinder*.*',
                        // dagger
                        '**/*_MembersInjector.class',
                        '**/Dagger*Component.class',
                        '**/Dagger*Component$Builder.class',
                        '**/*Module_*Factory.class',
                        '**/di/module/*',
                        '**/*_Factory*.*',
                        '**/*Module*.*',
                        '**/*Dagger*.*',
                        '**/*Hilt*.*',
                        // kotlin
                        '**/*MapperImpl*.*',
                        '**/*$ViewInjector*.*',
                        '**/*$ViewBinder*.*',
                        '**/BuildConfig.*',
                        '**/*Component*.*',
                        '**/*BR*.*',
                        '**/Manifest*.*',
                        '**/*$Lambda$*.*',
                        '**/*Companion*.*',
                        '**/*Module*.*',
                        '**/*Dagger*.*',
                        '**/*Hilt*.*',
                        '**/*MembersInjector*.*',
                        '**/*_MembersInjector.class',
                        '**/*_Factory*.*',
                        '**/*_Provide*Factory*.*',
                        '**/*Extensions*.*',
                        // sealed and data classes
                        '**/*$Result.*',
                        '**/*$Result$*.*'
                ]

                def javaClasses = fileTree(dir: variant.javaCompileProvider.get().destinationDir,
                        excludes: excludes)
                def kotlinClasses = fileTree(dir: "${buildDir}/tmp/kotlin-classes/${variantName}",
                        excludes: excludes)

                classDirectories.setFrom(files([
                        javaClasses,
                        kotlinClasses
                ]))

                def variantSourceSets = variant.sourceSets.java.srcDirs.collect { it.path }.flatten()
                sourceDirectories.setFrom(project.files(variantSourceSets))

                def androidTestsData = fileTree(dir: "${buildDir}/outputs/code_coverage/${variantName}AndroidTest/connected/", includes: ["**/*.ec"])

                executionData(files([
                        "$project.buildDir/jacoco/${unitTestTask}.exec",
                        androidTestsData
                ]))
            }

        }

}

and codecov.yml:

codecov:
require_ci_to_pass: no
token: “<>”
max_report_age: off

coverage:
precision: 2
round: down
range: “70…100”

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: “reach,diff,flags,files,footer”
behavior: default
require_changes: no

If your can help me, I will be very thankful!

Regards!

@juanignacio_18 can you share more details like the error, the commit SHA? When you send in terminal, what is the Codecov output (and what coverage report does it send?) Does that coverage report exist on Bitrise before you run the Codecov step?

Hi tom! thanks for your answer.
I think that my problem it’s because it can’t found the report in bitrise, so the problem it’s with bitrise configuration.

1 Like