What is Continuous Integration and Continuous Delivery?
Continuous Integration (CI) and Continuous Delivery (CD) are now necessary concepts to develop a mobile application. Continuous Integration allows you to make sure your application is not broken; It runs all your tests everytime you push a new change. Continuous Delivery will help you distributing app-builds to testers or even to the App Store/Play Store every time you add a new feature or generate a new version of your application.
But what if we use a service that includes both of them? Well, I’ll show you how to set up your CI/CD for React Native using Nevercode.
Nevercode is an excellent platform to combine Continuous Integration and Continuous Delivery to your project in an effortless way. It allows you to add custom tests, developer licenses, workflows, code signing and version control platforms integration (Github, Bitbucket, GitLab, etc.).
Let’s add our app
Add your application to Nevercode:
Now you have to choose where is your repository hosted:
Once you find your repo, you have to set your main branch, in this case, we’re using master as the main branch, and Nevercode will look for branches and select the configuration mode. For testing purposes, we will use debug. You can generate builds for iOS, Android, both platforms or disable automatic builds generation if you check that option.
Also, you can set a branch pattern to test, but if you set * it will test all branches.
Now that we’ve finished adding our base project, it will start doing our first build and running tests. Be patient because it will take some time. This process will fetch the project, generate builds for both platforms and run all tests. For now, we will just wait until Nevercode finishes.
Once the CI finishes running tests and generating our first build we should see a screen like this:
Setting Continuous Delivery
At this point, your project is only running tests and generating builds that are not sent to anyone. The next step is to set your Continuous Delivery for it to be able to sign your code and work with the platform that you choose.
Code signing:
If we want to run our application on smartphones, we have to sign our code. Otherwise, our devices won’t be able to install the APK/IPA because we wouldn’t have a way to know the application is from a known source.
“Code signing your app assures users that it is from a known source and the app hasn’t been modified since it was last signed”
-Apple
So, to proceed to sign our code, we have to go to the project settings section. There’s a section called Code Signing where we will get this options:
At this point, we have to add our Apple Developer certificate and app provisioning file that match with the iOS application. For Android, we have to add a keystore and make Gradle sign the code using it.
(To learn how to sign iOS/Android applications will be part of a separate blog post. Coming soon…)
Publishing
To send the builds to our email, we’re going to add our distribution list to the email option:
Once our builds are generated, they will be sent to the emails in the distribution list, and we will be able to download and install them on our devices.
Continuous Integration
If we’re using Jest as our testing platform, the next step will be easy, because we only need to check this option.
With this step, we have enabled Jest testing for our application in Nevercode, and it will notify us if something is broken in our code.
Conclusion
In conclusion, Continuous Integration and Continuous Delivery are necessary for modern development. By using them, you only have to worry about programming your stuff, and the CI will notify you if something went wrong. Also you will save a lot of time delegating the build generation to Nevercode because it will take almost 20 minutes to generate both platforms builds.
Everyone should take a look at CI/CD because they’re useful tools and they will help you save a lot of time and feel more confident about what you are doing.