-1

I have a build phase Run Script in my Xcode project that is required for ensuring the module bundle is up to date. The script runs when actions are executed through the Xcode GUI, and the Swift Package is able to build and run tests successfully. But when I try to run xcodebuild test from the command line for CI/CD, the tests fail because the Run Script did not get executed during the build process.

Is there a way to tell xcodebuild to use the Run Scripts from my Xcode project? Or is there a flag I can use to specify a script for it to run?

Liam
  • 108
  • 5

1 Answers1

0

Judging by the radio silence, I'm guessing this isn't possible using an xcodebuild flag or changing any Xcode settings.

What I ended up doing as a workaround was splitting build and test commands and then running my script in between.

# build-for-test is used bcus normal build wont build the test bundle, which was important in my use case
xcodebuild build-for-test ...
bash path/to/run-script.sh
xcodebuild test ...

The xcodebuild test command will use the files compiled by the earlier build command, so it won't clean any changes made to the xcode build dir by the run script (which is what I was doing).

Liam
  • 108
  • 5