So I need to upload the code coverage for our IOS app and I need the coverage as an html to display it on our webpage but I also need it as a json for it to be read by our internal tools easily.
Currently the shell script for creating the coverage report looks like this:
def llvmCovResult = sh(script: "xcrun llvm-cov show --format=html --instr-profile=${derivedDataPath}/${codeCoverageFile[0].path} ${derivedDataPath}/Build/Products/Debug-iphonesimulator/${codecovBinary} -o ./codecov --ignore-filename-regex=PackageSources/checkouts/ --ignore-filename-regex=.gen.swift --ignore-filename-regex=.generated.swift --ignore-filename-regex=/Generated/ --ignore-filename-regex=/Build/Intermediates.noindex/", returnStatus: true)
When I convert --format==html
to --format=json
the coverage report does not get generated and added to my aws bucket. When I read the documentation here it said the json should be text which I tried but it made it a .txt file. Am I supposed to try to import that as a json when I run my files separately? Also I need both the html and json but I don't want to run the script twice as that would double up the coverage tests and would rather be abe to do it with a single command for efficiency. How could I modify the script(or do something differently) to achieve this?