Github Actions: xcpretty is not found despite being installed - ios

I'm trying to replace our iOS project's horrible Jenkins setup with Github Actions. I think I have all the pieces in place, but I'm getting a failure I don't understand. In the step where I run xcodebuild to build and test the app, I'm getting an error that xcpretty is an unknown command, despite being installed via bundler in a previous step. Here are the relevant files:
build-and-run.yml
---
name: Build & Test
on:
# Run tests when a PR merges.
push:
branches:
- develop
# Run tests when PRs are created or updated.
pull_request:
types: [opened, synchronize, reopened]
# Allow the workflow to be run manually.
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer
jobs:
test:
name: Build & Test
runs-on: 'macos-latest'
steps:
- name: Checkout Project
uses: actions/checkout#v2
with:
ref: develop
- name: Setup Ruby
uses: ruby/setup-ruby#v1.46.0
with:
ruby-version: 2.7.1
- name: Restore Ruby Cache
uses: actions/cache#v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Restore Pod Cache
uses: actions/cache#v1
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Bundle Install
run: |
bundle config path vendor/bundle
bundle install --without=documentation --jobs 4 --retry 3
- name: Install Cocoapods
run: pod install --repo-update
- name: Show Xcode Version
run: xcode-select -p
- name: Show Build Settings
run: xcodebuild -workspace ./MyApp.xcworkspace -scheme 'MyApp-Test' -destination 'platform=iOS Simulator,name=iPhone 11' -showBuildSettings
- name: Test MyApp
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace MyApp.xcworkspace -scheme MyApp-Test -destination 'platform=iOS Simulator,name=iPhone 11' -enableCodeCoverage YES -derivedDataPath build/derived-data clean test | xcpretty -s
- name: Run Danger
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
run: bundle exec danger
Gemfile (we don't use fastlane in the action, but I have to keep it in the Gemfile for now so the builds don't break on our Jenkins box):
source 'https://rubygems.org'
ruby '2.7.1'
gem 'cocoapods'
gem 'danger'
gem 'fastlane'
gem 'xcpretty'
gem 'danger-slather'
gem 'danger-swiftlint'
gem 'danger-xcode_summary'
gem 'xcpretty-json-formatter'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
In the Bundle Install step, the xcpretty gem is being installed:
Fetching xcpretty 0.3.0
Installing xcpretty 0.3.0
The Install Cocoapods step also works fine (probably because Cocoapods is pre-installed). When it gets to the Test MyApp step, the invocation creates an error:
Run set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace MyApp.xcworkspace -scheme MyApp-Test -destination 'platform=iOS Simulator,name=iPhone 11' -enableCodeCoverage YES -derivedDataPath build/derived-data clean test | xcpretty -s
/Users/runner/work/_temp/9d3633bf-6dae-45d7-a303-1c68abb63d53.sh: line 1: xcpretty: command not found
And then the workflow hangs for a very long time, so I usually cancel it. Any idea why xcpretty is not being found? My thought is, the directory where the gem is installed isn't in the search path, but I'm not sure about how I would do that. I'm sure there's a reasonable solution to this, but I'm having trouble finding it and am tired of banging my head against a wall.

I was facing the same issue while setting up fastlane to run my Xcode tests.
Finally, solved the issue by adding PATH in Jenkinsfile as below.
Note that SampleProject-TestCase-Executions is Sample app on my Desktop.
Please find GitHub Demo App for more info.
node {
stage "Run Fast file"
sh '''
cd /Users/bhooshanpatil/Desktop/SampleProject-TestCase-Executions
export PATH="$PATH:/usr/local/bin:/usr/local/bin:/usr/local/sbin$:"
fastlane scan
'''
}

Unfortunately, my solution was not at all tidy. I had to path into the gem installation directory and directly reference the gem executable. Thankfully, the relative path doesn't change, so I could just hardcode it into the test script. Maybe there's a more elegant solution, but once I got it working, I just dropped it.
And sorry if you're trying to reproduce this, but it was over a year ago and I left the company, so I don't have access to what the path was.

Jenkins -> Manage Jenkins -> Configure System -> Global properties -> Environment variables -> Name: LC_ALL, Value: en_US.UTF-8

Related

Detox build command working locally but failing in Github Action

I have a .detoxrc.json with the following config:
"apps": {
"ios": {
"type": "ios.app",
"binaryPath": "./ios/build/Build/Products/Debug-iphonesimulator/<my-app-demo>.app",
"build": "xcodebuild -workspace ios/<my-app>.xcworkspace -configuration Debug -scheme '<my-app-demo>' -sdk iphonesimulator -derivedDataPath ios/build"
}
},
This works fine locally, and I'm able to build and test successfully.
However, in github actions it fails every time. I've tried running the step as yarn detox build -c ios and as the actual command from the "build" instruction, but no luck.
Here's what I'm currently trying to do in the action's yml file:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
build:
name: iOS Simulator Tests
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout#v3
- name: Node
uses: actions/setup-node#v3
with:
node-version: 16
cache: "yarn"
- name: Cache node_modules
id: cache
uses: actions/cache#v2
with:
path: ./node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- name: Install node_modules
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Pod Install
run: cd ios && pod install && cd ..
- name: Install Applesimutils
run: |
brew tap wix/brew
brew install applesimutils
- name: Detox build
run: yarn detox build -c ios
- name: Detox test
run: yarn detox test -c ios --cleanup
Why would this not work on a github runner? As far as I know there's no special config I should need for this to run.
EDIT: Here are the logs that are outputting on failure:
2022-10-17T13:20:19.5286140Z error: /Users/runner/work/buyer-app/buyer-app/ios/my-app/main.jsbundle: No such file or directory (in target 'my-app Feat' from project 'my-app')
2022-10-17T13:20:19.5286460Z
2022-10-17T13:20:19.5290650Z CpResource /Users/runner/work/buyer-app/buyer-app/ios/my-app/assets /Users/runner/work/buyer-app/buyer-app/ios/build/Build/Products/Debug-iphonesimulator/my-app\ Feat.app/assets (in target 'my-app Feat' from project 'my-app')
2022-10-17T13:20:19.5292650Z cd /Users/runner/work/buyer-app/buyer-app/ios
2022-10-17T13:20:19.5293830Z builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Users/runner/work/buyer-app/buyer-app/ios/my-app/assets /Users/runner/work/buyer-app/buyer-app/ios/build/Build/Products/Debug-iphonesimulator/my-app\ Feat.app
2022-10-17T13:20:19.5294950Z error: /Users/runner/work/buyer-app/buyer-app/ios/my-app/assets: No such file or directory (in target 'my-app Feat' from project 'my-app')
2022-10-17T13:20:19.5295230Z
2022-10-17T13:20:19.5296230Z CpResource /Users/runner/work/buyer-app/buyer-app/ios/my-app-Omega.ttf /Users/runner/work/buyer-app/buyer-app/ios/build/Build/Products/Debug-iphonesimulator/my-app\ Feat.app/my-app-Omega.ttf (in target 'my-app Feat' from project 'my-app')
2022-10-17T13:20:19.5296910Z cd /Users/runner/work/buyer-app/buyer-app/ios
2022-10-17T13:20:19.5297970Z builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Users/runner/work/buyer-app/buyer-app/ios/my-app-Omega.ttf /Users/runner/work/buyer-app/buyer-app/ios/build/Build/Products/Debug-iphonesimulator/my-app\ Feat.app
2022-10-17T13:20:19.5298790Z
2022-10-17T13:20:19.6324520Z ** BUILD FAILED **
2022-10-17T13:20:19.6324780Z
2022-10-17T13:20:19.6324790Z
2022-10-17T13:20:19.6325000Z The following build commands failed:
2022-10-17T13:20:19.6326500Z CpResource /Users/runner/work/buyer-app/buyer-app/ios/my-app/main.jsbundle /Users/runner/work/buyer-app/buyer-app/ios/build/Build/Products/Debug-iphonesimulator/my-app\ Feat.app/main.jsbundle (in target 'my-app Feat' from project 'my-app')
2022-10-17T13:20:19.6327810Z CpResource /Users/runner/work/buyer-app/buyer-app/ios/my-app/assets /Users/runner/work/buyer-app/buyer-app/ios/build/Build/Products/Debug-iphonesimulator/my-app\ Feat.app/assets (in target 'my-app Feat' from project 'my-app')
2022-10-17T13:20:19.6328290Z (2 failures)
2022-10-17T13:20:19.6446800Z 13:20:19.644 detox[12824] WARN: [build.js]
2022-10-17T13:20:19.6448980Z
2022-10-17T13:20:19.6450160Z Important: 'detox build' is a convenience shortcut for calling your own build command, as provided in the config file.
2022-10-17T13:20:19.6451260Z Failures in this build command are not the responsibility of Detox. You are responsible for maintaining this command.
2022-10-17T13:20:19.6451830Z
2022-10-17T13:20:19.6453150Z 13:20:19.644 detox[12824] ERROR: [cli.js] Command failed: xcodebuild -workspace ios/my-app.xcworkspace -configuration Debug -scheme 'my-app Feat' -sdk iphonesimulator -derivedDataPath ios/build
2022-10-17T13:20:19.6455530Z
2022-10-17T13:20:19.6647490Z error Command failed with exit code 1.
2022-10-17T13:20:19.6648170Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2022-10-17T13:20:19.6746380Z ##[error]Process completed with exit code 1.

how to select xcode version in fastlane when using github actions

I am using fastlane in github actions to build my project, this is my github actions script:
name: Cruise-CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout#v2
- uses: actions/setup-java#v1
with:
java-version: '12.x'
- uses: subosito/flutter-action#v1
with:
flutter-version: '1.22.5'
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_12.1.app/Contents/Developer'
- name: Bundle install
run: cd ./ios && bundle install && bundle update fastlane
- name: Install tools
run: |
flutter precache
flutter pub get
cd ./ios && pod repo update && pod install
#- run: flutter pub get
#- run: flutter build apk
#- run: flutter build ios --release --no-codesign
- name: Setup SSH Keys and known_hosts for fastlane match
run: |
SSH_PATH="$HOME/.ssh"
mkdir -p "$SSH_PATH"
touch "$SSH_PATH/known_hosts"
echo "$PRIVATE_KEY" > "$SSH_PATH/id_rsa"
chmod 700 "$SSH_PATH"
ssh-keyscan github.com >> ~/.ssh/known_hosts
chmod 600 "$SSH_PATH/known_hosts"
chmod 600 "$SSH_PATH/id_rsa"
eval $(ssh-agent)
ssh-add "$SSH_PATH/id_rsa"
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to TestFlight/PGY
run: |
cd ./ios && bundle exec fastlane beta
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
GIT_URL: ${{ secrets.GIT_URL }}
PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS: ${{ secrets.DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS }}
and this is my Fastfile script:
update_fastlane
default_platform(:ios)
platform :ios do
desc "Push a new beta build to pgy"
before_all do
ENV["CACHE_GIT_URL"] = ENV["GIT_URL"]
end
lane :beta do
xcode_select('/Applications/Xcode_12.1.app')
if is_ci
create_keychain(
name: ENV['MATCH_KEYCHAIN_NAME'],
password: ENV["MATCH_KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: false
)
end
match(
app_identifier: ENV["APP_IDENTIFIER"],
git_url: ENV["GIT_URL"],
type: "adhoc",
readonly: is_ci,
keychain_name: ENV['MATCH_KEYCHAIN_NAME'],
keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"]
)
build_app(
workspace: "Runner.xcworkspace",
scheme: "Runner",
export_method: "ad-hoc"
)
pgyer(
api_key: ENV['PGY_API_KEY'],
user_key: ENV['PGY_USER_KEY']
)
end
end
but when runs in github actions shows this error:
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
(1 failure)
[04:51:35]: Exit status: 65
[04:51:35]:
[04:51:35]: Maybe the error shown is caused by using the wrong version of Xcode
[04:51:35]: Found multiple versions of Xcode in '/Applications/'
[04:51:35]: Make sure you selected the right version for your project
[04:51:35]: This build process was executed using '/Applications/Xcode_12.1.app'
[04:51:35]: If you want to update your Xcode path, either
[04:51:35]:
[04:51:35]: - Specify the Xcode version in your Fastfile
[04:51:35]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[04:51:35]:
[04:51:35]: - Specify an absolute path to your Xcode installation in your Fastfile
[04:51:35]: ▸ xcode_select "/Applications/Xcode8.app"
[04:51:35]:
[04:51:35]: - Manually update the path using
[04:51:35]: ▸ sudo xcode-select -s /Applications/Xcode.app
[04:51:35]:
+---------------+------------------------------+
| Build environment |
+---------------+------------------------------+
| xcode_path | /Applications/Xcode_12.1.app |
| gym_version | 2.171.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS14.1.sdk |
+---------------+------------------------------+
[04:51:35]: ▸ ../../../hostedtoolcache/flutter/1.22.5-stable/x64/packages/flutter/lib/src/widgets/scroll_view.dart:588:9: Context: Found this candidate, but the arguments don't match.
[04:51:35]: ▸ const CustomScrollView({
[04:51:35]: ▸ ^^^^^^^^^^^^^^^^
[04:51:35]: ▸ Command PhaseScriptExecution failed with a nonzero exit code
[04:51:35]:
[04:51:35]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[04:51:35]: 📋 For the complete and more detailed error log, check the full log at:
[04:51:35]: 📋 /Users/runner/Library/Logs/gym/Runner-Runner.log
[04:51:35]:
[04:51:35]: Looks like fastlane ran into a build/archive error with your project
[04:51:35]: It's hard to tell what's causing the error, so we wrote some guides on how
[04:51:35]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[04:51:35]: Before submitting an issue on GitHub, please follow the guide above and make
[04:51:35]: sure your project is set up correctly.
[04:51:35]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[04:51:35]: the full commands printed out in yellow in the above log.
[04:51:35]: Make sure to inspect the output above, as usually you'll find more error information there
[04:51:35]:
+------------------------------------+--------------------------------------------------------+
| Lane Context |
+------------------------------------+--------------------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/*** |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/login.keychain-db" |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.earth.dolphin"=>"match AdHoc com.earth.dolphin"} |
+------------------------------------+--------------------------------------------------------+
[04:51:35]: Error building the application - see the log above
I have already tried to specify the version of xcode in fastlane file like this:
xcode_select('/Applications/Xcode_12.1.app')
but still not work, what should I do to fix this? I also tried to change the xcode version to 12.3 follow this doc like this:
xcode_select('/Applications/Xcode_12.3.app')
still now work.
You are running on the latest MacOS image (which, at time of writing, is macos-10.15 with Xcode 12.4.0.0.1.1610135815—see installed tools):
jobs:
build:
runs-on: macos-latest
But you are trying to select a specific version of Xcode to use:
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_12.1.app/Contents/Developer'
The latest MacOS version (and the installed Xcode version) are liable to change if you use the -latest suffix when specifying the runs-on image.
Ensure that your MacOS and Xcode versions are compatible or just remove the Select Xcode version step entirely.

iOS Github Actions (build, test and deploy)

I'm trying to make a simple workflow using github actons, so when I push for example to my master branch, it builds the code in macOS-latest and test it on OS 12.4, iPhone 11 Pro Max.
Since it's very new, the tutorials are not complete, can someone lend me hand?
This is what I have for now:
name: StyleOn_Workflow
on: [push]
jobs:
build:
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']
steps:
- uses: actions/checkout#master
- name: Build
run: swift build -v
test:
name: Test
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']
steps:
- name: Checkout
uses: actions/checkout#master
- name: Run tests
run: swift test -v
Also since I'm not deploying the app to the app store, how can I do the deployment phase? Maybe merge it to the master branch? I need to have 3 phases, build, test and deploy
This is the error I'm getting:
Based on your question I think you should use xcodebuild command line tool instead of swift build and swift test.
As I see you should use a command like this for build:
set -o pipefail && xcodebuild clean -scheme $SCHEME -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH build-for-testing
And use this for testing:
set -o pipefail && xcodebuild test-without-building -xctestrun $(find . -type f -name "*.xctestrun") -destination "platform=iOS Simulator,name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES
Please note that between jobs you should upload and download the .xctestrun file.
You can find a detailed example here.

Failing to execute tests in Bitrise for debug variant

Description
I'm using Bitrise to run Detox tests. The build command runs ok and is a success. But the test command always fails.
Running locally:
Command detox test -c ios.sim.debug without starting the packager: 'No bundle URL present' error
Command detox test -c ios.sim.debug with the packager: Opens the packager and everything runs OK.
Command detox test -c ios.sim.release without the packager: works fine.
Command detox test -c ios.sim.release with the packager: works fine.
Running in Bitrise:
Command detox test -c ios.sim.debug --cleanup without starting the packager: 'No bundle URL present' error
Command detox test -c ios.sim.debug --cleanup with the packager:
Verify tests are up
"before all" hook:
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/vagrant/git/e2e/tests.spec.js)
Command detox test -c ios.sim.release --cleanup without the packager: works fine.
Command detox test -c ios.sim.release --cleanup with the packager: works fine.
Disclaimer
With/Without the packager means the variable RCT_NO_LAUNCH_PACKAGER equals false/true, respectively.
The package.json file
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PROJECT_NAME.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/PROJECT_NAME.xcworkspace -scheme INTEGRATION_SCHEME -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/PROJECT_NAME.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/PROJECT_NAME.xcworkspace -scheme PRODUCTION_SCHEME -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7 Plus"
},
The bitrise.yml file
_init_install:
steps:
- activate-ssh-key#3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone#4.0.11: {}
- script#1.1.5:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
brew uninstall --ignore-dependencies node
brew install node#8
brew link --overwrite --force node#8
- yarn#0.0.7: {}
_detox_tests:
steps:
- npm#0.9.0:
title: Install Detox CLI
inputs:
- command: install -g detox-cli
- npm#0.9.0:
title: Install React-Native CLI
inputs:
- command: install -g react-native-cli
- script#1.1.5:
title: Install Detox Utils
inputs:
- content: |-
#!/bin/bash
brew tap facebook/fb
export CODE_SIGNING_REQUIRED=NO
brew install fbsimctl
brew tap wix/brew
brew install applesimutils --HEAD
- script#1.1.5:
title: Detox - Build Debug App
inputs:
- content: |-
#!/usr/bin/env bash
detox build -c ios.sim.debug
- script#1.1.5:
title: Detox - Run E2E Tests
inputs:
- content: |-
#!/usr/bin/env bash
detox test -c ios.sim.debug --cleanup
- deploy-to-bitrise-io#1.3.10: {}
test_ios:
before_run:
- _init_install
after_run:
- _detox_tests
steps:
- cocoapods-install#1.7.2:
inputs:
- podfile_path: ios/Podfile
- resource-archive#2.0.1:
inputs:
- extract_to_path: "$HOME/Documents/FacebookSDK/"
- archive_url:https://origincache.facebook.com/developers/resources/?id=facebook-ios-sdk-current.zip
- certificate-and-profile-installer#1.9.3: {}
```
Detox, Node, Device, Xcode and macOS Versions
Detox: v7.4.3
React Native: v0.51.0
Node: v9.4.0
Device: iPhone 7 (simulator)
Xcode: Version 9.3 (9E145)
macOS: 10.13.3 (17D102)
Device and verbose Detox logs
Error detox test -c ios.sim.debug --cleanup with the packager
pastebin
File detox.last_launch_app_log.err prints:
pastebin
TL;DR
I get an error when running Detox with Bitrise. The command detox test -c ios.sim.debug --cleanup should open a packager but looks like it's not doing it.
The version that is needed to test is the Debug one, no other options. Maybe I missed something about the installation, but all the files were checked with official docs and other examples and are the identical.
Related issues: 742, 749, 740

Tests pass in Xcode but fail on Circle CI

Question: For this pull request, the tests do not pass on CircleCI but the tests pass locally. Why?
The CircleCI test output shows failures for all FBSnapshotTestCase tests. For example:
✗ testAdjustsFontSizeToFitWidth, ((comparisonSuccess__) is true) failed - Snapshot comparison failed: Error Domain=FBSnapshotTestControllerErrorDomain Code=1 "Unable to load reference image." UserInfo=0x7f85f36b0a50 {NSLocalizedFailureReason=Reference image not found. You need to run the test in record mode, NSLocalizedDescription=Unable to load reference image., FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAdjustsFontSizeToFitWidth#2x.png}
[…]
✗ testAttributedTruncationToken, ((comparisonSuccess__) is true) failed - Snapshot comparison failed: Error Domain=FBSnapshotTestControllerErrorDomain Code=1 "Unable to load reference image." UserInfo=0x7f85f35b06d0 {NSLocalizedFailureReason=Reference image not found. You need to run the test in record mode, NSLocalizedDescription=Unable to load reference image., FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAttributedTruncationToken#2x.png}
However, the same tests pass locally:
On CircleCI the tests use the ReferenceImages_32 directory, which does not exist:
/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAdjustsFontSizeToFitWidth#2x.png
However, the images do exist in ReferenceImages_64. I expect the _64 directory to be used because the circle.yml file specifies to use the iPhone 6 simulator:
dependencies:
pre:
- xcrun instruments -w "iPhone 6 (8.3 Simulator)" || exit 0
override:
- sudo gem install cocoapods xcpretty obcd -N
- pod install --project-directory=Example
test:
override:
- set -o pipefail && xcodebuild -workspace 'Example/Espressos.xcworkspace' -scheme 'Espressos'
-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6"
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c
--report junit --output ${CIRCLE_TEST_REPORTS}/junit.xml
What causes this?
How can I get the tests passing on CircleCI?
Possibly related: this FBSnapshotTestCase issue
Have you tried running the build without the cache? This often fixes these kinds of issues for me. To build without cache, just click the button at the top right.

Resources