1. Add Following lane to your fastlane file.
  lane :buildApp do
    xcbuild({
      workspace: "MYPROJECT.xcworkspace",
      scheme: "MYTARGET",
      sdk: "iphonesimulator",
      destination: "platform=iOS Simulator,name=iPhone 8",
      xcargs: "ONLY_ACTIVE_ARCH=NO"
    })
  end
  1. Replace MYPROJECT with name of the project.
  2. Replace MYTARGET with name of the Target.
  3. Run command bundle exec fastlane ios buildApp
  4. Add this to any CI-CD system like Semaphore, Github Actions.