Issue with https://github.com/codecov/codecov-action and xCode 13

Hello.

I have some problems when I try to upload coverage reports generated by xcodebuild. The tests are passing successfully but I get an error when codecov-action is trying to upload the coverage reports:

Run codecov/codecov-action@v2
==> macos OS detected
https://uploader.codecov.io/latest/macos/codecov.SHA256SUM
==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (37b0f36f3df63a7d0c1944ec7bb0e995e1cdb41ae894ccd9c620caaf7d941e46  codecov)
==> Running version latest
==> Running version v0.1.0_9620
/Users/runner/work/_actions/codecov/codecov-action/v2/dist/codecov -n  -Q github-action-2.1.0 -C 252929d778bc612f8f711d2c291a5e0c8b52d841
[2021-09-18T23:45:20.060Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.1.0
[2021-09-18T23:45:20.122Z] ['info'] => Project root located at: /Users/runner/work/remoteJobsBoard/remoteJobsBoard
[2021-09-18T23:45:20.126Z] ['info'] -> No token specified or token is empty
[2021-09-18T23:45:20.152Z] ['info'] Searching for coverage files...
[2021-09-18T23:45:20.174Z] ['error'] Error: No coverage files located, please try use `-f`, or change the project root with `-R`

CI/CD URL

https://github.com/dsk1306/remoteJobsBoard/runs/4971891497?check_suite_focus=true

GitHub Action file

name: On Pull Request

on:
  pull_request:
    branches: [ development ]

jobs:
  xcode-tests:
    name: "Tests"
    runs-on: macos-11

    strategy:
      matrix:
        platform: [iOS, iPad]
        include:
          - platform: iOS
            sdk: iphonesimulator
            destination: "name=iPhone 12"

          - platform: iPad
            sdk: iphonesimulator
            destination: "name=iPad Pro (9.7-inch)"

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Xcodebuild Action
      uses: sersoft-gmbh/xcodebuild-action@v1
      with:
        action: test
        project: RemoteJobsBoard.xcodeproj
        scheme: RemoteJobsBoard
        sdk: ${{ matrix.sdk }}
        destination: "${{ matrix.destination }}"
        enable-code-coverage: true
        use-xcpretty: true

    - name: Upload Coverage to CodeCov
      uses: codecov/codecov-action@v2

Hi @dsk1306, looks like this might be something we are working on from our end. We are deprecating the v1 version of the action, but I wanted to know if switching to it works for you.

Hi, I’m having the exact same issue. I’m using the CircleCI Codecov Orb (v3.2.2) and every time it says that it couldn’t find any coverage reports to upload. It does say that some files it found via search were ignored…

Here is the full output:

Codecov report uploader 0.2.2
[2022-05-13T08:03:45.283Z] ['info'] => Project root located at: /Users/distiller/project
[2022-05-13T08:03:45.284Z] ['info'] ->  Token found by arguments
[2022-05-13T08:03:45.285Z] ['verbose'] Start of network processing...
[2022-05-13T08:03:45.285Z] ['verbose'] Searching for files in /Users/distiller/project
[2022-05-13T08:03:45.300Z] ['verbose'] coveragepy is not installed
[2022-05-13T08:03:45.300Z] ['info'] Searching for coverage files...
[2022-05-13T08:03:45.344Z] ['info'] Warning: Some files located via search were excluded from upload.
[2022-05-13T08:03:45.344Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
[2022-05-13T08:03:45.344Z] ['error'] There was an error running the uploader: No coverage files located, please try use `-f`, or change the project root with `-R`
[2022-05-13T08:03:45.345Z] ['verbose'] The error stack is: Error: No coverage files located, please try use `-f`, or change the project root with `-R`
    at main (/snapshot/repo/dist/src/index.js)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-05-13T08:03:45.345Z] ['verbose'] End of uploader: 74 milliseconds

The old bash uploader finds and uploads reports without any issue, but if I understand correctly, that was supposed to be sunset by Feb 2022? For what it’s worth the old bash uploader still works, but I would like to migrate to the newer uploader and use the CircleCI Orb.

@james-rantmedia can you share how you’re running both the orb (the parameters) as well as the bash uploader?

@tom
Of course.

Our config starts with this:

version: 2.1

orbs:
  codecov: codecov/codecov@3.2.2

and then one of our jobs has:

run_build_test:
    steps:
      - run: xcodebuild build test -scheme "MyScheme" -destination 'platform=iOS Simulator,name=iPhone 13 Pro,OS=15.4' -clonedSourcePackagesDirPath SourcePackages -enableCodeCoverage YES
      - codecov/upload

We tried with xtra_args to do things like enabling gcov or turning on verbose mode to see if any extra details were printed etc. None of the additional options tried had any positive effect.

We have not changed our derived data folder from the default, so codecov is already looking in that area.

Again, the old bash script works fine. The difference I noted is that with the old bash script, the Xcode test coverage reports appear to be processed with llvm-cov, but the new upload / orb doesn’t seem to run to this step and I couldn’t see any additional parameters to make it do so.

@tom Then for the Bash Uploader:

    - run:
          name: Codecov
          command: |
                echo "Validating Codecov checksums..."
                FILENAME=codecov
                curl -s https://codecov.io/bash > $FILENAME
               < snipped checksum validation for brevity >
                echo "Checksums validated."
                echo "Starting Codecov."
                chmod +x $FILENAME
                ./$FILENAME

And then here is the bash uploader output:

Validating Codecov checksums...
Checking SHA1...
codecov: OK
env: OK
Checking SHA256...
codecov: OK
env: OK
Checking SHA512...
codecov: OK
env: OK
Checksums validated.
Starting Codecov.

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.6


==> git version 2.35.1 found
==> curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.5 zlib/1.2.11 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
==> Circle CI detected.
    current dir:  /Users/distiller/project
    project root: .
--> token set from env
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
==> Processing Xcode reports via llvm-cov
    DerivedData folder: /Users/distiller/Library/Developer/Xcode/DerivedData
    hint Speed up Swift processing by using use -J 'AppName' (regexp accepted)
    hint This will remove Pods/ from your report. Also https://docs.codecov.io/docs/ignoring-paths
    + Building reports for MyApp app
    + Building reports for XCUnit framework
error: /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCUnit.framework/XCUnit: Failed to load coverage: `-arch` specifier is invalid or missing for universal binary
    x> llvm-cov failed to produce results for /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCUnit.framework/XCUnit
    + Building reports for XCTAutomationSupport framework
error: /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCTAutomationSupport.framework/XCTAutomationSupport: Failed to load coverage: `-arch` specifier is invalid or missing for universal binary
    x> llvm-cov failed to produce results for /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCTAutomationSupport.framework/XCTAutomationSupport
    + Building reports for XCUIAutomation framework
error: /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCUIAutomation.framework/XCUIAutomation: Failed to load coverage: `-arch` specifier is invalid or missing for universal binary
    x> llvm-cov failed to produce results for /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCUIAutomation.framework/XCUIAutomation
    + Building reports for XCTest framework
error: /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCTest.framework/XCTest: Failed to load coverage: `-arch` specifier is invalid or missing for universal binary
    x> llvm-cov failed to produce results for /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCTest.framework/XCTest
    + Building reports for XCTestCore framework
error: /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCTestCore.framework/XCTestCore: Failed to load coverage: `-arch` specifier is invalid or missing for universal binary
    x> llvm-cov failed to produce results for /Users/distiller/Library/Developer/Xcode/DerivedData/MyApp-dbhdbmanbnlquxbcggfiqxvpjryf/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks/XCTestCore.framework/XCTestCore
    + Building reports for MyAppAppTests xctest
    + Building reports for MyFeatureTests xctest
    -> Running gcov for Obj-C
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
    -> Found 8 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./MyFeatureTests.xctest.coverage.txt bytes=1317865
    - Skipping empty file ./XCTAutomationSupport.framework.coverage.txt
    - Skipping empty file ./XCUIAutomation.framework.coverage.txt
    + ./MyAppAppTests.xctest.coverage.txt bytes=376
    - Skipping empty file ./XCUnit.framework.coverage.txt
    - Skipping empty file ./XCTestCore.framework.coverage.txt
    + ./MyApp.app.coverage.txt bytes=1318964
    - Skipping empty file ./XCTest.framework.coverage.txt
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    + Found adjustments
==> Gzipping contents
        540K	/tmp/codecov.dsYbUl.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=update-ci&commit=e0f3bdcaa29683dd98c07d744e15f8042fbfe405&build=44&build_url=&name=&tag=&slug=CompanyName%2FMyApp-ios&service=circleci&flags=&pr=&job=0&cmd_args=
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.6&token=<hidden>&package=bash-1.0.6&token=************************************&branch=update-ci&commit=e0f3bdcaa29683dd98c07d744e15f8042fbfe405&build=44&build_url=&name=&tag=&slug=CompanyName%2FMyApp-ios&service=circleci&flags=&pr=&job=0&cmd_args=
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2022-05-13/B6727F245F1A40AC38E6B00A6646AD5A/e0f3bdcaa29683dd98c07d744e15f8042fbfe405/d85453e5-1e60-439e-9820-27662ebaa244.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<hidden>&X-Amz-Date=20220513T151141Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=710a0c51cab6650a755d8957c31342be474b02eac945af5475280c571d469056
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  538k    0     0  100  538k      0   426k  0:00:01  0:00:01 --:--:--  428k
    -> Reports have been successfully queued for processing at https://codecov.io/github/CompanyName/MyApp-ios/commit/e0f3bdcaa29683dd98c07d744e15f8042fbfe405

@james-rantmedia out of curiosity (and apologies if my code snippets are a little off), but what happens if you were to add

-resultBundlePath results.xcresult to the xcodebuild step?

And then add --xc --xp results.xcresult as xtra_args?

Hi @tom I’ve tried your suggestion, and it seems to resolve the issue, thank you!

(I’ve edited my post that previously said your suggestion wasn’t working, but that turned out to be my fault getting the order of the args incorrect.)

Might I suggest that the documentation for the uploader (here) is updated to include the missing args (such as --xcode and --xcodeArchivePath, etc). I was able to see them by downloading the uploader manually and running with --help.

1 Like

@james-rantmedia that is a great suggestion, I’ll go ahead and make the change today.