CI or to be precise continuous integration is one programming practice that enables seamless operation across the entire development phase eliminating any delays or time breaks. In simple words, CI is one of the frequently adapted practices that help integrate changes in a software project and continuously test them in the development environment.
Continuous testing enables every individual within the development team to stay in the SDLC loop and stay updated on every new feature added. Nearly every software developer irrespective of the framework used seeks to integrate an automated CI environment so that they need not suffer technical voids.
Having said that, a significant issue noticed by the developers of React Native is that the time taken for product release after the build is extremely high meaning that the Build->release phase is pretty slow.
Added to the above was manual integration. Every developer needs to be aware of the time when the application would be built and then enter into performing the task manually. Infrequent or delayed-release cycles further add to the list of problems faced by developers and then, questions the credibility of software developed.
This might not be a matter of concern for big tech giants, but for the smaller companies and the startups, such a drawback is quite alarming. For them, technology is as essential as overall productivity. And so, we need to find a way to clear this clutter and come up with something that is beneficial in terms of CI.
Solution
Now that you are well versed with the issues, it’s time that you acquaint yourself with the solution as well. The prime aim is to draft an environment where developers can quickly build and also get updates about the same promptly. In order other words, there is an urgent need to have an environment that eliminates the time lag between build and release cycles.
Technologies Used
- Bitrise
- CodePush
Bitrise
Curiosity has paved a way for different technologies to be tested and tried for CI automation. Starting from CircleCI to Travis and BuddyBuild, there are multiple technologies that promote automation of CI in react native apps. However, one that is far more structured and sophisticated is Bitrise. Presence of modern workflows and trending steps, Bitrise is an ideal technique to merge with native apps and embed CI automation.
CodePush
Regarded as a cloud service, CodePush helps developers of React Native employ mobile app updates instantly to its users. Meaning that users need not wait for an update after it has been integrated by the development team. As soon as a modification is updated, users can view the same and stay attuned with the industrial transformations on the go.
How Do This Works?
We are now on the same page, wondering how? Let me vent out. We know what issues stumble while working with react native framework, we also know how to solve them, and which technology would help us do the same. So, technically, we are on the same page. What we need to do next is draft out a way in which we can integrate and embed the technologies to automate the CI process in a react native environment.
Individual Components
- Conditional workflow – To own the ability to run within the scenario of IFTTT is important since we would need to integrate several workflows in a single workflow and then run either of the given workflow steps conditionally. Consider, for instance, we utilize this to find out whether we need to build a new environment for CodePush or do it directly in the software.
- Environment variables – to be able to make use of multiple environments like the development/QA/staging/production to test the app.
- Tests workflow – To be able to test and tune every new commit unit along with end-to-end tests, which can then sends a Slack message of pass/fail to the development team.
- Efficient Bitrise workflows – To be able to hook up within different workflows in the environment branches and further share most of the steps of another workflow.
- Use the latest Bitrise workflow steps – Like the automatic Google play store deployment, using Xcode archive in the build phase and then send contextual messages of Slack.
Bitrise Use Case
Bitrise workflows seem to be pretty confusing, but it won’t stay the same one we walk down through the process of Bitrise integration.
Step 1: On the commit to QA branch, the workflow of QA is triggered.
Running workflow: QA
Switching to the workflow: _init_install
Step 2: Set Build
You can make use of the Bitrise’s envman tool in order to set up the environment variable RUN_XCODE_ARCHIVE, and the same can be used in later phases of the build process. A commit message sent can be used to set the same and crosschecked by testing the presence of keyword [FULL BUILD]. In case the above testifies, set the value of RUN_XCODE_ARCHIVE to 1 else set it to 0 (zero).
Switching to the workflow: QA
Step 3: Set Environment
Now you need to set the ENVIRONMENT variable to one that is designated as the targetted environment of the build. Next, set the BITRISE_SCHEME to one in the Xcode Archive step suggesting the scheme to be used.
For each of the set environment (qa/staging/production), there would be the associated workflow with it, and this can then set ENVIRONMENT variable on its own along with the BITRISE_SCHEME. Further, all the different steps of workflow would be shared.
Switching to the workflow:
_xcode_archive
Step 4: Xcode Archive
Here, the Xcode Archive tool is used for the generation of a new iOS build. If RUN_XCODE_ARCHIVE is set too (zero), then this step can be skipped.
Switching to the workflow: _code_push
Step 5: CodePush Deploy
Here, the javascript is bundled and changes pushed towards all the users over-the-air (OTA)
Switching to the workflow: _slack_message
Step 6: Slack Message
Final message sent to update on the status of the build process.
So, this was all about the process of integrating Bitrise and CodePush for CI automation. Next, we need to see how does the release process works?
- CodePush used to push live updates OTA directly to the users. This eliminates the need to update manually from the play store.
- In the case of native code changes, there is a new build generated, and the changes are additionally CodePush so to affirm that all users are aligned with the last CodePush changes before updating the native code changes. This is done in a way that CodePush deployments have a serial number, so when a user is about to make an update, it can compare the build number with the last codePush update. It helps them stay updated. Meaning that if a user has a difference between the build number and the codePush number, he can first update to map the latter and then manually update the native code changes.
Conclusion
Well, all of this might not appeal to you much but considering the fact that with each passing day, technological changes hit the industrial world and it is essential for the developers to stay tuned with the same and embed modern methodologies to build and update their apps. And this is what the merger of CodePush and Bitrise aim to attain. Hire React Native developer from us to implement continuous integration using Bitrise and CodePush for mobile CI setup.