From 4ed1fee04c9d75d0ed94e5cd4580c27597c35866 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 26 Nov 2025 14:16:15 -0300 Subject: [PATCH 1/6] Add FAD Gem --- Gemfile | 3 ++- Gemfile.lock | 59 +++++++++++++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/Gemfile b/Gemfile index 4c4b0ee69a38..801b85cf4a71 100644 --- a/Gemfile +++ b/Gemfile @@ -4,12 +4,13 @@ source 'https://rubygems.org' gem 'danger-dangermattic', '~> 1.2' gem 'fastlane', '~> 2.216' +gem 'fastlane-plugin-firebase_app_distribution', '~> 0.10' gem 'nokogiri' gem 'rubocop', '~> 1.65' ### Fastlane Plugins -gem 'fastlane-plugin-wpmreleasetoolkit', '~> 13.5' +gem 'fastlane-plugin-wpmreleasetoolkit', '~> 13.7' # gem 'fastlane-plugin-wpmreleasetoolkit', path: '../../release-toolkit' # gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit', branch: '' diff --git a/Gemfile.lock b/Gemfile.lock index d89ffd810d74..32e9695e8e77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,21 +5,21 @@ GEM base64 nkf rexml - activesupport (8.0.3) + activesupport (8.1.1) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) artifactory (3.0.17) ast (2.4.3) atomos (0.1.3) @@ -44,7 +44,6 @@ GEM aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.3.0) - benchmark (0.4.1) bigdecimal (3.3.0) buildkit (1.6.1) sawyer (>= 0.6) @@ -59,24 +58,24 @@ GEM commander (4.6.0) highline (~> 2.0.0) concurrent-ruby (1.3.5) - connection_pool (2.5.4) + connection_pool (2.5.5) cork (0.3.0) colored2 (~> 3.1) - danger (9.5.1) + danger (9.5.3) base64 (~> 0.2) claide (~> 1.0) claide-plugins (>= 0.9.2) - colored2 (~> 3.1) + colored2 (>= 3.1, < 5) cork (~> 0.1) faraday (>= 0.9.0, < 3.0) faraday-http-cache (~> 2.0) - git (~> 1.13) - kramdown (~> 2.3) + git (>= 1.13, < 3.0) + kramdown (>= 2.5.1, < 3.0) kramdown-parser-gfm (~> 1.0) octokit (>= 4.0) pstore (~> 0.1) - terminal-table (>= 1, < 4) - danger-dangermattic (1.2.2) + terminal-table (>= 1, < 5) + danger-dangermattic (1.2.4) danger (~> 9.4) danger-plugin-api (~> 1.0) danger-rubocop (~> 0.13) @@ -168,7 +167,10 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.4.1) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) - fastlane-plugin-wpmreleasetoolkit (13.5.1) + fastlane-plugin-firebase_app_distribution (0.10.1) + google-apis-firebaseappdistribution_v1 (~> 0.3.0) + google-apis-firebaseappdistribution_v1alpha (~> 0.2.0) + fastlane-plugin-wpmreleasetoolkit (13.7.0) activesupport (>= 6.1.7.1) buildkit (~> 1.5) chroma (= 0.2.0) @@ -201,6 +203,10 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.a) rexml + google-apis-firebaseappdistribution_v1 (0.3.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-firebaseappdistribution_v1alpha (0.2.0) + google-apis-core (>= 0.11.0, < 2.a) google-apis-iamcredentials_v1 (0.17.0) google-apis-core (>= 0.11.0, < 2.a) google-apis-playcustomapp_v1 (0.13.0) @@ -236,20 +242,20 @@ GEM concurrent-ruby (~> 1.0) java-properties (0.3.0) jmespath (1.6.2) - json (2.15.1) + json (2.16.0) jwt (2.10.2) base64 kramdown (2.5.1) rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - language_server-protocol (3.17.0.4) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) mini_magick (4.13.2) mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.26.0) + minitest (5.26.2) multi_json (1.17.0) multipart-post (2.4.1) mutex_m (0.3.0) @@ -268,23 +274,23 @@ GEM optparse (0.6.0) os (1.1.4) parallel (1.27.0) - parser (3.3.8.0) + parser (3.3.10.0) ast (~> 2.4.1) racc plist (3.7.2) - prism (1.4.0) + prism (1.6.0) progress_bar (1.3.4) highline (>= 1.6) options (~> 2.3.0) pstore (0.2.0) - public_suffix (6.0.2) + public_suffix (7.0.0) racc (1.8.1) rainbow (3.1.1) rake (13.3.0) rake-compiler (1.3.0) rake rchardet (1.10.0) - regexp_parser (2.10.0) + regexp_parser (2.11.3) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -293,7 +299,7 @@ GEM rexml (3.4.4) rmagick (4.3.0) rouge (3.28.0) - rubocop (1.75.4) + rubocop (1.81.7) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -301,16 +307,16 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.44.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.44.1) + rubocop-ast (1.48.0) parser (>= 3.3.7.2) prism (~> 1.4) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.4.1) - sawyer (0.9.2) + sawyer (0.9.3) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) securerandom (0.4.1) @@ -336,7 +342,7 @@ GEM concurrent-ruby (~> 1.0) uber (0.1.0) unicode-display_width (2.6.0) - uri (1.0.4) + uri (1.1.1) word_wrap (1.0.0) xcodeproj (1.27.0) CFPropertyList (>= 2.3.3, < 4.0) @@ -356,7 +362,8 @@ PLATFORMS DEPENDENCIES danger-dangermattic (~> 1.2) fastlane (~> 2.216) - fastlane-plugin-wpmreleasetoolkit (~> 13.5) + fastlane-plugin-firebase_app_distribution (~> 0.10) + fastlane-plugin-wpmreleasetoolkit (~> 13.7) nokogiri rmagick (~> 4.1) rubocop (~> 1.65) From 93b2bafb82e10209004f64a3f90ec7705812cb97 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 26 Nov 2025 14:28:22 -0300 Subject: [PATCH 2/6] Add lane to build and distribute prototype builds to FAD --- fastlane/Fastfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 62321bc50c73..ee0117df4d96 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -11,6 +11,11 @@ UI.user_error!('Please run fastlane via `bundle exec`') unless FastlaneCore::Hel # The valid values for `app:` parameter, i.e. the two possible top-level modules we can build (mobile and wear app) MOBILE_APP = 'WooCommerce' WEAR_APP = 'WooCommerce-Wear' +# Display names for the apps (used in comments, release notes, etc.) +APP_DISPLAY_NAMES = { + WEAR_APP => '⌚️ Wear OS', + MOBILE_APP => '📱 Mobile' +}.freeze PROJECT_ROOT_FOLDER = File.dirname(File.expand_path(__dir__)) VERSIONS_CATALOG_FILE = File.join(PROJECT_ROOT_FOLDER, 'gradle/libs.versions.toml') @@ -71,6 +76,12 @@ BUILD_CODE_FORMATTER = Fastlane::Wpmreleasetoolkit::Versioning::SimpleBuildCodeF BUILD_CODE_CALCULATOR = Fastlane::Wpmreleasetoolkit::Versioning::SimpleBuildCodeCalculator.new VERSION_FILE = Fastlane::Wpmreleasetoolkit::Versioning::AndroidVersionFile.new(version_properties_path: VERSION_PROPERTIES_PATH) +######################################################################## +# Firebase App Distribution (FAD) +######################################################################## +FIREBASE_APP_ID = '1:124902176124:android:4046dc320bf1825b1620f9' +FIREBASE_TESTERS_GROUP = 'woocommerce-android---prototype-builds' + ######################################################################## # Environment ######################################################################## @@ -1364,7 +1375,7 @@ platform :android do ) install_url = "#{PROTOTYPE_BUILD_DOMAIN}/#{upload_path}" - platform_name = { WEAR_APP => '⌚️ Wear OS', MOBILE_APP => '📱 Mobile' }.fetch(app, '_(Unknown)_') + platform_name = APP_DISPLAY_NAMES.fetch(app, app) comment_body = prototype_build_details_comment( app_display_name: "#{app} Android", download_url: install_url, @@ -1386,6 +1397,43 @@ platform :android do end end + # This lane builds a prototype build and uploads it to Firebase App Distribution + # + # @param [String] app The Android app to build (MOBILE_APP aka 'WooCommerce' or WEAR_APP aka 'WooCommerce-Wear') + # + desc 'Builds a prototype build and uploads it to Firebase App Distribution' + lane :build_and_upload_prototype_build_fad do |app:| + UI.user_error!("'FIREBASE_APP_DISTRIBUTION_ACCOUNT_KEY' must be defined as an environment variable.") unless ENV['FIREBASE_APP_DISTRIBUTION_ACCOUNT_KEY'] + + validate_app_param!(app) + + prototype_build_type = 'Debug' + prototype_flavor = 'Jalapeno' + + # Build release notes with branch, commit, and app info + platform_name = APP_DISPLAY_NAMES.fetch(app, app) + release_notes = <<~NOTES + App: #{platform_name} + Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}` + Commit: #{ENV.fetch('BUILDKITE_COMMIT', 'N/A')[0...7]} + NOTES + + # Build the APK + gradle( + task: ":#{app}:assemble", + flavor: prototype_flavor, + build_type: prototype_build_type + ) + + # Upload to Firebase App Distribution + firebase_app_distribution( + app: FIREBASE_APP_ID, + service_credentials_json_data: ENV.fetch('FIREBASE_APP_DISTRIBUTION_ACCOUNT_KEY', nil), + release_notes: release_notes, + groups: FIREBASE_TESTERS_GROUP + ) + end + ##################################################################################### # Private lanes ##################################################################################### From b9ffc1430c6d065e9a60f36df85d23a31adf750d Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 26 Nov 2025 14:29:03 -0300 Subject: [PATCH 3/6] Add script and pipeline job to build FAD prototypes --- .buildkite/commands/prototype-build-fad.sh | 17 +++++++++++++ .buildkite/pipeline.yml | 29 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 .buildkite/commands/prototype-build-fad.sh diff --git a/.buildkite/commands/prototype-build-fad.sh b/.buildkite/commands/prototype-build-fad.sh new file mode 100755 index 000000000000..fb923a5ddb9d --- /dev/null +++ b/.buildkite/commands/prototype-build-fad.sh @@ -0,0 +1,17 @@ +#!/bin/bash -eu + +"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh" + +echo "--- :rubygems: Setting up Gems" +install_gems + +echo "--- :closed_lock_with_key: Installing Secrets" +bundle exec fastlane run configure_apply + +echo "--- :mag: Retrieving app selection from metadata" +APP_TO_BUILD="$(buildkite-agent meta-data get "app-to-build")" +echo "Selected app: ${APP_TO_BUILD}" + +echo "--- :hammer_and_wrench: Building and uploading to Firebase App Distribution" +bundle exec fastlane build_and_upload_prototype_build_fad app:"${APP_TO_BUILD}" + diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 95542dc5c8f2..181be29da7cd 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -118,3 +118,32 @@ steps: - label: "🐘 Populate Gradle build cache" command: .buildkite/commands/gradle-cache-build.sh plugins: [$CI_TOOLKIT] + + ######################################## + # Optional Prototype Builds for trunk branch, distributed via Firebase App Distribution (FAD) + ######################################## + - group: "🚀 Prototype Build" + if: "build.branch == 'trunk'" + steps: + - block: ":rocket: Build Prototype and distribute via Firebase" + prompt: Select which app to build and distribute via Firebase App Distribution + key: prototype_builds_fad_triggered + fields: + - select: "App to Build" + key: "app-to-build" + hint: "Which WooCommerce app should be built? 📱" + required: true + default: "WooCommerce" + options: + - label: "📱 WooCommerce Mobile" + value: "WooCommerce" + - label: "⌚️ WooCommerce Wear" + value: "WooCommerce-Wear" + - label: ":firebase: Prototype Build (FAD)" + depends_on: prototype_builds_fad_triggered + command: | + ".buildkite/commands/prototype-build-fad.sh" + plugins: [$CI_TOOLKIT] + artifact_paths: + - "WooCommerce/build/outputs/apk/**/*" + - "WooCommerce-Wear/build/outputs/apk/**/*" From 7d3ee6c734b8aae32944a3c551a516ca4e6f2723 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 26 Nov 2025 14:48:20 -0300 Subject: [PATCH 4/6] [TEST] Test in branch iangmaia/firebase-trunk-prototypes --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 181be29da7cd..fbfb6c1d76b4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -123,7 +123,7 @@ steps: # Optional Prototype Builds for trunk branch, distributed via Firebase App Distribution (FAD) ######################################## - group: "🚀 Prototype Build" - if: "build.branch == 'trunk'" + if: "build.branch == 'iangmaia/firebase-trunk-prototypes'" steps: - block: ":rocket: Build Prototype and distribute via Firebase" prompt: Select which app to build and distribute via Firebase App Distribution From 736298884bfdfdf4f5e855f8e2a2b07c030bebd3 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 26 Nov 2025 15:52:10 -0300 Subject: [PATCH 5/6] Revert "[TEST] Test in branch iangmaia/firebase-trunk-prototypes" This reverts commit 7d3ee6c734b8aae32944a3c551a516ca4e6f2723. --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index fbfb6c1d76b4..181be29da7cd 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -123,7 +123,7 @@ steps: # Optional Prototype Builds for trunk branch, distributed via Firebase App Distribution (FAD) ######################################## - group: "🚀 Prototype Build" - if: "build.branch == 'iangmaia/firebase-trunk-prototypes'" + if: "build.branch == 'trunk'" steps: - block: ":rocket: Build Prototype and distribute via Firebase" prompt: Select which app to build and distribute via Firebase App Distribution From 21144830a4b7e5c9a3e0ddc3588765265de440af Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 26 Nov 2025 16:35:29 -0300 Subject: [PATCH 6/6] Fix Rubocop violations --- fastlane/Fastfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ee0117df4d96..17fcfbef5481 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1178,8 +1178,8 @@ platform :android do # ProximaNova-Bold doesn't support non-Latin scripts, so we fall back to system fonts. def select_font_for_text(text_content, default_font) return 'Hiragino-Sans-W6' if text_content.match?(/[\p{Hiragana}\p{Katakana}]/) - return 'Apple-SD-Gothic-Neo-Bold' if text_content.match?(/[\p{Hangul}]/) - return 'Heiti-SC-Medium' if text_content.match?(/[\p{Han}]/) + return 'Apple-SD-Gothic-Neo-Bold' if text_content.match?(/\p{Hangul}/) + return 'Heiti-SC-Medium' if text_content.match?(/\p{Han}/) return 'Arial' if text_content.match?(/[\p{Arabic}\p{Hebrew}\p{Cyrillic}\p{Thai}]/) default_font