It will take about 3 minutes to finish reading this article.
1.What is the CI/CD?
CI/CD refers to the abbreviation of Continuous Integration and Continuous Delivery/Deployment.
CI refers to automatically integrating developers’ code changes into a shared code warehouse, and verifying and building the code through automated testing, compilation, and building processes to quickly discover and solve code problems. CI helps speed up the speed and quality of code delivery and improves the collaboration efficiency of development teams.
CD refers to the automatic deployment of CI-verified code into the production environment to achieve faster delivery and response to requirements. CD includes steps such as automated testing, building, deployment, and monitoring to ensure that the delivered code is stable, reliable, and secure.
The CI/CD process can help development teams deliver high-quality software more quickly and reliably while reducing the risks caused by coding errors and manual operations.
2. Continuous Integration
We usually use the gitlab/github platform to complete CI. The process is as follows:
(1) Create a GitLab project: Create a new project in GitLab and push the project code to the GitLab repository.
(2) Configure GitLab Runner: GitLab Runner is a tool used to perform CI/CD tasks and can run on Linux, Windows or macOS. You need to register a Runner in GitLab and configure the environment in which the Runner runs.
(3) Configure the CI/CD pipeline: Create a .gitlab-ci.yml file in the GitLab project to define the various stages, tasks and steps of the CI/CD pipeline. Different scripting languages and commands can be used, such as Shell scripts, Python, Ruby, etc.
(4) Trigger CI/CD pipeline: When making code submission or merge request in GitLab project, the execution of CI/CD pipeline will be automatically triggered. Pipeline execution can also be manually triggered for testing, building, and deployment.
(5) Monitor and manage CI/CD pipelines: You can view the execution status, logs and output information of the pipeline in GitLab for troubleshooting and problem analysis. You can also manage pipeline parameters, environment variables, scheduled tasks, etc.
(6) Configure CD environment and automated deployment: You can use the automated deployment function of GitLab CI/CD to deploy code to testing, pre-production and production environments. You can also use other CD tools, such as Kubernetes, Docker Swarm, etc., to achieve automated deployment and container orchestration.
3. Continuous Delivery/Deployment
The entire CD process is usually completed with the help of the Jenkins+Fastlane+Pgyer tool set.
Jenkins can be used to perform continuous integration and continuous delivery processes for the entire software project, including tasks such as building, testing, and deployment.
Fastlane can be used as a step in the Jenkins pipeline to automate the build, test and release process of mobile applications. By using Jenkins and Fastlane together, development teams can automate the management of entire software projects and speed up software delivery.
The installation package (ipa file) packaged by Jenkins+Fastlane is uploaded to the Pgyer platform.
The Pgyer platform is used for test distribution, user feedback and version management. Of course, there are other platforms that can be used, such as HockeyApp, AppCenter, Firebase App Distribution and of course TestFlight.
It can be simply understood that Jenkins quickly helps you build a website and then calls Fastlane to help you export the installation package through a series of steps.
Tips:
Fastlane:
Fastlane is a cross-platform continuous integration tool implemented using ruby. It is mainly used to support the continuous integration practice of Android and iOS mobile platform projects. Fastlane processing provides: initial setup, screenshots, packaging, uploading to the test platform, deployment, etc.
Because the fastlane command is not very convenient for QA and other non-technical personnel to package, it needs to be called with the help of Jenkins.
Jenkins:
Jenkins is an independent open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous repetitive work. It aims to provide an open and easy-to-use software platform to make continuous integration of software possible. Formerly known as Hudson, it is an extensible continuous integration engine. Can be used to automate various tasks such as building, testing and deploying software.
4. Summary
In conclusion, We use Git/Gitlab for project source code management, and use Jenkins as a trigger to capture push and other operations either regularly or manually to trigger packaging actions; execute Fastlane scripts for certificate management and packaging; and distribute through the Pgyer platform.
Reference
[1] https://www.pgyer.com/
[2] https://zhuanlan.zhihu.com/p/633284341/
[3] https://developer.apple.com/testflight/
[4] https://firebase.google.com/products/app-distribution/
[5] https://www.hockeyapp.net/
[6] https://appcenter.ms/