Sending Codacy code coverage with Fastlane

397 Views Asked by At

I'm trying to send the code coverage report that is created by Slather to Codacy using Fastlane. This is the lane:

  desc "Do A Slather and send to Codacy"
  lane :code_coverage do |options|
    slather(output_directory: "SlatherReports", scheme: "MyApp", configuration: "Debug", workspace: "MyApp.xcworkspace", proj: "MyApp.xcodeproj", cobertura_xml: true, use_bundle_exec: true)
    ENV["CODACY_PROJECT_TOKEN"] = options[:codacy_token]
    sh "bash <(curl -Ls https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml)"
  end

The Slather worked but the bash script didn't. It returned this error:

[06:40:19]: Exit status of command 'bash <(curl -Ls https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml)' was 2 instead of 0. sh: -c: line 0: syntax error near unexpected token `(' sh: -c: line 0: `bash <(curl -Ls https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml)'

So, how do I fix this? Thanks.

1

There are 1 best solutions below

0
Bawenang Rukmoko Pardian Putra On

I've found the answer myself. And it's a very simple one (why didn't I think of this earlier?). I just put the whole bash <(curl -Ls https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml) line into a different bash script file and call it instead. LOL.