Refactoring CI Android

This commit is contained in:
Diego Mello 2023-06-21 09:54:55 -03:00
parent b2c5f588bd
commit 5839327baa
1 changed files with 169 additions and 150 deletions

View File

@ -196,52 +196,49 @@ commands:
paths: paths:
- android/app/build/outputs - android/app/build/outputs
ios-build: # ios-build:
description: "Build iOS app" # description: "Build iOS app"
steps: # steps:
- checkout # - checkout
- restore_cache: *restore-gems-cache # - restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac # - restore_cache: *restore-npm-cache-mac
- run: *install-npm-modules # - run: *install-npm-modules
- run: *update-fastlane-ios # - run: *update-fastlane-ios
- manage-pods # - manage-pods
- run: # - run:
name: Set Google Services # name: Set Google Services
command: | # command: |
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then # if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
echo $GOOGLE_SERVICES_IOS | base64 --decode > GoogleService-Info.plist # echo $GOOGLE_SERVICES_IOS | base64 --decode > GoogleService-Info.plist
fi # fi
working_directory: ios # working_directory: ios
- run: # - run:
name: Fastlane Build # name: Fastlane Build
no_output_timeout: 40m # no_output_timeout: 40m
command: | # command: |
agvtool new-version -all $CIRCLE_BUILD_NUM # agvtool new-version -all $CIRCLE_BUILD_NUM
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./RocketChatRN/Info.plist # /usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./RocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./ShareRocketChatRN/Info.plist # /usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./ShareRocketChatRN/Info.plist
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then # if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
echo $APP_STORE_CONNECT_API_KEY_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8 # echo $APP_STORE_CONNECT_API_KEY_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8
bundle exec fastlane ios build_official # bundle exec fastlane ios build_official
fi # fi
working_directory: ios # working_directory: ios
- save_cache: *save-npm-cache-mac # - save_cache: *save-npm-cache-mac
- save_cache: *save-gems-cache # - save_cache: *save-gems-cache
- store_artifacts: # - store_artifacts:
path: ios/Rocket.Chat.ipa # path: ios/Rocket.Chat.ipa
- store_artifacts: # - store_artifacts:
path: ios/Rocket.Chat.app.dSYM.zip # path: ios/Rocket.Chat.app.dSYM.zip
- persist_to_workspace: # - persist_to_workspace:
root: . # root: .
paths: # paths:
- ios/*.ipa # - ios/*.ipa
- ios/*.zip # - ios/*.zip
upload-to-google-play-beta: upload-to-google-play-beta:
description: "Upload to Google Play beta" description: "Upload to Google Play beta"
parameters:
official:
type: boolean
steps: steps:
- checkout - checkout
- attach_workspace: - attach_workspace:
@ -253,10 +250,9 @@ commands:
- run: *update-fastlane-android - run: *update-fastlane-android
- run: - run:
name: Fastlane Play Store Upload name: Fastlane Play Store Upload
command: bundle exec fastlane android beta official:<< parameters.official >> command: bundle exec fastlane android beta
working_directory: android working_directory: android
# EXPERIMENTAL ONLY
upload-to-internal-app-sharing: upload-to-internal-app-sharing:
description: "Upload to Internal App Sharing" description: "Upload to Internal App Sharing"
steps: steps:
@ -275,21 +271,21 @@ commands:
# EXPERIMENTAL ONLY # EXPERIMENTAL ONLY
# No plans to do it for Official # No plans to do it for Official
upload-to-google-play-production: # upload-to-google-play-production:
description: "Upload to Google Play production" # description: "Upload to Google Play production"
steps: # steps:
- checkout # - checkout
- attach_workspace: # - attach_workspace:
at: android # at: android
- run: # - run:
name: Store the google service account key # name: Store the google service account key
command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json # command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json
working_directory: android # working_directory: android
- run: *update-fastlane-android # - run: *update-fastlane-android
- run: # - run:
name: Fastlane Play Store Upload # name: Fastlane Play Store Upload
command: bundle exec fastlane android production # command: bundle exec fastlane android production
working_directory: android # working_directory: android
upload-to-testflight: upload-to-testflight:
description: "Upload to TestFlight" description: "Upload to TestFlight"
@ -361,7 +357,7 @@ jobs:
- save_cache: *save-npm-cache-linux - save_cache: *save-npm-cache-linux
# Android builds # Android builds
android-build-experimental: android-build:
<<: *defaults <<: *defaults
<<: *android-img <<: *android-img
environment: environment:
@ -371,55 +367,38 @@ jobs:
steps: steps:
- android-build - android-build
# Android automatic builds # # Android automatic builds
android-automatic-build-experimental: # android-automatic-build-experimental:
# <<: *defaults
# <<: *android-img
# environment:
# <<: *android-env
# <<: *bash-env
# resource_class: xlarge
# steps:
# - android-build
# android-build-official:
# <<: *defaults
# <<: *android-img
# environment:
# <<: *android-env
# <<: *bash-env
# resource_class: xlarge
# steps:
# - android-build
android-internal-app-sharing:
<<: *defaults <<: *defaults
<<: *android-img <<: *android-img
environment:
<<: *android-env
<<: *bash-env
resource_class: xlarge
steps:
- android-build
android-build-official:
<<: *defaults
<<: *android-img
environment:
<<: *android-env
<<: *bash-env
resource_class: xlarge
steps:
- android-build
android-internal-app-sharing-experimental:
<<: *defaults
<<: *android-img
steps: steps:
- upload-to-internal-app-sharing - upload-to-internal-app-sharing
android-google-play-beta-experimental: android-google-play-beta:
<<: *defaults
<<: *android-img
steps:
- upload-to-google-play-beta:
official: false
android-google-play-production-experimental:
<<: *defaults <<: *defaults
<<: *android-img <<: *android-img
steps: steps:
- upload-to-google-play-production - upload-to-google-play-beta
android-google-play-beta-official:
<<: *defaults
<<: *android-img
steps:
- upload-to-google-play-beta:
official: true
e2e-build-android: e2e-build-android:
<<: *defaults <<: *defaults
@ -517,8 +496,45 @@ jobs:
ios-build: ios-build:
executor: mac-env executor: mac-env
description: "Build iOS app"
steps: steps:
- ios-build - checkout
- restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac
- run: *install-npm-modules
- run: *update-fastlane-ios
- manage-pods
- run:
name: Set Google Services
command: |
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
echo $GOOGLE_SERVICES_IOS | base64 --decode > GoogleService-Info.plist
fi
working_directory: ios
- run:
name: Fastlane Build
no_output_timeout: 40m
command: |
agvtool new-version -all $CIRCLE_BUILD_NUM
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./RocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./ShareRocketChatRN/Info.plist
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
echo $APP_STORE_CONNECT_API_KEY_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8
bundle exec fastlane ios build_official
fi
working_directory: ios
- save_cache: *save-npm-cache-mac
- save_cache: *save-gems-cache
- store_artifacts:
path: ios/Rocket.Chat.ipa
- store_artifacts:
path: ios/Rocket.Chat.app.dSYM.zip
- persist_to_workspace:
root: .
paths:
- ios/*.ipa
- ios/*.zip
ios-testflight: ios-testflight:
executor: mac-env executor: mac-env
@ -622,59 +638,62 @@ workflows:
- ios-build - ios-build
# Android Experimental # Android Experimental
- android-hold-build-experimental: # - android-hold-build-experimental:
type: approval # type: approval
requires: # requires:
- lint-testunit # - lint-testunit
filters: # filters:
branches: # branches:
ignore: # ignore:
- develop # - develop
- android-build-experimental: # - android-build-experimental:
requires: # requires:
- android-hold-build-experimental # - android-hold-build-experimental
- android-internal-app-sharing-experimental: # - android-internal-app-sharing-experimental:
requires: # requires:
- android-build-experimental # - android-build-experimental
- android-hold-google-play-beta-experimental: # - android-hold-google-play-beta-experimental:
type: approval # type: approval
requires: # requires:
- android-build-experimental # - android-build-experimental
- android-google-play-beta-experimental: # - android-google-play-beta-experimental:
requires: # requires:
- android-hold-google-play-beta-experimental # - android-hold-google-play-beta-experimental
- android-hold-google-play-production-experimental: # - android-hold-google-play-production-experimental:
type: approval # type: approval
requires: # requires:
- android-build-experimental # - android-build-experimental
- android-google-play-production-experimental: # - android-google-play-production-experimental:
requires: # requires:
- android-hold-google-play-production-experimental # - android-hold-google-play-production-experimental
# Android Official # Android Official
- android-hold-build-official: - android-hold-build:
type: approval type: approval
requires: requires:
- lint-testunit - lint-testunit
- android-build-official: - android-build:
requires: requires:
- android-hold-build-official - android-hold-build
- android-hold-google-play-beta-official: - android-internal-app-sharing:
type: approval
requires: requires:
- android-build-official - android-build
- android-google-play-beta-official: # - android-hold-google-play-beta:
requires: # type: approval
- android-hold-google-play-beta-official # requires:
# - android-build
# - android-google-play-beta:
# requires:
# - android-hold-google-play-beta
# Android Automatic Experimental # # Android Automatic Experimental
- android-automatic-build-experimental: # - android-automatic-build-experimental:
filters: # filters:
branches: # branches:
only: # only:
- develop # - develop
requires: # requires:
- lint-testunit # - lint-testunit
- android-google-play-production-experimental: # - android-google-play-production-experimental:
requires: # requires:
- android-automatic-build-experimental # - android-automatic-build-experimental