Giter VIP home page Giter VIP logo

react-native-circleci-orb's Introduction

React Native CircleCI Orb

CircleCI Orb

A CircleCI Orb to simplify testing your React Native app.

Why?

Setting up CircleCI to test your React Native app correctly is hard. You need to consider using the correct machine type, installing the correct dependencies, running the correct commands, and correctly setting up caching to speed up builds. All of this is complicated and involves a lot of trial and error.

With this Orb we provide simple reusable building blocks which you can use to do the right thing easily.

Overview

First, we recommend reading the Using Orbs guide from the CircleCI documentation to get an overview of how to use Orbs.

This Orb provides three different categories of tools to help you build and test your React Native app on CircleCI:

  • Executors: Machines which are configured for use with React Native.
  • Commands: Individual tasks which you can piece together in your own jobs to perform tasks like installing dependencies, building an APK, or running Detox tests.
  • Jobs: Groups of commands which are typically used together as a stage in a pipeline.

Setup

Firstly, as this is a 3rd Party Orb, you need to go into your organisations settings, press on "Security", and enable usage of 3rd Party Orbs.

You will also need to ensure that you have a MacOS plan enabled if you want to build and test your iOS app, or if you want to test your Android app. Open Source projects can contact CircleCI to ask them to enable it and private projects need to select a payment plan.

Documentation

You can read the full documentation here.

Android

Add this task in your /app/build.gradle

task downloadDependencies() {
  description 'Download all dependencies to the Gradle cache'
  doLast {
    configurations.findAll().each { config ->
      if (config.name.contains("minReactNative") && config.canBeResolved) {
        print config.name
        print '\n'
        config.files
      }
    }
  }
}

Example

Here is a full example of how the Orb can be used in a CircleCI workflow to build and test a React Native app:

# Orb support is from version >= 2.1
version: 2.1

# Make sure you use the latest version of the Orb!
orbs:
  rn: react-native-community/[email protected]

# Custom jobs which are not part of the Orb
jobs:
  checkout_code:
    executor: rn/linux_js
    steps:
      - checkout
      - persist_to_workspace:
          root: .
          paths: .
  analyse_js:
    executor: rn/linux_js
    steps:
      - attach_workspace:
          at: .
      - rn/yarn_install
      - run:
          name: Run ESLint
          command: yarn eslint
      - run:
          name: Flow
          command: yarn flow
      - run:
          name: Jest
          command: yarn jest

workflows:
  test:
    jobs:
      # Checkout the code and persist to the Workspace
      # Note: This is a job which is defined above and not part of the Orb
      - checkout_code

      # Analyze the Javascript using ESLint, Flow, and Jest
      # Note: This is a job which is defined above and not part of the Orb
      - analyse_js:
          requires:
            - checkout_code

      # Build the Android app in debug mode
      - rn/android_build:
          name: build_android_debug
          project_path: "android"
          build_type: debug
          requires:
            - analyse_js

      # Build and test the Android app in release mode
      # Note: We split these into seperate jobs because we can build the Android app on a Linux machine and preserve the expensive MacOS executor minutes for when it's required
      - rn/android_build:
          name: build_android_release
          project_path: "android"
          build_type: release
          requires:
            - analyse_js
      - rn/android_test:
          detox_configuration: "android.emu.release"
          requires:
            - build_android_release


      # Build the iOS app in release mode and do not run tests
      - rn/ios_build:
          name: build_ios_release
          project_path: ios/Example.xcodeproj
          device: "iPhone 11"
          build_configuration: Release
          scheme: Example
          requires:
            - analyse_js

      # Build and test the iOS app in release mode
      - rn/ios_build_and_test:
          project_path: "ios/Example.xcodeproj"
          device: "iPhone 11"
          build_configuration: "Release"
          scheme: "Example"
          detox_configuration: "ios.sim.release"
          requires:
            - analyse_js

This is what the final workflow will look like:

Example React Native CircleCI Orb Workflow

License

The Orb is released under the MIT license. For more information see LICENSE.

react-native-circleci-orb's People

Contributors

ahdinosaur avatar anthonymayer avatar chakrihacker avatar chnb128 avatar compojoom avatar cortinico avatar dependabot[bot] avatar devnev avatar fotos avatar gretzky avatar jsdotcr avatar kantorm avatar kyonru avatar matt-oakes avatar maxim-filimonov avatar mikehardy avatar mislavcimpersak avatar naturalclar avatar peeja avatar phsantiago avatar roni-castro avatar ronwsmith avatar semantic-release-bot avatar springcoil avatar strikerrus avatar tbetous avatar timkuilman avatar vabanagas avatar vonovak avatar zhpd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-circleci-orb's Issues

React Native 0.64.X android builds will fail with current build command

Orb version

v5.1.0

What happened

I've been trying to fix some issues with my app running with the orb, I'd opened an issue here which describes it fully, believing it to be related to the tool I used to initialise the app: infinitered/ignite#1676 , but it seems that since react-native 0.64 there has been a bump to the minSdkVersion, see lines 392:

https://github.com/facebook/react-native/blob/0.63-stable/ReactAndroid/build.gradle
https://github.com/facebook/react-native/blob/0.64-stable/ReactAndroid/build.gradle

As a result this causes the assembleAndroidTest to fail, meaning the build fails and can't run detox tests as no APK produced.

Now I'm not exactly certain on the entire process the orb has, so forgive me if this is a naive approach, I was wondering if:

  1. adjusting the command to target just app:assembleAndroidTest
  2. adding the option to remove it from the build job
  3. move it to the test job
    would be suitable?

I was thinking I'd add a PR for an additional string, or enum parameter [assembleAndroidTest,app:assembleAndroidTest, ``] (figure this guides people to either be all the tests, just app, or none, but string would be more flexible)- that allows users to adjust the command for react-native 0.64+ users whilst package maintainers increase their minSdkVersion?

Build failed: Unrecognized VM option 'UseCGroupMemoryLimitForHeap'

Orb version: 5.6.0

What happened

The build failed with the following error (in "Downloading Gradle Dependencies"):

Picked up _JAVA_OPTIONS: -Xmx2g -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
Unrecognized VM option 'UseCGroupMemoryLimitForHeap'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Exited with code exit status 1

I noticed this orb uses a non-pinned image of react-native-community/react-native, and that image was updated last week to use JDK 11 which completely removes the UseCGroupMemoryLimitForHeap option.

I'm not that familiar with JVM options so I just changed config.yml to pass java_options without that flag and the build succeeded. Moving forward I found this article which might help decide with the defaults should be.

Can't replace existing directory with non-directory tar

Orb version

5.6.0

What happened

using this yaml code

  • rn/ios_build:
    build_configuration: Release
    device: iPhone X
    name: build_ios_release
    project_path: ios/Example.xcodeproj
    requires:
    - analyse_js
    scheme: Example

I get this error

Found a cache from build 287 at brew-cache-arch1-darwin-amd64-6_58-4

Size: 988 MiB
Cached paths:

  • /usr/local/Homebrew
  • /Users/distiller/Library/Caches/Homebrew

Downloading cache archive...
Unarchiving cache...

Failed to unarchive cache

Error untarring cache: Error extracting tarball /var/folders/6y/gy9gggt14379c_k39vwb50lc0000gn/T/cache2953294140 : usr/local/Homebrew/Library/Homebrew/shims/scm: Can't replace existing directory with non-directory tar: Error exit delayed from previous errors. : exit status 1

Expected behavior

A build for ios should be created

Run android_test in linux_android instead of macos

What would you like to be added

I would prefer not to rely on macos if testing for Android.

Why is this needed

I currently want to test only Android on CircleCI and therefore does not have a plan to run macos machines. I should be able to use the orb for android without macos machines

On a side note, I'm not sure if it was intended to run android_test in macos while android_build run on android_linux

newer macos executors?

Question

You've set the default macOS executor to version 10.1.0 - which is pretty old. I tried setting it to a newer version, but then Homebrew has issues...

Is this the reason why you've selected 10.1.0 as default?

get it to work with fastlane

Orb version

5.6.0

What happened

trying to deploy to fastlane gives this error

#!/bin/bash -eo pipefail
bundle exec fastlane android debug
/bin/bash: bundle: command not found

Exited with code exit status 127
CircleCI received exit code 127

Expected behavior

React native app should deploy to fastlane

Add support for NDK install/update

What would you like to be added

I would like to have ability to specify NDK version in ci config.

Why is this needed

It's need because I need to manage own docker image with up-to-date NDK.

* What went wrong:
Execution failed for task ':app:stripStageReleaseDebugSymbols'.
> No version of NDK matched the requested version 21.0.6113669. Versions available locally: 20.1.5948944

When running android_test it throws cmd: Can't find service: package

First off, thanks very much for the effort put into this library! It has saved a tone of time and is really well thought-out and built. My issue is that I am having trouble running the android_test command. I followed the setup and docs but the CI gives me issues. I am wondering if the docs are missing some sort of install or Circle CI setup step?

This is the configuration I am using:

  - react_native/android_build:
      name: build_android_release
      project_path: 'android'
      build_type: release
      requires:
        - analyse_js
  - react_native/android_test:
      name: test_android_release
      detox_configuration: 'android.emu.release'
      requires:
        - build_android_release

What happened

detox[6799] INFO:  [test.js] DETOX_CONFIGURATION="android" DETOX_FORCE_ADB_INSTALL=false DETOX_HEADLESS=true DETOX_LOGLEVEL="warn" DETOX_READ_ONLY_EMU=false DETOX_REPORT_SPECS=true DETOX_START_TIMESTAMP=1612191220884 DETOX_USE_CUSTOM_LOGGER=true jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e
detox[7045] ERROR: Error: Exceeded timeout of 300000ms while handling jest-circus "setup" event

detox[7045] ERROR: DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

HINT: Most likely, your test runner is tearing down the suite due to the timeout error
detox[7045] ERROR: [exec.js/EXEC_FAIL, #15] ""/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"" failed with code = 20, stdout and stderr:

detox[7045] ERROR: [exec.js/EXEC_FAIL, #15] 
detox[7045] ERROR: [exec.js/EXEC_FAIL, #15] cmd: Can't find service: package

detox[7045] ERROR: [exec.js/EXEC_FAIL, #32] ""/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"" failed with code = 20, stdout and stderr:

detox[7045] ERROR: [exec.js/EXEC_FAIL, #32] 
detox[7045] ERROR: [exec.js/EXEC_FAIL, #32] cmd: Can't find service: package

detox[7045] ERROR: ChildProcessError: Command failed: "/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"
cmd: Can't find service: package
 `"/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"` (exited with error code 20)

detox[7045] ERROR: [exec.js/EXEC_FAIL, #38] ""/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "settings put global animator_duration_scale 0"" failed with code = 20, stdout and stderr:

detox[7045] ERROR: [exec.js/EXEC_FAIL, #38] 
detox[7045] ERROR: [exec.js/EXEC_FAIL, #38] cmd: Can't find service: settings

detox[7045] ERROR: ChildProcessError: Command failed: "/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "settings put global animator_duration_scale 0"
cmd: Can't find service: settings
 `"/usr/local/share/android-sdk/platform-tools/adb" -s emulator-5554 shell "settings put global animator_duration_scale 0"` (exited with error code 20)

detox[7045] ERROR: [EmulatorLauncher.js/SPAWN_FAIL] `/usr/local/share/android-sdk/emulator/emulator -verbose -no-audio -no-boot-anim -no-window -port 19378 @TestingAVD -gpu host` failed with code 1
  err: ChildProcessError: `/usr/local/share/android-sdk/emulator/emulator -verbose -no-audio -no-boot-anim -no-window -port 19378 @TestingAVD -gpu host` failed with code 1
      at ChildProcess.<anonymous> (/Users/distiller/project/node_modules/child-process-promise/lib/index.js:132:23)
      at ChildProcess.emit (events.js:198:13)
      at maybeClose (internal/child_process.js:982:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
detox[7045] ERROR: [EmulatorLauncher.js/SPAWN_FAIL] emulator: autoconfig: -skin 768x1280
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel /usr/local/share/android-sdk/system-images/android-28/google_apis/x86//kernel-ranchu-64
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /usr/local/share/android-sdk/system-images/android-28/google_apis/x86//ramdisk.img
emulator: Using initial system image: /usr/local/share/android-sdk/system-images/android-28/google_apis/x86//system.img
emulator: Using initial vendor image: /usr/local/share/android-sdk/system-images/android-28/google_apis/x86//vendor.img
emulator: autoconfig: -data /Users/distiller/.android/avd/TestingAVD.avd/userdata-qemu.img
emulator: autoconfig: -initdata /Users/distiller/.android/avd/TestingAVD.avd/userdata.img
emulator: autoconfig: -cache /Users/distiller/.android/avd/TestingAVD.avd/cache.img
emulator: Increasing RAM size to 1536MB
emulator: VM heap size 0MB is below hardware specified minimum of 384MB,setting it to that value
emulator: System image is read only
emulator: Found 2 DNS servers: 8.8.8.8 8.8.4.4
emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.
Please use -read-only flag to enable this feature.


detox[7045] ERROR: ChildProcessError: `/usr/local/share/android-sdk/emulator/emulator -verbose -no-audio -no-boot-anim -no-window -port 19378 @TestingAVD -gpu host` failed with code 1

detox[6799] ERROR: [cli.js] Error: Command failed: jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e


Exited with code exit status 1

Expected behavior

Ideally the tests should run without issues.

If there is some additional setup needed I happy to contribute to the docs.

Support Docker Authentication

What would you like to be added

Add parameters to the orb so that Docker executors can use authenticated retrieval.

Why is this needed

Docker Hub is changing its auth scheme and will begin limiting anonymous pulls as of 2 November 2020. This will cause users of this orb to have failed jobs.

Node version mismatch with the rn/ios_build job

Orb version

3.0.0

What happened

Executor has Node v11.0.0 installed, even when v10 specified for the rn/ios_build job.

Expected behavior

Node v10 should be installed.

Reproduction:

This is my config file:

version: 2.1

orbs:
    rn: react-native-community/[email protected]

workflows:
    version: 2
    buildit:
        jobs:
            - rn/ios_build:
                build_configuration: Release
                device: Generic iOS Device
                name: build_ios_release
                project_path: ios/MyProject.xcodeproj
                scheme: release
                checkout: true

And this is my output from the Configure Detox Envionment step in the pipeline:

#!/bin/bash --login -eo pipefail
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install node@10 >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install android-sdk >/dev/null
touch .watchmanconfig
node -v

v11.0.0
CircleCI received exit code 0

As you can see, even though this orb defaults to Node v10, it seems like Node v11 is getting installed. Perhaps Node v11 is now installed by default on CircleCI's Mac executors? I'm not sure why else an install of node@10 would result in node -v returning v11.0.0.

Detox test on iOS

Question

All the steps to build and test my iOS app on CircleCi have succeeded, except for the
"Detox Test "one.
Do I need to add any configuration to run this last step (Install Detox lib)?
Is it possible to just build the iOS and not run the Detox commands (Configure Detox Environment and Detox tests) as I use Jest+ Enzyme to do it?

CircleCi result print

#!/bin/bash --login -eo pipefail
detox test -c ios.sim.release -l warn --headless
/bin/bash: detox: command not found

Exited with code exit status 127

Version:
react-native-community/[email protected]
react-native: 0.59.9

.config.yml

      - rn/ios_build_and_test:
          # <<: *master_only
          project_path: ios/OlistApp.xcodeproj
          device: iPhone X
          build_configuration: Debug
          scheme: OlistApp
          detox_configuration: ios.sim.release
          requires:
            - analyse_js

android_build command fails

Bug

downloadDependencies task not found when running android_build command


FAILURE: Build failed with an exception.

* What went wrong:
Task 'downloadDependencies' not found in root project 'XXXX'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 8s
Exited with code 1

Environment info

React native info output:

React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
      Memory: 1.26 GB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.17.3 - ~/.nvm/versions/node/v10.16.0/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28, 29
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.1, 25.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.1
        System Images: android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.8.3 => 16.9.0
      react-native: 0.59.4 => 0.59.4
    npmGlobalPackages:
      react-native-cli: 2.0.1

Steps To Reproduce

On a fresh react-native project

  1. android/gradlew downloadDependencies -p android will not find the task to download dependencies

This is the same as the step here

Describe what you expected to happen:

  1. I guess because this task doesn't exist that it shouldn't be called. Ideally there's another task or some way to add the task to the project

Install Android Emulator Step Fails

Orb version

version: 5.1.0

config.yml

version: 2.1

orbs:
  rn: react-native-community/[email protected]

jobs:
  checkout_code:
    executor:
      name: rn/linux_js
      node_version: '12'
    steps:
      - checkout
      - persist_to_workspace:
          paths: .
          root: .
  analyse_js:
    executor:
      name: rn/linux_js
      node_version: '12'
    steps:
      - attach_workspace:
          at: .
      - rn/yarn_install
      - run:
          command: yarn jest
          name: Run Tests

workflows:
  test:
    jobs:
      - checkout_code
      - analyse_js:
          requires:
            - checkout_code
      - rn/android_build:
          name: build_android_release
          project_path: 'android'
          build_type: release
          requires:
            - analyse_js
      - rn/android_test:
          detox_configuration: 'android.emu.release'
          device_name: Pixel_2_API_29
          platform_version: android-29
          build_tools_version: '29.0.3'
          yarn_cache: false
          requires:
            - build_android_release

        # Build and test the iOS app in release mode
      - rn/ios_build_and_test:
          checkout: true
          project_path: 'ios/awesomeapp.xcworkspace'
          project_type: workspace
          device: 'iPhone 11'
          pod_install_directory: ios
          build_configuration: 'Release'
          scheme: 'awesomeapp'
          detox_configuration: 'ios.sim.release'
          yarn_cache: false
          xcodebuild_cache: false
          requires:
            - analyse_js

What happened

Build fails at step "Install Android Emulator".

image

Error transcript

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 5 more

Expected behavior

The emulator is installed, the app installed, and the e2e tests running.

rn/ios_build_and_test job failing at Homebrew installation

Bug

Hey guys, really excited about this orb!

I am getting an error when trying to use the rn/ios_build_and_test job. This is the output in circle ci:

#!/bin/bash -eo pipefail
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install node@8 >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install android-sdk >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install intel-haxm >/dev/null
touch .watchmanconfig
node -v
^D��^D��Cloning into '/usr/local/Homebrew/Library/Taps/wix/homebrew-brew'...
remote: Enumerating objects: 8, done.        
remote: Counting objects: 100% (8/8), done.        
remote: Compressing objects: 100% (7/7), done.        
remote: Total 8 (delta 0), reused 5 (delta 0), pack-reused 0        
Unpacking objects: 100% (8/8), done.
Error: Failure while executing; `/usr/bin/sudo -E -- env PATH=/usr/local/bin:/usr/local/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm:/usr/bin:/bin:/usr/sbin:/sbin /usr/local/Caskroom/intel-haxm/7.3.2/silent_install.sh` exited with 1. Here's the output:
Silent installation failed, please see /private/tmp/haxm_silent_run.log for details!

Follow the instructions here:
  https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/system_command.rb:107:in `assert_success'
/usr/local/Homebrew/Library/Homebrew/system_command.rb:50:in `run!'
/usr/local/Homebrew/Library/Homebrew/system_command.rb:27:in `run'
/usr/local/Homebrew/Library/Homebrew/system_command.rb:31:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/artifact/installer.rb:45:in `install_phase'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:207:in `block in install_artifacts'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/set.rb:674:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/set.rb:674:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:198:in `install_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:95:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:21:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:14:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:14:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/abstract_command.rb:34:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:89:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:155:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:120:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:89:in `<main>'
Exited with code 1

This is my circle ci config:

jobs:
  analyse_js:
    executor: rn/linux_js
    steps:
      - attach_workspace:
          at: .
      - rn/yarn_install
      - run:
          command: yarn jest
          name: Jest
  checkout_code:
    executor: rn/linux_js
    steps:
      - checkout
      - persist_to_workspace:
          paths: .
          root: .

orbs:
  rn: react-native-community/[email protected]
version: 2.1
workflows:
  test:
    jobs:
      - checkout_code
      - analyse_js:
          requires:
            - checkout_code
      - rn/ios_build_and_test:
          build_configuration: Release
          detox_configuration: ios.sim.release
          device: iPhone X
          project_path: ios/{MyApp}.xcworkspace
          project_type: workspace
          requires:
            - analyse_js
          scheme: {MyApp}

Environment info

React native info output:

  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
      Memory: 75.29 MB / 8.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
      Yarn: 1.17.3 - ~/.nvm/versions/node/v12.6.0/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v12.6.0/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
      Android SDK:
        API Levels: 23, 28, 29
        Build Tools: 28.0.3, 29.0.1
        System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmGlobalPackages:
      react-native-cli: 2.0.1

Library version: 1.2.1

Steps To Reproduce

Run a build with the above circle ci config and it fails at the homebrew installation phase for ios_build_and_test job

Running into hardware acceleration issues with the android_test job

Orb version

6.8.1

What happened

When running the android_test job we run into the following issue during the Start Android Emulator (background) step:

ERROR   | x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: Android Emulator requires an Intel processor with VT-x and NX support.  (VT-x is not supported)
More info on configuring VM acceleration on macOS:
https://developer.android.com/studio/run/emulator-acceleration#vm-mac
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.

This is our current config for the android_test job

      - rn/android_test:
          detox_configuration: android.emu.release
          node_version: '16.9.1'
          # Disabled Yarn cache because of issues: https://github.com/react-native-community/react-native-circleci-orb/issues/66
          yarn_cache: false
          xcode_version: '13.2.1'
          # requires:
          #   - build_android_release

Expected behavior

To be able to run the emulator in the rn/android_test

`rn/android_test` fails with brew error

Orb version: 5.1.0

What happened

My config.yml:

      - rn/android_test:
          detox_configuration: android.emu.release
          requires:
            - install
            - build-android-artifact-prod

This step results in the following error:

Error: Invalid cask: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/emacs.rb
Cask ''/Applications/Emacs.app/Contents/Resources/man/man1/ebrowse.1.gz' is not a valid man page name' definition is invalid.
Error: Cannot tap homebrew/cask: invalid syntax in tap!

AFAIK, this can be fixed by running brew update before executing the rn_android_test job, but the orb has HOMEBREW_NO_AUTO_UPDATE=1 hardcoded so that's probably the reason it's failing.

Jetify

My project uses Jetify https://www.npmjs.com/package/jetifier which is an npm tool that transforms some Java files as far as I can tell. So I just need to run this command before doing the gradlew build. I confirmed with CircleCI ssh that this is what's causing my build to fail.

How would you recommend I go about doing this currently? I've been trying to use the persist_to_workspace in a previous job to no avail, but I can try again tomorrow..

Perhaps I should clone this repo and try to modify it to do the jetify?

Any thoughts appreciated, I'm a beginner at CircleCI orbs, jobs, steps, workflows etc.

Add workers parameter for jest and detox

What would you like to be added

Both jest and detox can run parallel test to speed up the process, but this is not possible with the current orb.

Why is this needed

For setups that have multiple cores it would be nice to use them all and speed up the process

Emulator does not run

Orb version

v4.1.0

What happened

Emulator does not seem to be running.
My circleci config:

version: 2.1
orbs:
  rn: react-native-community/[email protected]
jobs:
  detox_test:
    environment:
      CACHE_VERSION: 2
    executor:
      name: rn/linux_android
    steps:
      - checkout
      - rn/yarn_install
      - run:
          command: yarn jetify
      - rn/android_emulator_start
      - rn/detox_test:
          configuration: android.emu.debug
      - persist_to_workspace:
          paths: .
          root: .

workflows:
  test:
    jobs:
      - detox_test

Getting the following output:

#!/bin/bash -eo pipefail
/usr/local/share/android-sdk/emulator/emulator @TestingAVD -version
/usr/local/share/android-sdk/emulator/emulator @TestingAVD -skin 470x860 -cores 1 -gpu auto -accel on -memory 1024 -no-audio -no-snapshot -no-boot-anim -no-window -logcat *:W | grep -i 'ReactNative\|com.reactnativecommunity'

/bin/bash: /usr/local/share/android-sdk/emulator/emulator: No such file or directory
Exited with code exit status 127

Usage with CodePush

What would you like to be added

This is more of a question, I need help figuring out how the optimal workflow would be in our case.

We're using RN with AppCenter's CodePush and therefore we rarely update the native part of iOS/Android. We'd still want to be able to run E2E tests (using Detox) automatically in our pipes but it feels redundant to build the native apps if there isn't any change.

The only solution I could figure out would be to detect before running the build part if there is a diff in the ios or android folder. If there is, build and test like normally. But if there isn't, we could get the bundle somehow (this is the part I'm not sure with) and install it to the simulator/emulator. On mount we'd receive the latest CodePush version and start the E2E tests.

What other possible workflows can you guys think of? If none, any ideas how we could install the app in the simulators?

Separate `ios_test` job

What would you like to be added

Add a separate ios_test job, like Android

Why is it together with ios_build_and_test? 🤔

Why is this needed

Mostly for the CI hooks for github, they list each job separately, and we would know what failed; the build or the test.

Add support for private NPM repositories - by setting auth token

What would you like to be added

Sadly the default yarn install commands don't support private npm repositories. I had to copy all the tasks and prepend with

  • run:
    name: Prepare private repo access
    command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

It would be cool if that cam out of the box. Or at least some way to implement that.

Why is this needed

Should be self explanatory :)

Why are we installing FBSimulatorControl?

Bug

I'm trying to use the macOS executor at version 11.2.1 and it fails at the insallation step of FBSimulatorControl? Why are we using this in the first place? Detox is now working without it?

Since we are installing FBSimulatorControl from a specific version it seems that it cannot run with a newer xcode versions without updating.
But if we don't need it, then I would just remove it.

Restoring Cache : Failling to unarchive cache

Hitting problems when trying to rerun a build. the pre Yarn install step of Restoring the Cache is failing, is there a way around skipping this step,

Orb version

4.4.2

What happened

Fails to unarchive cache

Size: 324 MiB
Cached paths:
  * /tmp/yarn

Downloading cache archive...
Validating cache...

Unarchiving cache...

Failed to unarchive cache

Error untarring cache: Error extracting tarball /var/folders/1b/gl7yt7ds26vcyr1pkgld6l040000gn/T/cache984330157 : tmp/yarn/: Cannot extract through symlink tmp/yarn tmp/yarn/v4/: Cannot extract through symlink tmp/yarn/v4 tmp/yarn/v4/.tmp/: Cannot extract through symlink tmp/yarn/v4/.tmp tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/: Cannot extract through symlink tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/: Cannot extract through symlink tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/@babel/: Cannot extract through symlink tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/@babel tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/@babel/code-frame/: Cannot extract through symlink tmp/yarn/v4/[email protected]: exit status 1

Expected behavior

Use previous cache and carry on with the Yarn install

Cannot install any Node version other than default for the rn/ios_build job

Orb version

3.0.0

What happened

When trying to run the rn/ios_build job with a specified Node version, it fails with:
Error: No available formula with the name "node@{version}"

Expected behavior

It should install the specified Node version.

Reproduction

This is my CircleCI config:

version: 2.1

orbs:
    rn: react-native-community/[email protected]

workflows:
    version: 2
    buildit:
        jobs:
            - rn/ios_build:
                build_configuration: Release
                device: Generic iOS Device
                name: build_ios_release
                node_version: '12.14.1'
                project_path: ios/MyProject.xcodeproj
                scheme: release
                checkout: true

And this is the output of the Configure Detox Envionment step in the pipeline:

#!/bin/bash --login -eo pipefail
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install [email protected] >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install android-sdk >/dev/null
touch .watchmanconfig
node -v


Error: No available formula with the name "[email protected]" 
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
Error: No similarly named formulae found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
Exited with code exit status 1
CircleCI received exit code 1

As the current LTS release, obviously v12.14.1 should be usable. However, I have tried this with specifying over 20 different releases including versions in 10, 11, 12, and 13, and all of them show the same error.

Improve Build Android APK step

Currently the Build Android APK step looks like this:

  - run:
      name: Build Android APK
      command: "cd <<parameters.project_path>> && chmod +x gradlew && ./gradlew --build-cache --max-workers 2 --continue assemble<<parameters.build_type>> assembleAndroidTest -DtestBuildType=<<parameters.build_type>> --stacktrace"

In our project we have 3 flavors(develop, staging, production) and 2 build types (debug and release).
if I assemble the app with

gradlew assembleRelease assembleAndroidTest -DtestBuildType=release

gradlew will build all 3 flavors in release type. and it will also build all 3 flavors for androidTest in release type. This takes around 10mins on my machine and a little longer on circleci.

To speed this up we are generally only building specific build variants DevelopDebug, DevelopRelease etc.
To build a detox build we would do:

./gradlew assembleDevelopRelease assembleDevelopReleaseAndroidTest -DtestBuildType=release

this way we only generate developRlease androidTest/developRelease - this is 3 times faster as we generate 3 times less apks that we don't need.

Because of that I would like to propose different job parameters: assemble_build_type, assemble_detox_build_type and test_build_type.

This way one could call rn/android_build like this:

      - rn/android_build:
          assemble_build_type: assembleRelease | assembleDevelopRelease | assembleDebug etc
          assemble_detox_build_type: assembleDevelopReleaseAndroidTest | assembleAndroidTest etc
          test_build_type: release etc

It is a breaking change, but it would also allow for greater flexibility of the build step.

Setting node_version is ignored at ios_build_and_test

Orb version

4.1.0

What happened

Whenever I use the job ios_build_and_test:

      - react-native/ios_build_and_test:
          checkout: true
          build_configuration: Release
          detox_configuration: ios.sim.release
          device: iPhone X
          node_version: '10.17'
          project_path: ios/AppName.xcworkspace
          requires:
            - another-command
          scheme: AppName

When the job runs

I got an error, because of a dependency on my project, requires using the node_version < 10.17.

I saw that whenever you call:

- run:
name: Install node@<<parameters.node_version>>
# after `curl`, bashrc contains the script to load nvm, we need to source it to use it
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
command -v nvm
nvm install <<parameters.node_version>>
nvm alias default <<parameters.node_version>>
- run:
name: Verify node version
command: node --version

He will fetch nvm and set the version on macos 11.0.0 executor. But on the subsequent job, that shows the node -v, you still got the default version of the macos executor. With is: 12.0.

https://circle-macos-docs.s3.amazonaws.com/image-manifest/v1969/index.html

Expected behavior

Calling yarn_install passing node_version at ios_build_and_test would save the version to subsequent jobs.

Maybe we can add a parameter to check if I want a specific version of node when calling yarn_install.

ScreenShots

Screen Shot 2020-04-17 at 16 37 28

Cannot find a job named `build` to run in the `jobs:` section of your configuration file

I tried to start a new project with it and ends up it just doesn't work.
I'm not familiar with this new CircleCI, so I just tried the sample configs, but I keep receiving the error below.

shell

circleci local execute 
Docker image digest: sha256:ea6c856572603d47e8f5e8013f8a0b45c0fb91267a6a80ff51068a25e97ed6cd
====>> Spin Up Environment
Build-agent version  ()
Error: 
Configuration errors: 1 error occurred:

* Cannot find a job named `build` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

Step failed
Task failed
Error: 1 error occurred:

* Cannot find a job named `build` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

config.yml

# Orb support is from version >= 2.1
version: 2.1

# Make sure you use the latest version of the Orb!
orbs:
  rn: react-native-community/[email protected]

# Custom jobs which are not part of the Orb
jobs:
  checkout_code:
    executor: rn/linux_js
    steps:
      - checkout
      - persist_to_workspace:
          root: .
          paths: .
  analyse_js:
    executor: rn/linux_js
    steps:
      - attach_workspace:
          at: .
      - rn/yarn_install
      - run:
          name: Run ESLint
          command: yarn eslint
      - run:
          name: Flow
          command: yarn flow
      - run:
          name: Jest
          command: yarn jest

workflows:
  test:
    jobs:
      # Checkout the code and persist to the Workspace
      # Note: This is a job which is defined above and not part of the Orb
      - checkout_code

      # Analyze the Javascript using ESLint, Flow, and Jest
      # Note: This is a job which is defined above and not part of the Orb
      - analyse_js:
          requires:
            - checkout_code

      # Build the Android app in debug mode
      - rn/android_build:
          name: build_android_debug
          project_path: "android"
          build_type: debug
          requires:
            - analyse_js

      # Build and test the Android app in release mode
      # Note: We split these into seperate jobs because we can build the Android app on a Linux machine and preserve the expensive MacOS executor minutes for when it's required
      - rn/android_build:
          name: build_android_release
          project_path: "android"
          build_type: release
          requires:
            - analyse_js
      - rn/android_test:
          detox_configuration: "android.emu.release"
          requires:
            - build_android_release


      # Build the iOS app in release mode and do not run tests
      - rn/ios_build:
          name: build_ios_release
          project_path: ios/Example.xcodeproj
          device: "iPhone X"
          build_configuration: Release
          scheme: Example
          requires:
            - analyse_js

      # Build and test the iOS app in release mode
      - rn/ios_build_and_test:
          project_path: "ios/Example.xcodeproj"
          device: "iPhone X"
          build_configuration: "Release"
          scheme: "Example"
          detox_configuration: "ios.sim.release"
          requires:
            - analyse_js

`bundle` command usage

Apologies as this is more of an usage question (or a documentation request). I noticed a bundle command was added in #8 but there was no context as to what it is useful for.

The CircleCI landing page specifies that the dev tools could be used in Linux https://circleci.com/circleci-react/

My understanding is that the react-native bundle command could be used in Linux containers and a MacOS container would then just need to compile via xcode and skip the JS bundling altogether, thus saving on some of the time required to keep mac VMs online.

I suspect running the bundle command may help with that. The js bundle would need to be sent to the MacOS runner, and a SKIP_BUNDLING=true env variable might be needed (as per https://github.com/facebook/react-native/blob/master/scripts/react-native-xcode.sh#L30) so that XCode doesn't bundle it itself.

None of this seems to be documented anywhere though. 😕

Am I on the right track?

Cannot start simulator on version 4.2.0

Orb version

4.2.0

What happened

Whenever I run a command that requires the simulator start on iOS, I got the following error:

#!/bin/bash --login -eo pipefail
xcrun simctl list | awk -F “[()]” ‘{ for (i=2; i<NF; i+=2) print $i }’ | grep ‘^[-A-Z0–9]*$’ | xargs -I uuid xcrun simctl delete uuid
/bin/bash: -c: line 0: syntax error near unexpected token `('

Exited with code exit status 2

Possibly related to 2d614fa

Screen Shot 2020-04-22 at 09 53 42

Expected behavior

My build should run without any problem

Anyone testing on Android?

I've now spent so much time trying to make the android tests to pass and I'm still failing.

It turned out that if I run the emulator like in the orb:

/usr/local/share/android-sdk/emulator/emulator @<<parameters.device_name>> -skin 470x860 -cores 1 -gpu auto -accel on -memory 1024 -no-audio -no-snapshot -no-boot-anim -no-window -logcat *:W | grep -i 'ReactNative\|<<parameters.logcat_grep>>'

my test were not starting at all.

I had to change it to this:

/usr/local/share/android-sdk/emulator/emulator @<<parameters.device_name>> -gpu auto -accel on -no-audio -no-snapshot -no-boot-anim -no-window -logcat *:W | grep -i 'ReactNative\|<<parameters.logcat_grep>>'

I'm running detox in verbose mode and I can see that installing the app on the device takes ages. So I increased the default timeout of 120s to 360s and now tests are starting, but they always fail and not always at the same test.

On the other hand when I run the tests locally I have no issues whatsoever. They always pass.

Anyone got any experience to share with this?

The iOS emualtor runs the tests fine - they always pass.

Tests fail - applesimutils is unable to list simulators

Orb version

react-native-community/[email protected]

What happened

Test failed to start

#!/bin/bash --login -eo pipefail
detox test -c ios.debug -l warn --headless
v10.19.0 is already installed.
Now using node v10.19.0 (npm v6.13.4)
default -> 10 (-> v10.19.0 *)
detox[14565] INFO:  [test.js] configuration="ios.debug" loglevel="warn" headless=true reportSpecs=true DETOX_START_TIMESTAMP=1581674270596 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"
detox[15132] ERROR: [exec.js/EXEC_FAIL, #0] "applesimutils --list --byType "iPhone Xs"" failed with code = 255, stdout and stderr:

detox[15132] ERROR: [exec.js/EXEC_FAIL, #0] 
detox[15132] ERROR: [exec.js/EXEC_FAIL, #0] v10.19.0 is already installed.
Error: The data couldn’t be read because it isn’t in the correct format.. See “applesimutils --help” for usage.

Error: Unable to obtain a list of simulators. See “applesimutils --help” for usage.


detox[15132] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] 
 { ChildProcessError: Command failed: applesimutils --list --byType "iPhone Xs"
v10.19.0 is already installed.
Error: The data couldn’t be read because it isn’t in the correct format.. See “applesimutils --help” for usage.

Error: Unable to obtain a list of simulators. See “applesimutils --help” for usage.

 `applesimutils --list --byType "iPhone Xs"` (exited with error code 255)
    at callback (/Users/distiller/project/node_modules/child-process-promise/lib/index.js:33:27)
    at ChildProcess.exithandler (child_process.js:301:5)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
  name: 'ChildProcessError',
  code: 255,

Expected behavior

It should not error :)

executors:
  macos:
    macos:
      xcode: 11.2.1

workflows:
  Build and Test:
    jobs:
      - rn/ios_build_and_test:
          name: test_ios_debug
          project_path: ios/Example.xcworkspace
          project_type: workspace
          device: "iPhone XS"
          build_configuration: Debug
          scheme: "Example'"
          detox_configuration: ios.debug
          requires:
            - build_ios_debug

Permission denied when restoring cache

Orb version

3.0.1

What happened

Permission denied when restoring cache in the yarn_install command

Size: 278 MiB
Cached paths:
  * /root/.cache/yarn

Downloading cache archive...
Validating cache...

Unarchiving cache...

Failed to unarchive cache

Error untarring cache: Error extracting tarball /tmp/cache468968038 : tar: root/.cache/yarn: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6/.tmp: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e-integrity: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e-integrity/node_modules: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e-integrity/node_modules/@babel: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e-integrity/node_modules/@babel/code-frame: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e-integrity/node_modules/@babel/code-frame/.yarn-metadata.json: Cannot open: Permission denied tar: root/.cache/yarn/v6/npm-@babel-code-frame-7.: exit status 2

Expected behavior

Should be able to restore cache without issue.

yarn install is using ~/.cache/yarn as cache folder and this will depend on what the user is on the executer that is running the job. Consider using cache folder relative to the workspace or the system tmp folder (/tmp/) instead

Support yarn berry

What would you like to be added

I would like to use yarn 2+ with this orb

Why is this needed

It would be easier for users who are starting to use yarn2+

I can create a pr for the feature

How to pass parameters to an executor?

Question

Hi, our build fails on circleci. After debugging for some time I figured out that I would have to set different _JAVA_OPTIONS and GRADLE_OPT than specified in the linux_android executor.

From the docs over here I can see that the executor has parameters, but I'm failing to see how to set those?
https://circleci.com/orbs/registry/orb/react-native-community/react-native#executors-linux_android

Is it at all possible to override those parameters from outside?

setup_macos_executor fails on detox configuration

Orb version

version: 5.1.0

What happened

Build fails at step "Configure Detox Environment".

image

Error transcript

#!/bin/bash --login -eo pipefail
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask android-sdk >/dev/null
touch .watchmanconfig
node -v
==> Tapping wix/brew
Cloning into '/usr/local/Homebrew/Library/Taps/wix/homebrew-brew'...
remote: Enumerating objects: 78, done.        
remote: Counting objects: 100% (78/78), done.        
remote: Compressing objects: 100% (44/44), done.        
remote: Total 622 (delta 41), reused 58 (delta 22), pack-reused 544        
Receiving objects: 100% (622/622), 1.58 MiB | 9.14 MiB/s, done.
Resolving deltas: 100% (328/328), done.
Tapped 1 cask and 1 formula (31 files, 1.6MB).
==> Tapping homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 373, done.        
remote: Counting objects: 100% (373/373), done.        
remote: Compressing objects: 100% (222/222), done.        
remote: Total 563812 (delta 194), reused 290 (delta 151), pack-reused 563439        
Receiving objects: 100% (563812/563812), 248.93 MiB | 15.03 MiB/s, done.
Resolving deltas: 100% (398150/398150), done.
Error: Invalid cask: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/emacs.rb
Cask ''/Applications/Emacs.app/Contents/Resources/man/man1/ebrowse.1.gz' is not a valid man page name' definition is invalid.
Error: Cannot tap homebrew/cask: invalid syntax in tap!
Exited with code exit status 1
CircleCI received exit code 1

Expected behavior

Detox environment is configured. brew tap homebrew/cask does not fail.

Add ability to set cocoapods version

What would you like to be added

I would like to have ability to provide cocoapods version to use.

Why is this needed

I have update my project to new Firebase SDK ^v4 and I got this error in ci run:

[!] The version of CocoaPods used to generate the lockfile (1.10.1) is higher than the version of the current executable (1.8.4). Incompatibility issues may arise.
...
[!] `FirebaseAnalytics` requires CocoaPods version `>= 1.10.0`, which is not satisfied by your current version, `1.8.4`.

Idea: add a pre-step, post-step parameters

Feature Request

Currently we are using this orb, but it somewhat difficult to inject code in the jobs. Because we cannot inject code in the jobs, we have to create our own jobs that are copy of the orb's job with one or 2 steps in between.

Here is an example. I need to use the rn/android_build job, but on our circleci java was failing so I had to make modifications to the executor and I also needed to generate the keystore files out of the circleci env variables and I also needed to set some bash env. variables. My job looks like this:

  app_android_build:
    executor:
      name: rn/linux_android
      gradle_options: '-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false'
      java_options: '-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8'
      build_threads: 2
    parameters:
      project_path:
        description: The path to the root of the Android project you want to build, relative to the root of the repository.
        type: string
        default: "./android"
      build_type:
        description: The build type to build. This is normally either "debug" or "release" but you may have custom build types configured for your app.
        type: string
        default: "debug"
      store_artifacts:
        description: Store this job store files as job artifacts? Defaults to true
        type: boolean
        default: true
      persist_to_workspace:
        description: Should this job persist files to a workspace? Defaults to true
        type: boolean
        default: true
    steps:
      - checkout
      - attach_workspace_and_run_yarn
      - run:
          name: "Decode android keys"
          command: |
            echo $ANDROID_KEYSTORE_RELEASE_BASE64 | base64 -d > $HOME/project/keyfiles/release-key.keystore
            echo $ANDROID_KEYSTORE_DEVELOP_BASE64 | base64 -d > $HOME/project/keyfiles/develop-key.keystore
      - run:
          name: "Create Set Gradle variables"
          command: |
            echo 'export RN_SRC_EXT=e2e.js' >> $BASH_ENV
            echo 'export ORG_GRADLE_PROJECT_MYAPP_RELEASE_STORE_FILE=$MYAPP_RELEASE_STORE_FILE' >> $BASH_ENV
            echo 'export ORG_GRADLE_PROJECT_MYAPP_RELEASE_KEY_ALIAS=$MYAPP_RELEASE_KEY_ALIAS' >> $BASH_ENV
            echo 'export ORG_GRADLE_PROJECT_MYAPP_RELEASE_STORE_PASSWORD=$MYAPP_RELEASE_STORE_PASSWORD' >> $BASH_ENV
            echo 'export ORG_GRADLE_PROJECT_MYAPP_RELEASE_KEY_PASSWORD=$MYAPP_RELEASE_KEY_PASSWORD' >> $BASH_ENV
            source $BASH_ENV
      - rn/android_build:
          build_type: <<parameters.build_type>>
          project_path: <<parameters.project_path>>
      - when:
          condition: <<parameters.persist_to_workspace>>
          steps:
            - persist_to_workspace:
                root: .
                paths:
                  - <<parameters.project_path>>/app/build/outputs/apk
      - when:
          condition: <<parameters.store_artifacts>>
          steps:
            - store_artifacts:
                path: <<parameters.project_path>>/app/build/outputs/apk

It works, but it is copy/paste and it drives me nuts. Today I saw the pre-steps and post-steps that circleci offers for workflows.

I tried to use the pre-step to generate the keystore file, but the pre-step is run way too early - before the workspace is attached.

So I was thinking - how about defining a pre-steps/on_after_initialize command ourselves?
It could be something simple like this:

      - when:
          condition: <<parameters.on_after_initialize>>
          steps:
            - run:
                name: "custom command"
                command: <<parameters.on_after_initialize_command>>

What do you guys think?

Feat: support private packages

What would you like to be added

Support yarn_install for private packages.

Why is this needed

When I try to ios_build_and_test it fails with "Request failed "401 Unauthorized"" at yarn install.
I thought that maybe I could make a fix using on_after_initialize, but it runs right after yarn_install

I'll proceed reusing files from another machine, but it would be nice to support that.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The circleci CLI must be installed.

The circleci command line has to be installed in your CI environment and available in the PATH environment varialbe.

See CircleCI installation for more details.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Detox install via brew fails - Tapping wix/brew - Error: No similarly named formulae found.

Orb version

orbs:
  rn: react-native-community/[email protected]
version: 2.1

Full Config:


jobs:
  checkout_code:
    executor: rn/linux_js
    steps:
      - checkout
      - persist_to_workspace:
          paths: [.]
          root: .
  
  analyse_js:
    working_directory: ~/punchline
    docker:
      - image: cimg/node:14.16.1

    steps:
      - checkout
      - restore_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}

      - run: npm install

      - save_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}
          paths:
            - node_modules

      - run:
          name: jest tests
          command: |
            mkdir -p test-results/jest
            npm run ci:test:jest
          environment:
            JEST_JUNIT_OUTPUT: test-results/jest/junit.xml

      - persist_to_workspace:
          root: ~/punchline
          paths:
            - node_modules

      - store_test_results:
          path: test-results

      - store_artifacts:
          path: test-results
 
  fastlane_android_release:
    executor: rn/linux_js
    steps:
      - attach_workspace:
          at: .
      - run: npm i
      - run:
          command: echo
          name: Run Fastlane
          
  fastlane_ios_release:
    executor: rn/linux_js
    steps:
      - attach_workspace:
          at: .
      - run: npm i
      - run:
          command: echo 1
          name: Run Fastlane
orbs:
  rn: react-native-community/[email protected]
version: 2.1
workflows:
  test:
    jobs:
      - checkout_code

      - analyse_js:
          requires:
            - checkout_code

      - rn/android_build:
          build_type: debug
          name: build_android_debug
          project_path: android
          requires:
            - analyse_js

      - rn/android_build:
          build_type: release
          name: build_android_release
          project_path: android
          requires:
            - analyse_js

      - rn/android_test:
          detox_configuration: android.emu.release
          requires:
            - build_android_release

      - rn/ios_build_and_test:
          build_configuration: Release
          detox_configuration: ios.sim.release
          device: iPhone X
          project_path: ios/Punchline.xcodeproj
          requires:
            - analyse_js
          scheme: Punchline

      - fastlane_android_release:
          requires:
            - rn/android_test
            
      - fastlane_ios_release:
          requires:
            - rn/ios_build_and_test

What happened

==> Tapping wix/brew
Cloning into '/usr/local/Homebrew/Library/Taps/wix/homebrew-brew'...
remote: Enumerating objects: 631, done.        
remote: Counting objects: 100% (87/87), done.        
remote: Compressing objects: 100% (50/50), done.        
remote: Total 631 (delta 45), reused 63 (delta 24), pack-reused 544        
Receiving objects: 100% (631/631), 1.58 MiB | 8.66 MiB/s, done.
Resolving deltas: 100% (332/332), done.
Tapped 1 cask and 1 formula (29 files, 1.6MB).
==> Unshallowing homebrew/cask
remote: Enumerating objects: 172082, done.        
remote: Counting objects: 100% (159790/159790), done.        
remote: Compressing objects: 100% (45457/45457), done.        
remote: Total 150280 (delta 112920), reused 141969 (delta 104669), pack-reused 0        
Receiving objects: 100% (150280/150280), 72.29 MiB | 27.91 MiB/s, done.
Resolving deltas: 100% (112920/112920), completed with 5397 local objects.
Error: No similarly named formulae found.
Error: No available formula or cask with the name "node@8".
Warning: homebrew/core is shallow clone. To get its complete history, run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

Expected behavior

Would expect it to successfully install detox, and then proceed to run the detox tests

Don't understand the new pod install command.

Hi guys,

I was on version 2.x and decided I'll update to version 4. I read the changelog and saw that there is a new pod install command. Here is the pull request for it:
#48

The source code of the command is here: https://github.com/react-native-community/react-native-circleci-orb/blob/6507129208dda0db06e0ddcd1a3ee61fce287e78/src/commands/pod_install.yml

I was wondering why it doesn't have any cache and why it is supposed to be faster?

Previously I was using this:

  pod_install:
    description: Install POD dependencies
    steps:
      - restore_cache:
          keys:
            - mobileapp-pods-v1-{{ checksum "./ios/Podfile.lock" }}-{{ .Environment.CACHE_VERSION }}

      - run:
          name: Install pods
          command: "cd ios && pod install && cd .."
      - save_cache:
          key: mobileapp-pods-v1-{{ checksum "./ios/Podfile.lock" }}-{{ .Environment.CACHE_VERSION }}
          paths:
            - ./ios/Pods

But decided to swap my code for the pod install command.
Now the pod install command in my project takes around 7mins. Where in the past (due to having cache most probobly) it was around 60s..

So why aren't we caching the pod dependencies now?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.