So, I tried a million ways to do this, and the problem turned out to be xcpretty. After I deleted it, I started to get consistent results with my gitlab ci data. If you still do not want to receive tons of data that you do not need, you can use -quiet in the gitlab yams file. I will post it all, so keep reading.
Still need an external tool for analyzing coverage - xcov seems to be no longer available, so I used slather. Worked like a charm.
These are the following steps:
1) Get a slather .
2) Extract the .slather.yml file. My looks like this (obviously your AppApp application is your application):
# .slather.yml coverage_service: cobertura_xml xcodeproj: ./YourApp.xcodeproj workspace: ./YourApp.xcworkspace scheme: YourApp source_directory: ./YourApp output_directory: path/to/xml_report ignore: - "**/Pods/*" - "thirdparty/*" - "./Scripts/*" - "**/3rdParty/*" - "../**/Developer/*" - "**/libraries/*" - "Module-Core/*" - "Module-Components/*" - "**/AppUnitTests/*"
You can get the test result as html, xml, in codecov.io, etc., completely up to you. Check out the GitHub slather page for possible ways to do this. But for the current problem, all we need is a slather message on the command line, so gitlab can pick it up. This is where the correct configuration of the gitlab yaml file occurs.
3) Configure the .gitlab-ci.yml file. My looks like this:
stages: - build build_project_1: stage: build script: - xcodebuild clean -workspace YourApp.xcworkspace -scheme YourApp -quiet - xcodebuild test -workspace YourApp.xcworkspace -scheme YourApp -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1' -enableCodeCoverage YES -quiet after_script: - slather coverage -s only: - master
4) Next step:
- Scroll down to Test coverage parsing and add this regex expression:
\d+\%\s*$
And it's all. All you have to do is call assembly.
source share