Reputation: 1534
My project is a native iOS application. I'm using CircleCI for CI/CD and I get an error when running unit tests using a simulator unless I'm using Rosetta. The CircleCI uses Apple Silicon to run my jobs.
This is what my config.yml file looks like.
version: 2.1
# setup: true
orbs:
macos: circleci/[email protected]
ruby: circleci/[email protected]
parameters:
application-nonprod-context:
description: Context containing credentials for nonprod
type: string
default: application-nonprod-context-default-value
executors:
my-executor:
macos:
xcode: "15.3.0"
resource_class: macos.m1.large.gen1
commands:
setup:
description: Setup common to all jobs
steps:
- checkout
- ruby/install-deps
jobs:
run-tests:
executor: my-executor
steps:
- setup
- macos/install-rosetta
- macos/preboot-simulator:
device: iPhone 15 Pro
version: "17.4"
- run:
name: Run unit tests using Fastlane
command: bundle exec fastlane tests
workflows:
code-changed:
jobs:
- run-tests:
context: << pipeline.parameters.application-nonprod-context >>
filters:
branches:
only: /.*/
My Fastfile
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform :ios
platform :ios do
before_all do
setup_circle_ci
end
desc "Run unit tests using scheme UnitTests"
lane :tests do
run_tests(workspace: "MyProject.xcworkspace",
devices: ["iPhone 15 Pro (17.4)"],
scheme: "UnitTests",
clean: true,
parallel_testing: false,
configuration: "Debug",
derived_data_path: ".Build")
end
end
If I don't use Rosetta I see the following error in CircleCI.
Testing failed:
Simulator device failed to launch com.mycompany.myapp.debug.
MyApp encountered an error (Failed to install or launch the test runner. (Underlying Error: Simulator device failed to launch com.mycompany.myapp.debug. No such process. (Underlying Error: Application launch for 'com.mycompany.myapp.debug' did not return a process handle nor launch error. No such process)))
Anyone using simulators without rosetta in CircleCI + Apple silicon and has no problem doing so?
Upvotes: 1
Views: 101