# Codecov and xCode Cloud

**URL:** <https://community.codecov.com/t/codecov-and-xcode-cloud/3824>\
**Category:** Support\
**Tags:** swift\
**Created:** [August 15, 2022, 3:01pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824 "2022-08-15T15:01:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsk1306](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/dsk1306/32/997_2.png) [@dsk1306](https://community.codecov.com/u/dsk1306)\
**Post date:** [August 15, 2022, 3:01pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/1 "2022-08-15T15:01:06Z")

</div>

I have searched for similar issues before creating this topic.  
 I have verified that my repository is using the [Codecov GitHub app](https://github.com/apps/codecov), if using GitHub  
 I have [validated](https://docs.codecov.com/docs/codecov-yaml#validate-your-repository-yaml) my `codecov.yaml` configuration file.  
 I have filled out the below sections to the best of my ability.

### Description

Hello everyone.  
Has anyone managed to set up xCode Cloud to upload coverage reports to Codecov successfully? I’ve managed to configure `ci_post_xcodebuild.sh` to upload reports, but for some reason they’re empty.

### Codecov Output

```auto
Run command: 'source /Volumes/Task/ci_build.env && source /Volumes/Task/ci_plan.env && cd /Volumes/workspace/repository/<project-name>/ci_scripts && CI_XCODEBUILD_EXIT_CODE=0 /Volumes/workspace/repository/<project-name>/ci_scripts/ci_post_xcodebuild.sh'
/Volumes/workspace/repository/<project-name>/ci_scripts/ci_post_xcodebuild.sh: line 3: cd: /Volumes/workspace/repository/<project-name>/ci_scripts/resources: No such file or directory
[2022-08-08T10:10:41.553Z] ['verbose'] Start of uploader: 1659953441553...
[2022-08-08T10:10:41.555Z] ['info'] 
     _____ _
    / ____ | | |
   | | _____ | | ______  _______
   | | / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |__/ (_| (_) \ V /
    \ _____\___ / \ __,_|\___ |\ ___\___ / \_/
  Codecov report uploader 0.2.5
[2022-08-08T10:10:41.576Z] ['info'] => Project root located at: /Volumes/workspace/repository
[2022-08-08T10:10:41.579Z] ['info'] -> Token found by arguments
[2022-08-08T10:10:41.580Z] ['verbose'] Start of network processing...
[2022-08-08T10:10:41.580Z] ['verbose'] Searching for files in /Volumes/workspace/repository
[2022-08-08T10:10:41.604Z] ['info'] Running xcode coversion...
[2022-08-08T10:10:42.672Z] ['verbose'] Writing coverage to ./coverage-report-resultbundle.json
[2022-08-08T10:10:42.681Z] ['verbose'] ./coverage-report-resultbundle.json
[2022-08-08T10:10:42.688Z] ['verbose'] coveragepy is not installed
[2022-08-08T10:10:42.688Z] ['info'] Searching for coverage files...
[2022-08-08T10:10:42.946Z] ['info'] Warning: Some files located via search were excluded from upload.
[2022-08-08T10:10:42.946Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
[2022-08-08T10:10:42.946Z] ['verbose'] Preparing to clean the following coverage paths: <project-name>/ci_scripts/coverage-report-resultbundle.json
[2022-08-08T10:10:42.946Z] ['info'] => Found 1 possible coverage files:
  <project-name>/ci_scripts/coverage-report-resultbundle.json
[2022-08-08T10:10:42.946Z] ['verbose'] End of network processing
[2022-08-08T10:10:42.947Z] ['info'] Processing /Volumes/workspace/repository/<project-name>/ci_scripts/coverage-report-resultbundle.json...
[2022-08-08T10:10:42.949Z] ['info'] Using manual override from args.
[2022-08-08T10:10:42.967Z] ['info'] Detected Local as the CI provider.
[2022-08-08T10:10:42.968Z] ['verbose'] -> Using the following env variables:
[2022-08-08T10:10:42.968Z] ['verbose'] BRANCH_NAME: undefined
[2022-08-08T10:10:42.968Z] ['verbose'] CI: TRUE
[2022-08-08T10:10:42.968Z] ['verbose'] GIT_BRANCH: undefined
[2022-08-08T10:10:42.968Z] ['verbose'] GIT_COMMIT: undefined
[2022-08-08T10:10:42.984Z] ['verbose'] Using the following upload parameters:
[2022-08-08T10:10:42.985Z] ['verbose'] branch
[2022-08-08T10:10:42.985Z] ['verbose'] build
[2022-08-08T10:10:42.985Z] ['verbose'] buildURL
[2022-08-08T10:10:42.985Z] ['verbose'] commit
[2022-08-08T10:10:42.985Z] ['verbose'] job
[2022-08-08T10:10:42.985Z] ['verbose'] pr
[2022-08-08T10:10:42.985Z] ['verbose'] service
[2022-08-08T10:10:42.985Z] ['verbose'] slug
[2022-08-08T10:10:42.985Z] ['verbose'] name
[2022-08-08T10:10:42.985Z] ['verbose'] tag
[2022-08-08T10:10:42.985Z] ['verbose'] flags
[2022-08-08T10:10:42.985Z] ['verbose'] parent
[2022-08-08T10:10:42.986Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=uploader-0.2.5&token= ******* &branch=1490-codecov&build=389&build_url=&commit=<commit>&job=&pr=1493&service=&slug=<slug>&name=&tag=&flags=&parent=<parent>
[2022-08-08T10:10:42.987Z] ['verbose'] Passed token was 36 characters long
[2022-08-08T10:10:42.987Z] ['verbose'] https://codecov.io/upload/v4?package=uploader-0.2.5&branch=1490-codecov&build=389&build_url=&commit=<commit>&job=&pr=1493&service=&slug=<slug>&name=&tag=&flags=&parent=<parent>
        Content-Type: 'text/plain'
        Content-Encoding: 'gzip'
        X-Reduced-Redundancy: 'false'
[2022-08-08T10:10:43.571Z] ['info'] https://codecov.io/github/<ogr-name>/<repo>/commit/<commit>
https://storage.googleapis.com/codecov/v4/raw/2022-08-08/BFE9A5CBB0EDAC879D8584FD0E061090/df69939178f23f7f224739d6e587dddc926f6034/5000b464-9ab1-41dc-8d2f-bee8cd1adabc.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EJOGFN2JQ4OCTGA2MU5AEIT7OT5Z7HTFOAN2SPG4NWSN2UJYOY5U6LZQ%2F20220808%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20220808T101043Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=145100b0ae2042f7a57eb201ec6d5d0b2412e4c5b587ea9d1285fb00207bf5d3
[2022-08-08T10:10:43.571Z] ['verbose'] Returned upload url: https://storage.googleapis.com/codecov/v4/raw/2022-08-08/BFE9A5CBB0EDAC879D8584FD0E061090/df69939178f23f7f224739d6e587dddc926f6034/5000b464-9ab1-41dc-8d2f-bee8cd1adabc.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EJOGFN2JQ4OCTGA2MU5AEIT7OT5Z7HTFOAN2SPG4NWSN2UJYOY5U6LZQ%2F20220808%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20220808T101043Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=145100b0ae2042f7a57eb201ec6d5d0b2412e4c5b587ea9d1285fb00207bf5d3
[2022-08-08T10:10:43.571Z] ['info'] Uploading...
[2022-08-08T10:10:43.832Z] ['info'] {"status":"success","resultURL":"https://codecov.io/github/<org-name>/<repo>/commit/<commit>"}
[2022-08-08T10:10:43.832Z] ['verbose'] End of uploader: 2279 milliseconds
Command executed successfully

```

### Expected Results

Successfully uploaded report.

### Actual Results

 ![Screenshot 2022-08-15 at 16.57.34](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/3/3008fd791f67c53e8eb4055686fb2d7df2ef477c.png)  
 ![Screenshot 2022-08-15 at 16.58.37](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/1/14b491325b93216aed43b26a47287bc49698935e.png)

### Additional Information

Upload script:

```auto
#!/bin/sh

 cd $CI_WORKSPACE/<repo>/ci_scripts/resources
 curl -Os https://uploader.codecov.io/latest/macos/codecov
 chmod +x codecov

 ./codecov -t $CODECOV_TOKEN --branch $CI_PULL_REQUEST_SOURCE_BRANCH --build $CI_BUILD_NUMBER --sha $CI_PULL_REQUEST_SOURCE_COMMIT --parent $CI_PULL_REQUEST_TARGET_COMMIT --pr $CI_PULL_REQUEST_NUMBER --verbose --xcode --xcodeArchivePath $CI_RESULT_BUNDLE_PATH

```

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [August 16, 2022, 7:37pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/2 "2022-08-16T19:37:10Z")

</div>

@dsk1306 can you share a commit SHA?

---

<div class="post-metadata">

**Author:** ![dsk1306](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/dsk1306/32/997_2.png) [@dsk1306](https://community.codecov.com/u/dsk1306)\
**Post date:** [August 16, 2022, 9:03pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/3 "2022-08-16T21:03:00Z")

</div>

@tom I think it was `df69939178f23f7f224739d6e587dddc926f6034`

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [August 17, 2022, 4:14am UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/4 "2022-08-17T04:14:19Z")

</div>

@dsk1306 got it, my guess is that you are passing in the wrong directory for `xcodeArchivePath`. From the docs, it says `Specify the xcode archive path. Likely specified as the -resultBundlePath and should end in .xcresult`

Unfortunately, I’m not an xcode developer so I’m a little bit out of my league here. Does that make sense? Else, can you share how you are collecting coverage?

---

<div class="post-metadata">

**Author:** ![dsk1306](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/dsk1306/32/997_2.png) [@dsk1306](https://community.codecov.com/u/dsk1306)\
**Post date:** [August 17, 2022, 11:16am UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/6 "2022-08-17T11:16:05Z")

</div>

@tom I use xCode Cloud provided `$CI_RESULT_BUNDLE_PATH` variable to specify the path to `.xcresult`. According to Apple docs, it should be ok, but I will double check it.

 ![Screenshot 2022-08-17 at 13.14.58](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/1/14da5c4c3f538804e9d30a54b0a7ef55be1cf1a9.png)

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [August 17, 2022, 4:56pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/7 "2022-08-17T16:56:51Z")

</div>

@dsk1306, no I think that probably is fine. Are you able to do a `cat` on that bundle to make sure it has data? I’m not sure if it’s compressed

---

<div class="post-metadata">

**Author:** ![dsk1306](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/dsk1306/32/997_2.png) [@dsk1306](https://community.codecov.com/u/dsk1306)\
**Post date:** [August 18, 2022, 8:53am UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/8 "2022-08-18T08:53:36Z")

</div>

@tom Ok, I’ve added `cat $CI_RESULT_BUNDLE_PATH` to my runscript and I’ve got

```auto
cat: /Volumes/workspace/resultbundle.xcresult: Is a directory

```

Do I need to perform extra compression here?

---

<div class="post-metadata">

**Author:** ![dsk1306](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/dsk1306/32/997_2.png) [@dsk1306](https://community.codecov.com/u/dsk1306)\
**Post date:** [August 18, 2022, 3:24pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/9 "2022-08-18T15:24:41Z")

</div>

@tom Ok I’ve tried to preview the bundle with `xccov view` and it looks like xCode Cloud doesn’t collect coverage data because it failed

 ![Screenshot 2022-08-18 at 17.19.38](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/9/980c1b7631513d82d72c89917effafa2392233b7.png)

I’ve [contacted Apple](https://developer.apple.com/forums/thread/712608) to see if I’m missing something.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [August 18, 2022, 8:06pm UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/10 "2022-08-18T20:06:51Z")

</div>

@dsk1306 ahhhh I see. Is there anything I can do to help?

---

<div class="post-metadata">

**Author:** ![dsk1306](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/dsk1306/32/997_2.png) [@dsk1306](https://community.codecov.com/u/dsk1306)\
**Post date:** [August 30, 2022, 10:57am UTC](https://community.codecov.com/t/codecov-and-xcode-cloud/3824/11 "2022-08-30T10:57:47Z")

</div>

@tom I’ve created a ticket on the Apple Dev portal. Hopefully, they will give me an answer. Meanwhile, I will just use another CI. Thank you for your help!
