Sobes.tech
Middle+

Mobil ilovalar uchun CI/CD ishlab chiqishda tajribangiz qanday?

sobes.tech AI

AIdan javob

Mobil ilovalar uchun CI/CD konveyerlarini qurish tajribasiga egaman (iOS va Android).

Asosiy bosqichlar bilan ishladim:

  • Qurilish: iOS uchun Xcodebuild va Android uchun Gradle dan foydalanish. Qurilish tizimlari bilan integratsiya qilish (Jenkins, GitLab CI/CD, CircleCI, GitHub Actions).
  • Test qilish: Birlik testlari, integratsiya testlari, UI testlarini simulyatorlar/emulyatorlar yoki haqiqiy qurilmalarda ishga tushirish (Firebase Test Lab, BrowserStack, Device Farm yordamida).
  • Imzolash: Ilovalarni nashr qilish uchun avtomatlashtirish (Code Signing Identities, iOS uchun Provisioning Profiles; Android uchun Keystore).
  • Tarqatish:
    • Ichki qurilishlar: iOS uchun TestFlight va Android uchun Firebase App Distribution/Internal Test Tracks dan foydalanish.
    • Do'konlarga nashr qilish: Fastlane yoki iTunes Connect Transporter yordamida App Store Connect ga artefaktlarni yuklash va Google Play Store ga Google Play Developer API yoki Fastlane yordamida yuklash.

Ishlagan asboblar:

  • CI/CD tizimlari: Jenkins, GitLab CI/CD, GitHub Actions.
  • Qurilish/joylashtirish avtomatlashtirish asboblari: Fastlane, Gradle, Xcodebuild.
  • Qaramliklarni boshqarish: CocoaPods, Carthage iOS uchun; Gradle Dependency Management Android uchun.
  • Test qilish asboblari: XCTest, EarlGrey, Appium, Espresso, UI Automator.
  • Bulutli test xizmatlari: Firebase Test Lab, BrowserStack.
  • Versiya nazorati tizimlari: Git.

Qisqa pipeline misoli (soddalashtirilgan):

# .gitlab-ci.yml GitLab CI/CD uchun misol

stages:
  - build
  - test
  - deploy_internal
  - deploy_store

variables:
  ANDROID_BUILD_TOOLS: "30.0.3"
  ANDROID_SDK_ROOT: "$CI_PROJECT_DIR/android-sdk"

cache:
  paths:
    - ~/.gradle/caches
    - ~/.gradle/wrapper
    - Pods/

build_android:
  stage: build
  image: openjdk:11-jdk-slim
  variables:
    GRADLE_OPTS: "-Dorg.gradle.daemon=false"
  before_script:
    - apt-get update && apt-get install -y unzip
    - mkdir $ANDROID_SDK_ROOT
    - wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
    - unzip commandlinetools-linux-7583922_latest.zip -d $ANDROID_SDK_ROOT
    - yes | $ANDROID_SDK_ROOT/cmdline-tools/bin/sdkmanager --licenses
    - $ANDROID_SDK_ROOT/cmdline-tools/bin/sdkmanager "platforms;android-30" "build-tools;$ANDROID_BUILD_TOOLS"
    - export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/bin:$ANDROID_SDK_ROOT/platform-tools
    - cd android
  script:
    - ./gradlew assembleRelease
  artifacts:
    paths:
      - android/app/build/outputs/apk/release/*.apk

build_ios:
  stage: build
  image: macos_runner # Xususan macOS/Xcode runner talab etiladi
  before_script:
    - gem install bundler
    - cd ios
    - bundle install
  script:
    - bundle exec fastlane build release
  artifacts:
    paths:
      - ios/*.ipa

test_android_unit:
  stage: test
  image: openjdk:11-jdk-slim
  before_script:
    - cd android
  script:
    - ./gradlew testReleaseUnitTest

test_ios_unit:
  stage: test
  image: macos_runner
  before_script:
    - pod install
    - cd ios
  script:
    - xcodebuild test -project YourApp.xcodeproj -scheme YourApp -destination 'platform=iOS Simulator,name=iPhone 12'

deploy_android_firebase:
  stage: deploy_internal
  image: openjdk:11-jdk-slim
  before_script:
    - apt-get update && apt-get install -y curl
    - curl -sL https://firebase.tools | bash
    - cd android
  script:
    - firebase appdistribution:distribute app/build/outputs/apk/release/*.apk --app <firebase-app-id> --token $FIREBASE_TOKEN --release-notes "Automated build ${CI_PIPELINE_IID}" --testers-file ../testers.txt

deploy_ios_testflight:
  stage: deploy_internal
  image: macos_runner
  before_script:
    - cd ios
  script:
    - bundle exec fastlane pilot upload

deploy_android_play_store:
  stage: deploy_store
  image: openjdk:11-jdk-slim
  before_script:
     - apt-get update && apt-get install -y python3 python3-pip
     - pip3 install google-api-python-client oauth2client
     - cd android
  script:
     - echo "$GOOGLE_PLAY_KEY_JSON" | base64 --decode > service_account_key.json
     - bundle exec fastlane supply
  only:
    - tags

deploy_ios_app_store:
  stage: deploy_store
  image: macos_runner
  before_script:
    - cd ios
  script:
    - bundle exec fastlane deliver
  only:
    - tags

Sizga qurilish vaqtini optimallashtirish, Flaky Tests ni kamaytirish, pipeline holati haqida bildirishnomalar sozlash bo'yicha yordam beraman. Imzo xavfsizligi va sertifikatlar/kalitlarni boshqarishga alohida e'tibor qaratdim. Maxfiy o'zgaruvchilarni CI/CD tizimlarida xavfsiz ma'lumotlarni saqlash uchun ishlatdim.