Middle+
Welche Erfahrung haben Sie in der Entwicklung von CI/CD für mobile Anwendungen?
sobes.tech KI
Antwort von AI
Ich habe Erfahrung im Aufbau von CI/CD-Pipelines für mobile Anwendungen (iOS und Android).
Wichtige Phasen, an denen ich gearbeitet habe:
- Build: Verwendung von Xcodebuild für iOS und Gradle für Android. Integration mit Build-Systemen (Jenkins, GitLab CI/CD, CircleCI, GitHub Actions).
- Tests: Ausführung von Unit-Tests, Integrationstests, UI-Tests auf Simulatoren/Emulatoren oder echten Geräten (mit Firebase Test Lab, BrowserStack, Device Farm).
- Signierung: Automatisierung des Signaturprozesses für die Veröffentlichung (Code Signing Identities, Provisioning Profiles für iOS; Keystore für Android).
- Verteilung:
- Interne Builds: Verwendung von TestFlight für iOS und Firebase App Distribution/Internal Test Tracks für Android.
- Veröffentlichung in Stores: Automatisierung des Hochladens von Artefakten in App Store Connect via Fastlane oder iTunes Connect Transporter und in den Google Play Store via Google Play Developer API oder Fastlane.
Werkzeuge, mit denen ich gearbeitet habe:
- CI/CD-Systeme: Jenkins, GitLab CI/CD, GitHub Actions.
- Build/Deployment-Automatisierungstools: Fastlane, Gradle, Xcodebuild.
- Abhängigkeitsmanagement: CocoaPods, Carthage für iOS; Gradle Dependency Management für Android.
- Test-Tools: XCTest, EarlGrey, Appium, Espresso, UI Automator.
- Cloud-Testdienste: Firebase Test Lab, BrowserStack.
- Versionskontrollsysteme: Git.
Beispiel für eine Pipeline (vereinfachte Version):
# Beispiel .gitlab-ci.yml für GitLab CI/CD
stages:
- build
- test
- deploy_internal
- deploy_store
variablen:
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
variablen:
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
artefakte:
paths:
- android/app/build/outputs/apk/release/*.apk
build_ios:
stage: build
image: macos_runner # Erfordert einen speziellen macOS/Xcode-Runner
before_script:
- gem install bundler
- cd ios
- bundle install
script:
- bundle exec fastlane build release
artefakte:
paths:
- ios/*.ipa # Oder die Fastlane-Ausgabe
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 # falls CocoaPods verwendet wird
- 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
# Uso de fastlane para simplificar o diretamente com a API do Google Play
- bundle exec fastlane supply
only:
- tags # Despachar para a loja apenas em tags
deploy_ios_app_store:
stage: deploy_store
image: macos_runner
before_script:
- cd ios
script:
- bundle exec fastlane deliver
only:
- tags # Despachar para a loja apenas em tags
Trabalhei na otimização do tempo de build, redução de Flaky Tests, configuração de notificações de status do pipeline. Dei atenção especial à segurança da assinatura e à gestão de certificados/chaves. Utilizei variáveis secretas em sistemas CI/CD para armazenar dados sensíveis.