Need to continue with CI script when xcodebuild test fails
Hi Guys! I am running a test build for my XCode project in a runner, and I am having the following behaviour. First of all, this is my test build in the .gitlab-ci.yml
file:
test_build:
stage: test
tags:
- macos
inherit:
default: false
needs:
- job: build_job
artifacts: true
script:
- echo testing build
- xcodebuild test -scheme ProjectTests -resultBundlePath TestResults -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.7'
- echo get report
- xchtmlreport -r TestResults
allow_failure: true
dependencies:
- build_job
artifacts:
when: always
paths:
- index.html
reports:
junit: index.html
- The problem that I am having is that when
xcodebuild test
command fails because of a failing test, the script won’t continue and therefore,xchtmlreport
won’t be executed. I already tried writing both commands in the same line separated by a semicolon, soxchtmlreport
should be executed even ifxcodebuild
fails, but it didn’t work either.
I need thatxchtmlreport
command runs no matter the result ofxcodebuild test
because obviously I need the report for both the error and the success cases.
Here is also a screenshot of the job’s log:
Thanks for your time! Hope you could help me!