Reuse an iOS CI Build Without Compiling Twice
Use the Simulator app your CI job already made. Avoid a second Xcode build.
Use your current build
Keep the SimPreview step in the same job as xcodebuild when you can. Add it after the Simulator build succeeds.
The path must point to the .app made for the current pull request. Do not use an .ipa or a device build.
Pass the app path
Set a fixed DerivedData folder so the path stays clear. Then pass that path to app-path.
- name: Build app for Simulator
run: xcodebuild -scheme MyApp -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath build/DerivedData CODE_SIGNING_ALLOWED=NO build
- uses: aryamansharda/simpreview-build@v1
with:
scheme: MyApp
app-path: build/DerivedData/Build/Products/Debug-iphonesimulator/MyApp.appKeep each preview current
Use the .app from the current pull request and commit. Keep the scheme and configuration in the workflow.
When the build path changes, update app-path in the same pull request.
What teams ask
Will this run xcodebuild again?
No. SimPreview uses the .app path you provide.
Can app-path point to an .ipa?
No. It must point to an iOS Simulator .app.
Can I use a later CI job?
Yes, if that job has the complete .app from the current pull request.
Use the Simulator app CI already made.
Add its path to the SimPreview step in the same job.