Today we are going to learn a good practice for Software Development.

Continuous Integration (or CI) is a technique to support continually merging code into the main branch of your repository, running tests each time to verify nothing is broken.

>“Continuous Integration doesn’t get rid of bugs, but it does make them dramatically easier to find and remove.” >- Martin Fowler, Chief Scientist, ThoughtWorks

How does Continuous Integration help us? By merging our work regularly:

  • we are less likely to have long-lived feature branches that increase the likelihood of merge conflicts.
  • we are more likely to commit small working pieces of code regularly.
  • we can get feedback quickly if integrating some code broke our build

We'll use Buddybuild's CI tool to generate automated builds.

We will use a blank react native project and set up buddybuild on it.

react-native init myProject

After some time, our project is up and running. Let's see it working. As we can see this is just an empty project with just a react native message.

Right now, we will just add this project to our git. Done. Checking buddybuild website, go to a new app. My github is connected with Buddybuild then just add a new app from github, choose where your project is located. It treats iOS and Android projects separately - we'll just set up the Android build for now.

Now, it will run a build for every commit. If we wait a moment, we can see the first commit has been built. So easy!

Let's commit something just to see this in action. I will just change this text and make a new commit. Done. Let's check the buddybuild website. As you can see here, the build is in progress. You can also integrate it with github, for instance so that you can only merge Pull Requests if the Buddybuild build passes.

We can use Continuous Integration and Automated builds/deploys for React Native apps.

As you know, we're creating an app for two distinct platforms: iOS and Android. There are lots of devices your app will run on, and with automated builds you will check for compatibilities and potential bugs with each commit.

Most CI systems allow us to do automated deploys as well, so you could automate pushing each new build to your beta testers, for example.

This is good because you can test your debug or non-release version. During this process, with each deploy/build you can run your tests. If your test fails you can send messages to the team. The objective here is to stay tuned in to any failures. During this process, you can also run a static analyzer over your code and prevent potential bugs. In some systems it is also possible to gather feedback from users. Buddybuild supports this!

If you like this idea and you would like to know more about this, check out the resources section.