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
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 testcommand fails because of a failing test, the script won’t continue and therefore,
xchtmlreportwon’t be executed. I already tried writing both commands in the same line separated by a semicolon, so
xchtmlreportshould be executed even if
xcodebuildfails, but it didn’t work either.
I need that
xchtmlreportcommand runs no matter the result of
xcodebuild testbecause 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!