@kovallux77 @alejandro-vasquez-spatial
After a lengthy journey, found a semi-stupid solution
No need to run xcodebuild twice. After each Test workflow, you can access the CI_RESULT_BUNDLE_PATH which will be the xcresult bundle folder(https://developer.apple.com/documentation/xcode/environment-variable-reference).
ci_post_xcodebuild.sh will be executed twice: first time it's for build-without-testing, and second time is test-without-building. Latter is our focus, so in ci_post_xcodebuild.sh, run this github script to convert XCResult to a general XML file:
xccov-to-sonarqube-generic.sh XCResult > AAAAA.xml
(you have to put xccov-to-sonarqube-generic.sh in ci_scripts otherwise you won't find it in other folder. there's too many catches in Xcode cloud, damn)
So now you got XML in Xcode cloud, now run cat AAAAA.xml and this will print it into logs.
After Xcode cloud is done, from your machine(don't need to be a mac), call appstoreconnect API to get your build/action/artifact and get 'downloadUrl' of it(https://developer.apple.com/documentation/appstoreconnectapi/read_xcode_cloud_artifact_information). Make to do this within maybe 30 mins, otherwise link won't be able to download without Xcode. And there's 6 or 7 zip files attached to that particular test action, what you need is something "logs" and "test-without-building'. You'll find the ci_post_xcodebuild.log inside this zip.
Use sed or awk to scrap all timestamps from it, (I believe you'll remove the first 30 characters) because a log file is the same XML but with timestamp. Now it's back to a coverage XML again. call sonar-scanner to upload it
TL;DR: at ci_post_xcodebuild.sh run xccov-to-sonarqube-generic.sh to convert XCResult to a XML, run print it out all to logs, download logs zip file through Appstore connect API, scrap all timestamps from logs, make it a XML file again. Then run your "sonar-scanner" to upload it
From Xcode cloud, the things you can download is very limited, not arbitrary product at all. Your best bet is print anything your want into logs and grab it later.
Hope this helps
Post
Replies
Boosts
Views
Activity
Yes, this quite annoying & quite often. And for resolving, it leaves me no way but enabling multiple retry at testplan