react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[Tests] Look into using Circle CI instead of Travis

Open ide opened this issue 11 years ago • 4 comments

People seem to really love Circle. Might be easier to get support from them since they're in SF too. Not hi-pri since Travis works but the faster / more reliable we can get the unit tests the better of course.

(I'll look into this some time -- have been setting up Circle CI in a couple of our repos as practice. But if someone wants to work on this before I get to it, please go ahead.)

ide avatar Nov 19 '15 20:11 ide

@ide do you have an example circle.yml that supports a merged ios/android codebase? we are introducing react native into our ios/android apps and need to figure out the continuous integration will work.

lklots avatar Dec 11 '15 23:12 lklots

I don't have an example for this, sorry! But people in an xfb eng thread had positive things to say about Circle and it sounded like it wouldn't be too hard to get in touch with them.

ide avatar Dec 12 '15 00:12 ide

I have a quirky but working solution for using circleci with react-native. The basic idea is to have a primary repo containing all the code and building the iOS version of the app. There is then a secondary repo containing only a circle.yml file configured for the android version of the app. Every iOS build will trigger an android build.

The details: Define a primary repository that holds the react-native app. Suppose it's called mobile. mobile/circle.yml is the circle configuration for the iOS build. Define a second repository called mobile_android_circleci which only contains a circle.yml file configured for the android build. In mobile/circle.yml include the following command which kicks off the android build:

dependencies:
  pre:
    # kick off the android build
    - "curl \
      --header \"Content-Type: application/json\" \
      --data '{\"build_parameters\": {\"SHA_TO_BUILD\": \"$CIRCLE_SHA1\"}}' \
      --request POST \
      https://circleci.com/api/v1/project/HustleInc/mobile_android_circleci/tree/master?circle-token=<token>

Notice that the $SHA_TO_BUILD env variable is being populated with $CIRCLE_SHA1 which will be used in the mobile_android_circleci/circle.yml file. You'll also need to add circle-token to the curl command. You can create one here: https://circleci.com/account/api

The mobile_android_circleci/circle.yml looks as follows:

dependencies:
  pre:
    - git clone [email protected]:HustleInc/mobile.git
    - cd mobile; echo "building $SHA_TO_BUILD"; git checkout $SHA_TO_BUILD

Happy building.

lklots avatar Dec 17 '15 02:12 lklots

@lklots thanks for sharing. We use Circle for Android for a while. And I am going to integrate with IOS in the next couple of weeks. I'll refer to your solution and nudge you if I get stuck if you don't mind :)

Closing this

bestander avatar Mar 20 '16 18:03 bestander