Middle+
Wat is uw ervaring met het ontwikkelen van CI/CD voor mobiele applicaties?
sobes.tech AI
Antwoord van AI
Ik heb ervaring met het bouwen van CI/CD-pijplijnen voor mobiele applicaties (iOS en Android).
De belangrijkste fasen waarmee ik heb gewerkt:
- Bouwen: Gebruik van Xcodebuild voor iOS en Gradle voor Android. Integratie met build-systemen (Jenkins, GitLab CI/CD, CircleCI, GitHub Actions).
- Testen: Uitvoeren van unit tests, integratietests, UI-tests op simulators/emulators of echte apparaten (met Firebase Test Lab, BrowserStack, Device Farm).
- Ondertekenen: Automatisering van het ondertekenen van apps voor publicatie (Code Signing Identities, Provisioning Profiles voor iOS; Keystore voor Android).
- Distributie:
- Interne builds: Gebruik van TestFlight voor iOS en Firebase App Distribution/Internal Test Tracks voor Android.
- Publicatie naar winkels: Automatisering van het uploaden van artefacten naar App Store Connect via Fastlane of iTunes Connect Transporter en naar Google Play Store via Google Play Developer API of Fastlane.
De tools waarmee ik heb gewerkt:
- CI/CD-systemen: Jenkins, GitLab CI/CD, GitHub Actions.
- Build/Deploy automatiseringstools: Fastlane, Gradle, Xcodebuild.
- Dependency management: CocoaPods, Carthage voor iOS; Gradle Dependency Management voor Android.
- Testtools: XCTest, EarlGrey, Appium, Espresso, UI Automator.
- Cloud testing services: Firebase Test Lab, BrowserStack.
- Versiebeheersystemen: Git.
Voorbeeld van een pipeline (vereenvoudigd):
# .gitlab-ci.yml voorbeeld voor GitLab CI/CD
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 # Xcode 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
Ishlab chiqish 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.