From 91976670eb31c01f0e988cac3c14d6f712fbdd50 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Tue, 17 May 2022 21:28:40 +0200 Subject: [PATCH 1/5] Point release-toolkit to app-size-metrics branch --- Gemfile.lock | 11 ++++++----- fastlane/Pluginfile | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 330d54f85184..5e56dc730dfd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT - remote: git@github.com:wordpress-mobile/release-toolkit.git - revision: ee92ff145fa4c2d1782d2b60cacbba97f2c94b54 - branch: trunk + remote: git@github.com:wordpress-mobile/release-toolkit + revision: 49e0c21b5cf51ed523d10bc69070df079d8aea7c + branch: app-size-metrics specs: fastlane-plugin-wpmreleasetoolkit (4.1.0) activesupport (~> 5) @@ -14,6 +14,7 @@ GIT nokogiri (~> 1.11) octokit (~> 4.18) parallel (~> 1.14) + plist (~> 3.1) progress_bar (~> 1.3) rake (>= 12.3, < 14.0) rake-compiler (~> 1.0) @@ -23,7 +24,7 @@ GEM specs: CFPropertyList (3.0.5) rexml - activesupport (5.2.7.1) + activesupport (5.2.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -198,7 +199,7 @@ GEM multipart-post (2.0.0) nanaimo (0.3.0) naturally (2.2.1) - nokogiri (1.13.4) + nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) octokit (4.22.0) diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 840321aebade..048f1e20e393 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -6,5 +6,6 @@ group :screenshots, optional: true do gem 'rmagick', '~> 4.1' end -gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit.git', branch: 'trunk' +# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit.git', branch: 'trunk' +gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'app-size-metrics' # gem 'fastlane-plugin-wpmreleasetoolkit', '~> 4.1' From d481d01713ac80262fbbe9ac7c4937f392de1c66 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Tue, 17 May 2022 21:36:52 +0200 Subject: [PATCH 2/5] Call android_send_app_metrics action --- fastlane/lanes/build.rb | 56 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index a8f8a58873aa..acc41d2242d8 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -26,11 +26,23 @@ # Create the file names app = get_app_name_option!(options) version = android_get_release_version() - build_bundle(app: app, version: version, flavor: 'Vanilla', buildType: 'Release') + aab_path = build_bundle(app: app, version: version, flavor: 'Vanilla', buildType: 'Release') upload_build_to_play_store(app: app, version: version, track: 'production') create_gh_release(app: app, version: version) if options[:create_release] + + android_send_app_size_metrics( + api_url: ENV['APPMETRICS_BASE_URL'] = File.join('file://localhost/', ENV['PROJECT_ROOT_FOLDER'], 'build', "#{app}-app-size-metrics.json"), + use_gzip_content_encoding: false, + app_name: 'WordPress', + app_version_name: version['name'], + app_version_code: version['code'], + product_flavor: 'Vanilla', + build_type: 'Release', + source: 'Final Build', + aab_path: aab_path + ) end ##################################################################################### @@ -81,11 +93,23 @@ # Create the file names app = get_app_name_option!(options) version = android_get_alpha_version() - build_bundle(app: app, version: version, flavor: 'Zalpha', buildType: 'Release') + aab_path = build_bundle(app: app, version: version, flavor: 'Zalpha', buildType: 'Release') upload_build_to_play_store(app: app, version: version, track: 'alpha') if options[:upload_to_play_store] create_gh_release(app: app, version: version, prerelease: true) if options[:create_release] + + android_send_app_size_metrics( + api_url: ENV['APPMETRICS_BASE_URL'] = File.join('file://localhost/', ENV['PROJECT_ROOT_FOLDER'], 'build', "#{app}-app-size-metrics.json"), + use_gzip_content_encoding: false, + app_name: 'WordPress', + app_version_name: version['name'], + app_version_code: version['code'], + product_flavor: 'Zalpha', + build_type: 'Release', + source: 'Alpha', + aab_path: aab_path + ) end ##################################################################################### @@ -109,11 +133,23 @@ # Create the file names app = get_app_name_option!(options) version = android_get_release_version() - build_bundle(app: app, version: version, flavor: 'Vanilla', buildType: 'Release') + aab_path = build_bundle(app: app, version: version, flavor: 'Vanilla', buildType: 'Release') upload_build_to_play_store(app: app, version: version, track: 'beta') if options[:upload_to_play_store] create_gh_release(app: app, version: version, prerelease: true) if options[:create_release] + + android_send_app_size_metrics( + api_url: ENV['APPMETRICS_BASE_URL'] = File.join('file://localhost/', ENV['PROJECT_ROOT_FOLDER'], 'build', "#{app}-app-size-metrics.json"), + use_gzip_content_encoding: false, + app_name: 'WordPress', + app_version_name: version['name'], + app_version_code: version['code'], + product_flavor: 'Vanilla', + build_type: 'Release', + source: 'Beta', + aab_path: aab_path + ) end ##################################################################################### @@ -137,11 +173,23 @@ # Create the file names app = get_app_name_option!(options) version = android_get_release_version() - build_bundle(app: app, version: version, flavor: 'Zalpha', buildType: 'Debug') + aab_path = build_bundle(app: app, version: version, flavor: 'Zalpha', buildType: 'Debug') upload_build_to_play_store(app: app, version: version, track: 'internal') if options[:upload_to_play_store] create_gh_release(app: app, version: version, prerelease: true) if options[:create_release] + + android_send_app_size_metrics( + api_url: ENV['APPMETRICS_BASE_URL'] = File.join('file://localhost/', ENV['PROJECT_ROOT_FOLDER'], 'build', "#{app}-app-size-metrics.json"), + use_gzip_content_encoding: false, + app_name: 'WordPress', + app_version_name: version['name'], + app_version_code: version['code'], + product_flavor: 'Zalpha', + build_type: 'Debug', + source: 'Internal', + aab_path: aab_path + ) end ##################################################################################### From 4bd0258802ddf5299dfa93f2af242baa3b20e1ce Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Thu, 19 May 2022 20:26:54 +0200 Subject: [PATCH 3/5] Point release-toolkit to `app-size-metrics+android-universal-apk` branch --- Gemfile.lock | 4 ++-- fastlane/Pluginfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5e56dc730dfd..cc7edb17007e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: git@github.com:wordpress-mobile/release-toolkit - revision: 49e0c21b5cf51ed523d10bc69070df079d8aea7c - branch: app-size-metrics + revision: f1d098a1bdd9edb117c230c934f3d8fa715b1cba + branch: app-size-metrics+android-universal-apk specs: fastlane-plugin-wpmreleasetoolkit (4.1.0) activesupport (~> 5) diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 048f1e20e393..64da271d0ee1 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -7,5 +7,5 @@ group :screenshots, optional: true do end # gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit.git', branch: 'trunk' -gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'app-size-metrics' +gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'app-size-metrics+android-universal-apk' # gem 'fastlane-plugin-wpmreleasetoolkit', '~> 4.1' From 2b5414319c1329249487513b7d04a3560c11a8f5 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Thu, 19 May 2022 20:41:50 +0200 Subject: [PATCH 4/5] Make CI send metrics for Installable Builds too Which implies Jalapeno Debug Universal APK (and no AAB) --- .circleci/config.yml | 5 +++++ fastlane/lanes/build.rb | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c378978d4507..31b9bebe553c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,11 @@ jobs: mkdir -p Artifacts mv WordPress/build/outputs/apk/wordpressJalapeno/debug/org.wordpress.android-wordpress-jalapeno-debug.apk "Artifacts/WordPress-${VERSION_NAME}.apk" mv WordPress/build/outputs/apk/jetpackJalapeno/debug/org.wordpress.android-jetpack-jalapeno-debug.apk "Artifacts/Jetpack-${VERSION_NAME}.apk" + - run: + name: Send App Size Metrics + command: | + bundle exec fastlane send_installable_build_app_metrics apk:"Artifacts/WordPress-${VERSION_NAME}.apk" app_name:WordPress version_name:"${VERSION_NAME}" + bundle exec fastlane send_installable_build_app_metrics apk:"Artifacts/Jetpack-${VERSION_NAME}.apk" app_name:Jetpack version_name:"${VERSION_NAME}" - store_artifacts: path: Artifacts destination: Artifacts diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index acc41d2242d8..2e1e8af5b742 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -310,4 +310,25 @@ end "#{build_dir}#{name}" end + + # Send Universal APK app size metrics for Installable Builds + # @called_by CI + # + # @option [String,Symbol] apk The path to the Universal APK to send metrics for + # @option [String] app_name The display name of the app to send metrics for. "WordPress" or "Jetpack" + # @option [String] version_name The `versionName` of the APK + # + lane :send_installable_build_app_metrics do |options| + basename = File.basename(options[:apk], '.apk') + android_send_app_size_metrics( + api_url: ENV['APPMETRICS_BASE_URL'] = File.join('file://localhost/', ENV['PROJECT_ROOT_FOLDER'], 'Artifacts', "#{basename}-app-size-metrics.json"), + use_gzip_content_encoding: false, + app_name: options[:app_name], + app_version_name: options[:version_name], + product_flavor: 'Jalapeno', + build_type: 'Debug', + source: 'Installable Build', + universal_apk_path: options[:apk] + ) + end end From 7b77a6af5a3e32c13fb713cc1b2bf5f83225c8d2 Mon Sep 17 00:00:00 2001 From: Olivier Halligon Date: Tue, 24 May 2022 20:37:38 +0200 Subject: [PATCH 5/5] Bump release-toolkit to get fix for apkanalyzer path --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cc7edb17007e..506798492b98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git@github.com:wordpress-mobile/release-toolkit - revision: f1d098a1bdd9edb117c230c934f3d8fa715b1cba + revision: f4d314a91342e6497ccc8f43a47878d5c6f2f061 branch: app-size-metrics+android-universal-apk specs: fastlane-plugin-wpmreleasetoolkit (4.1.0) @@ -205,7 +205,7 @@ GEM octokit (4.22.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) - oj (3.13.11) + oj (3.13.13) optimist (3.0.1) options (2.3.2) optparse (0.1.1)