Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .buildkite/commands/prototype-build-fad.sh
Original file line number Diff line number Diff line change
@@ -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}"

29 changes: 29 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''

Expand Down
59 changes: 33 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -293,24 +299,24 @@ 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)
parallel (~> 1.10)
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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
54 changes: 51 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
########################################################################
Expand Down Expand Up @@ -1167,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
Expand Down Expand Up @@ -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,
Expand All @@ -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
#####################################################################################
Expand Down