Co z CI / CD?

Continuous Integration (CI) is the prace of automatically integrating code changes frem multiple contributions into a share repository several times a day. Each integration is verified by an automate build and tett supples, catching errors arrly. Continous Delivery (CD) builds on CI by automating the entire recorase process so that every change that passes all tests can be deployed to production with thee push of a button. For mobile applications, included generatides signs ned builds, uploading ts, uploadends, apbloyed ts, and manages, and management, anbuilbesting, anbuilbesting contraing

CI / CD has established a corporate of modern companiere colledering. In thee context of React Native, where apps mutt run on both iOS and d Android, automating every step of thee contexte reduces manual overhead andd minimizes platform-specific inconsistencies. Without CI / CD, teams often rely on a single two manually build, sign, and upload restases - a process prone to human error and delays.

Why CI / CD Matters for React Native

React Native wprowadza unikalne wyzwania, że mate CI / CD especialle valuable. Te codebase is written in JavaScript, but te final product is a nativa app. This means you need to manage two different build systems (Xcode for iOS, Gradle for Android), handle nativa dependencies that may require platform- specific configurations, and navigate app store review processes. A robutt conclurees these comples comples are handled consivevy entley times.

  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Faster beeback loops Xi1; Xi1; FLT: 1 Xi3; Xi3; - Developers get exiate result from tests, linting, and static analysis, often with in minutes of pushing code.
  • Xiv1; Xiv1; FLT: 0 Xiv3; Xiv3; Reduced integration hell Xiv1; Xiv1; FLT: 1 Xiv3; Xiv3; - Frequent merges with automated verification prevent large, conflict- ridden merges.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Reproducible builds Xi1; Xi1; FLT: 1 Xi3; Xi3; - CI environments are clean and configured frem scratch, eliminating contribution quent; works on my machine contribution quentives; issues.
  • - Automating app store submissions (screenshots, metadata, signing) cuts release cycles from days to hours.
  • (Dz.U. L 311 z 15.11.2014, s. 1).

Pomijając te korzyści, mane React Native zespoły zaczynają bez CI / CD, ponieważ setting it up requires understanding g of nativa tooling, fastlane, and platform- specific signing. The invement pays of f quickly, especially as thee team grows.

Core Components of a CI / CD Pipeline for React Native

Every Moscine powinna obejmować te kolejne staże, lub dered frem fastest to o slowett.

Version Control andBranching Strategy

A clear branching model is the foundation. GitFlow (development, develop, release, hotfix branches) works well for larger teams with scheduled developes. Trunk- based development (short-lived branches merging into main sevel times daily) accords teams aiming for continuous deployment. Whichever you choose, ensure your CI triggers ostn pull requests to validate changes before merging.

Most CI systems allow you tu definie rule per branch - for example, running only unit tests on voluure branches, but full integration tests and beta deployments on te e main branch.

Automated Testing

Testing is the heart of CI. For React Native, a layered approach is recomded:

  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Unit tests Xi1; Xi1; FLT: 1 Xi3; Xi3; - Usie Jess (already bundled witt React Native) to tect Xiless logic, reducers, and utility functions. Jess is faszt and can run in parallel.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Integration tests Xi1; Xi1; FLT: 1 Xi3; Xi3; - Tect interactions between contexents andd services. React Native Testing Library helps render contexents andd assert behavor.
  • Reg.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Snapshot testing Xi1; Xi1; FLT: 1 Xi3; Xi3; - Detect unintentional UI changes byComparaing rendered output to stoot snapshots. Usie with caution as snapshots can accore accordance- hevy.

Konfiguracja: You r CI tu fail thee build if any tect does nots pass. Consider setting up coverage boldds to forcement quality gates.

Build Automation

Building a React Native app for production requirets signing andd preparang platform- specific delivables (IPA for iOS, APK / AAB for Android). 1; It handles code signing: 0 fastlane 3; fastlane presents 1; fastlane present 1; FLT: 1 messa3; Is the te de facto standard for automating these steps. It handles code signing, screenshots, and even uploading to app stores. A typical metiine these will run:

  • (z wykorzystaniem siłowni) to kreate an .ipa
  • (używa gradle) to crete an.

For iOS, you mutt manage certificates andprovisioning profiles. Usie fastlane 's match ch to securely store andd synchronize signing assets across team members andd CI machines.

Code Quality andd Linting

Wykonaj spójny code style using ESLint and Prettier. Run these in CI as s early as possible - they fail faST andd consume few resources. For deeper analysis, integrate SonarQuube or CodeClimate to o track code smells, duplication, andd security shiessabilities. Many teams also run TypeScript typet- checking (preseng 1; Britt1; FLT: 2 contac 3; 3;) tcatch type errors.

Artifact Management andd Code Signing

Build artifacts (signed IPA i APK) powinny być w magazynie securely for distribution. Use a cloud storage bucket (S3, GCS) or a dedicated services like App Center (though it has been deprecated for new distributios). For iOS, signing customs certificates andd provisioning g profiles that exe and mutt bee rotated. Automate renewal using fastlane match and store private keys in I secret variables.

Several platforms provide first-class support for React Native. Your choice depends on team size, budget, and existing ecosystem.

  • Xi1; Xi1; FLT: 0 XI3; XI3; XI3; GitHub Actions XI1; XI1; FLT: 1 XI3; XI3; - Tightly integrated with GitHub. Free tier included des 2,000 minutes / month for public repositories. Extensive marketplace of actions for React Native, fastlane, and code signing. Bett for teams already on GitHub.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; GitLab CI / CD Xi1; Xi1; FLT: 1 Xi3; Xi3; - Built directly into GitLab. Offers unlimited minutes for public projects andd powerful paralelization. Good for teams preferuje single DevOps platform.
  • Xi1; Xi1; FLT: 0 XI3; XI3; XI1; XI1; FLT: 1 XI3; XI3; - Highly customizable with h caching andd parallelism. iOS builds require macOS runners (cost extra). Popular among mobile teams due to robutt Docker andd macOS support.
  • Reg.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Codemagic Xi1; Xi1; FLT: 1 Xi3; Xi3; - Focused on Flutter andReact Native. Offers macOS machines andd integrates with Codemagic 's own signing management. Good difficitiva for budget-slemours teams.

App Center (message) was once a popular choice but is now in consignance mode; consider migrating to messativa platforms.

Step- by- Step: Setting Up CI / CD with GitHub Actions

Asume a standard React Native project (created with present 1; Xi1; FLT: 3 presentation 3; Xi3;) stold on GitHub. The following example sets up a contexine for testing, building, and deploying to TestFlight andd Google Play.

Plik Workflow

Create Agree1; IB1; FLT: 4 Agreement 3; IB3;. Definite triggers: push to main or release branches, and pull requests.

name: CI/CD Pipeline
on:
 push:
 branches: [main, release/*]
 pull_request:
 branches: [main]

Testy Runninga

Use a Node.js environment. Cache dependencies to speed up consident runs.

jobs:
 test:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v4
 - uses: actions/setup-node@v4
 with:
 node-version: '20'
 cache: 'npm'
 - run: npm ci
 - run: npm test -- --coverage
 - run: npx eslint .
 - run: npx tsc --noEmit

If any step fails, the joba stops ande the colomine alerts thee developer.

Building for iOS and Android

iOS builds require macOS runners (GitHub offers present 1; Xi1; FLT: 7 presents 3; Xi3; or presents 1; Xi1; FLT: 8 presentation 3; Xi3;). Android builds can run un Ubuntu but require the Android SDK. Usie separate jobs for each platform to parallelize execution.

Xi1; Xi1; FLT: 0 Xi3; Xi3; Android Build Job Xi1; Xi1; FLT: 1 Xi3; Xi3;

 build-android:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v4
 - uses: actions/setup-node@v4
 with: { node-version: '20' }
 - run: npm ci
 - run: |
 cd android && ./gradlew assembleRelease
 env:
 SIGNING_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
 SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
 SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
 SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
 - uses: actions/upload-artifact@v4
 with:
 name: app-release.aab
 path: android/app/build/outputs/bundle/release/app-release.aab

(Dz.U. L 311 z 15.11.2014, s. 1).

 build-ios:
 runs-on: macos-13
 steps:
 - uses: actions/checkout@v4
 - uses: actions/setup-node@v4
 with: { node-version: '20' }
 - run: npm ci
 - run: bundle install
 - run: bundle exec fastlane ios build
 env:
 MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
 FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
 - uses: actions/upload-artifact@v4
 with:
 name: app.ipa
 path: build/ios/App.ipa

Uwaga: iOS wymaga Xcode Command Line Tools, which are pre- installalod on GitHub macOS runners. fastlane should be configured with a eng1; Ig.1; FLT: 11 contex3; Ig3; that handles signing via match and builds with gym.

Deploying to App Stores

After building, run deployment jobs that depend on thee build jobs. Usie build 1; Xi1; FLT: 0 Xi3; Xi3; fastlane pilot division 1; Xi1; FLT: 1 Xi3; Xion3; for TestFlight and division; Xion1; FLT: 2 Xion3; FLT: 2 Xion3; fastlane supply division 1; FLT: 3 Xion3; FLT: 3; for Google Play.

 deploy-testflight:
 needs: [build-ios, test]
 runs-on: macos-13
 steps:
 - uses: actions/checkout@v4
 - run: bundle install
 - run: bundle exec fastlane ios upload_to_testflight
 env:
 FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC }}

 deploy-playstore:
 needs: [build-android, test]
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v4
 - run: bundle install
 - run: bundle exec fastlane android deploy_to_playstore
 env:
 PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}

For production releases, add a manual approval step or only trigger on tags.

Begt Practices for React Native CI / CD

  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Cache aggressively Xi1; Xi1; FLT: 1 Xi3; Xi3; - Cache node _ modules, CocoaPods, Gradle caches, ande Homebrew packages. Store them based on a hash of lockfiles. This can cut build times by 50% or more.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Usie environment variables andsecrets Xi1; FLT: 1 Xi3; Xi3; - Never hardcode API keys, signing credentials, or tokens. Store them in CI platform secrets.
  • (zob. pkt 2.2.1.1.1 niniejszego załącznika)
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Run tests in parallel Xi1; Xi1; FLT: 1 Xi3; Xi3; - Split tect phapples across multiple jobs or use tess sharding (supported by y Jess with Xi1; Xi1; FLT: 13 XI3; Xi3; Xi3; And Xi1; Xi1; FLT: 14 XI3; XI3;).
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Handle nativa dependencies carefly 1; Xi1; FLT: 1 Xi3; Xi3; - If you use libraries with nativa code (np., react- native- camera), ensure your CI has the requid system dependencies (np., OpenCV) pre- installed.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Monorepo considerations Xi1; Xi1; FLT: 1 Xi3; Xi3; - If using a monorepo (Nx, Turborepo), configure CI to detect changed packages andd only build / tett fected one.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Record and alert Xi1; Xi1; FLT: 1 Xi3; Xi3; - Xilor build duration, failure rates, and tect covenage trends. Set up notifications (Slack, email) for faifed accordines.

Common Pitfalls andHow to Avoid Them

  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Long build times Xi1; Xi1; FLT: 1 Xi3; Xi3; - Optimize by y caching andd paralelizing jobs. Usie macOS runners only for iOS builds; leverage Linux for Android and testing.
  • Reference: 1; Xi1; FLT: 0 XI3; XI3; Flaky tests XI1; XI1; FLT: 1 XI3; XI3; - Especially E2E tests on CI. Usie retry mechanisms or mark them as non-blocking. Prefer Detox 's built- in retry. Ensure simulators / emulators are clean.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Certificate and provideng expire confidens confidence confidence confidence 1; Xi1; FLT: 1 Xi3; Xi3; - Usie fastlane match h with a Git repo or cloud storage. Set calendar rememders to rotate certificates before confidence. Automate renewal using match 's accord 1; FLT: 15 Xi3; Xi3; flag in a monthly cron job.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; iOS signing issues in CI Xi1; Xi1; FLT: 1 Xi3; Xi3; - Common pitfalls: wrong provisiong profile, mismatch between bundle identifier andd profile, exired private key. Double- check match configuation andd ensure all secrets are correct.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Xi3; Android keystore loss Xi1; Xi1; FLT: 1 Xi3; Xi1; - Keep backup of your release keystore. If lost, you cannot update the app. Usie CI secrets to story it, but also keep a local backup in a security location.
  • Xi1; Xi1; FLT: 0 XI3; Xi3; Dependency version mismatches Xi1; Xi1; FLT: 1 XI3; XI3; - Pin versions in Xi1; XI1; FLT: 16 XI3; And XI1; XI1; FLT: 17 XI3; XI3; FL3; FLT; VI1; FLT: 19 XI3; FLT; FLT: 1XI3QIF; FLT: 1XI3; Instead OF XI1; FLT: 19 XI3; XIX3; FLT 3Q3;).

Suszeczki z pomiarami

Track thee following metrics to eviate your or equine:

  • (1); (1); (1); (1); (1); (1); (1); (1); (1); (1); (1); (1); (1); (2); (2); (2); (2); (2); (2); (2); (2); (2); (2); (2); (2); (4); (4); (4); (4); (4); (4); (4); (4); (4) (4); (4); (4) (4); (4); (4); (4) (4); (4) (4) (4); (4) (4) (4) (4) (4); (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4
  • W przypadku gdy w wyniku zastosowania tej metody nie można określić, czy dana substancja jest substancją czynną, należy zastosować metodę określoną w pkt 6.2.1.1.1.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Xiure rate Xi1; Xi1; FLT: 1 Xi3; Xion3; - Xionga of builds that fail. Investigate recurring failures to o improwite stability.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Time to beedback Xi1; Xi1; FLT: 1 Xi3; Xi3; - Howlong does it take for a developer to see CI results? Under 10 minutes for unit tests is excellent.
  • Xi1; Xi1; FLT: 0 Xi3; Xi3; Teszt coverage Xi1; Xi1; FLT: 1 Xi3; Xi3; - Monitoring trends, nott absolute numbers. A sudden drop indicates new untested code.

Use these metrics to identify throecks and iterate on your indiine. For example, if iOS builds take 45 minutes, consider caching CocoaPods and using macOS M1 runners for faster compilation.

Konkluzja

Wdrożenie programu CII / CD for React Native apps is nott just about t automation - it 's about creating a relieable, reproducible delivy process that scales with your team. By integrating testing, building, signing, and deployment into a single contribure, you reduce risk, speed up contrases, and free developers to focus on configures. Start small: enable linting and unit test first, then add builds, and enally authomeliers.

Te narzędzia i wzory descripbed here - GitHub Actions, fastlane, Detox, and proper caching - are battle- tested in production by y teams shipping millions of downloads. Adoptim them will transform yourr development workflow from manual, error- prone releases to a smooth, continuous straam of high--quality updates.

For further reading, consult environ1; Xi1; FLT: 0 is 3; Xi3; React Native 's official CI / CD documentation indiv1; Xi1; FLT: 1 giganty3; FLT: 3; and the indiv1; Xi1; FLT: 2 giganty3; FLT: 3; CircleCI guide for React Native entiv1; Xi1; FLT: 3 gig. 3; Xigd. Both provide platform- specific speciles and troubleshooting tips.