Reputation: 418
I am experiencing the below error when building a MacOS project using FastLane on circleCI. I am able to build the project locally using bundle exec fastlane test
, so the problem would seem to be related to the CircleCI environment, but am at a loss as to how to track it down. I am able to reproduce it on the command line when I ssh into CircleCI.
Here is the error:
bundler: failed to load command: fastlane (/usr/local/bin/fastlane) NoMethodError: [!] undefined method `each' for nil:NilClass /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/scan/lib/scan/runner.rb:172:in `copy_simulator_logs' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/scan/lib/scan/runner.rb:108:in `handle_results' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/scan/lib/scan/runner.rb:22:in `run' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/scan/lib/scan/manager.rb:23:in `work' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/actions/run_tests.rb:16:in `run' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/runner.rb:261:in `block (2 levels) in execute_action' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/runner.rb:253:in `block in execute_action' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/runner.rb:227:in `chdir' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/runner.rb:227:in `execute_action' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing' Fastfile:26:in `block (2 levels) in parsing_binding' /Library/Ruby/Gems/2.6.0/gems/fastlane-2.149.1/fastlane/lib/fastlane/lane.rb:33:in `call' ----snip----
My Fastfile looks like this:
default_platform :mac
platform :mac do
before_all do
setup_circle_ci
end
desc "Runs all the tests"
lane :test do
scan(skip_testing: "ChronosUITests")
end
desc "Ad-hoc build"
lane :adhoc do
match(type: "adhoc")
gym(export_method: "ad-hoc")
end
end
and my circleci config is this:
# .circleci/config.yml
version: 2.1
jobs:
build-and-test:
macos:
xcode: 11.5.0
environment:
FL_OUTPUT_DIR: output
FASTLANE_LANE: test
steps:
- checkout
# https://support.circleci.com/hc/en-us/articles/360044709573-Swift-Package-Manager-fails-to-clone-from-private-Git-repositories
- run: rm ~/.ssh/id_rsa
- run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
- run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
# -------
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: output
- store_test_results:
path: output/scan
adhoc:
macos:
xcode: 11.5.0
environment:
FL_OUTPUT_DIR: output
FASTLANE_LANE: adhoc
steps:
- checkout
# https://support.circleci.com/hc/en-us/articles/360044709573-Swift-Package-Manager-fails-to-clone-from-private-Git-repositories
- run: rm ~/.ssh/id_rsa
- run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
- run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
# -----
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: output
workflows:
build-test-adhoc:
jobs:
- build-and-test
- adhoc:
filters:
branches:
only: development
requires:
- build-and-test
Upvotes: 0
Views: 1255
Reputation: 418
I discovered a solution, or at lease a workaround. The failing step is copying simulator logs (does this even apply to a mac project?). In any case, adding the option to not include simulator logs fixed the issue.
scan(include_simulator_logs: false)
Upvotes: -2