fastlane-community / danger-xcov

Danger plugin to validate the code coverage of the files changed in a pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to find any .xccoverage file (CircleCI)

lomudi opened this issue · comments


I'm getting Unable to find any .xccoverage file while running the danger-xcov with CircleCI.
It's working locally, I have tried to set the derived_data_path to Build following this issue (the scheme setting is ok).

gem install danger --version '~> 4.0' && danger
Fetching: danger-4.3.5.gem (100%)
Successfully installed danger-4.3.5
1 gem installed
[06:37:01]: Skipping file blacklisting as no ignore file was found at path 
[06:37:01]: $ xcodebuild -list -project ZappPlugins.xcodeproj
[06:37:02]: Skipping file blacklisting as no ignore file was found at path 

|               Summary for xcov 1.2.0                |
| scheme                      | ZappPlugins           |
| project                     | ZappPlugins.xcodeproj |
| derived_data_path           | Build                 |
| minimum_coverage_percentage | 90                    |

[06:37:02]: Unable to find any .xccoverage file.
[06:37:02]: Make sure you have enabled 'Gather code coverage' setting on your scheme settings.
[06:37:02]: Alternatively you can provide the full path to your .xccoverage file.
[!] The exception involves the following plugins:
 -  danger-xcov

/Users/distiller/.gem/ruby/2.3.4/gems/xcov-1.2.0/lib/xcov/error_handler.rb:20:in `handle_error':  (Danger::DSLError)
[!] Invalid `Dangerfile` file: Error creating your coverage report - see the log above
 #  from Dangerfile:14
 #  -------------------------------------------
 #  # Check code tests coverage for the changed files in the PR
 #     scheme: 'ZappPlugins',
 #  -------------------------------------------
	from /Users/distiller/.gem/ruby/2.3.4/gems/xcov-1.2.0/lib/xcov/manager.rb:42:in `parse_xccoverage'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-xcov-0.2.4/lib/danger_plugin.rb:53:in `report'
	from Dangerfile:14:in `block in parse'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:199:in `eval'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:199:in `block in parse'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:195:in `instance_eval'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:195:in `parse'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:272:in `run'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/danger_core/executor.rb:27:in `run'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/lib/danger/commands/runner.rb:66:in `run'
	from /Users/distiller/.gem/ruby/2.3.4/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
	from /Users/distiller/.gem/ruby/2.3.4/gems/danger-5.2.2/bin/danger:5:in `<top (required)>'
	from /Users/distiller/.gem/ruby/2.3.4/bin/danger:22:in `load'
	from /Users/distiller/.gem/ruby/2.3.4/bin/danger:22:in `<main>'

gem install danger --version '~> 4.0' && danger returned exit code 1

I'm working with the must update xcov version:

gem install danger-xcov
Fetching: xcov-1.2.0.gem (100%)
Successfully installed xcov-1.2.0
Fetching: danger-xcov-0.2.4.gem (100%)
Successfully installed danger-xcov-0.2.4
2 gems installed

Thanks in advance :)

Hi @lomudi 👋

Have you run your tests before launching Danger? xcov depends on the output of a prior tests pass.

yup @nakiostudio :)
the test runs a few steps before.
screen shot 2017-05-29 at 17 35 47

Ok! another question. Do you have gather coverage enabled as specified here?

yup yup...
you can see it enabled here.
screen shot 2017-05-29 at 18 10 07

while running xcov locally it's working fine.

i guess it's something with the path to the .xccoverage file.

Indeed, do you have a custom derived data path?

not that I'm aware... you have had such an issue with CircleCI? maybe something they are playing with during the build process.

from the test phase of the process, i can see this path of drive data
Signing /Users/distiller/Library/Developer/Xcode/DerivedData/ZappPlugins-dtujruptfzsvuxcrtqbcbskwqygj/Build/Products/Debug-iphonesimulator/ZappPlugins.framework

I remember transitioning from Jenkins to CircleCI and not having to do anything to make it work.

Oh, that's helpful! in that case you don't need to set the derived_data_path option. Try without it.

Tried before. I added it after looking for a solution, saw it here fastlane-community/xcov#13 so I gave it a shot.

I think the problem is the project configuration or how the tests are launched.

  • Are you passing -enableCodeCoverage YES to xcodebuild to run your tests?
  • To confirm you have a project or xcodebuild config problem, could you run the job with SSH access and then inspect the contents of ~/Library/Developer/Xcode/DerivedData/ZappPlugins-dtujruptfzsvuxcrtqbcbskwqygj/Logs/Tests/ after running the tests? There should be a .xccoverage file in that folder.

thanks @nakiostudio 🙏
it was a problem with my test script, now it's working 💯

Great! 👍