diff --git a/.buildkite/commands/installable-build.sh b/.buildkite/commands/prototype-build.sh similarity index 76% rename from .buildkite/commands/installable-build.sh rename to .buildkite/commands/prototype-build.sh index 44e5505c8044..bc8ec1348791 100755 --- a/.buildkite/commands/installable-build.sh +++ b/.buildkite/commands/prototype-build.sh @@ -7,4 +7,4 @@ echo "--- :closed_lock_with_key: Installing Secrets" bundle exec fastlane run configure_apply echo "--- :hammer_and_wrench: Building" -bundle exec fastlane "build_and_upload_$1_installable_build" +bundle exec fastlane "build_and_upload_$1_prototype_build" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c09519dc88f4..67388fb4884e 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -95,16 +95,16 @@ steps: - "**/build/instrumented-tests/**/*" ################# - # Create Installable Builds for WP and JP + # Create Prototype Builds for WP and JP ################# - - group: "📲 Installable Builds" + - group: "📲 Prototype Builds" steps: - - label: ":wordpress: :android: Installable Build" - command: ".buildkite/commands/installable-build.sh wordpress" + - label: ":wordpress: :android: Prototype Build" + command: ".buildkite/commands/prototype-build.sh wordpress" if: build.pull_request.id != null plugins: *common_plugins - - label: ":jetpack: :android: Installable Build" - command: ".buildkite/commands/installable-build.sh jetpack" + - label: ":jetpack: :android: Prototype Build" + command: ".buildkite/commands/prototype-build.sh jetpack" if: build.pull_request.id != null plugins: *common_plugins diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 54cda7eaecf5..eb928f48101e 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -71,7 +71,7 @@ android { applicationId "org.wordpress.android" archivesBaseName = "$applicationId" - versionName project.findProperty("installableBuildVersionName") ?: versionProperties.getProperty("versionName") + versionName project.findProperty("prototypeBuildVersionName") ?: versionProperties.getProperty("versionName") versionCode versionProperties.getProperty("versionCode").toInteger() minSdkVersion rootProject.minSdkVersion @@ -220,8 +220,7 @@ android { dimension "buildType" } - // Used for CI builds on PRs (aka "Installable Builds"). Can be used locally when a developer needs - // to install multiple versions of the app on the same device. + // Used for CI builds on PRs (aka "Prototype Builds"). Can be used locally when a developer needs to install multiple versions of the app on the same device. // AppName: WordPress Pre-Alpha/Jetpack Pre-Alpha jalapeno { isDefault true diff --git a/fastlane/Fastfile b/fastlane/Fastfile index dc48a3f9b29f..c887a763e4c4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -25,9 +25,9 @@ APP_SPECIFIC_VALUES = { UPLOAD_TO_PLAY_STORE_JSON_KEY = File.join(Dir.home, '.configure', 'wordpress-android', 'secrets', 'google-upload-credentials.json') -INSTALLABLE_BUILD_FLAVOR = 'Jalapeno'.freeze -INSTALLABLE_BUILD_TYPE = 'Debug'.freeze -INSTALLABLE_BUILD_DOMAIN = 'https://d2twmm2nzpx3bg.cloudfront.net' +PROTOTYPE_BUILD_FLAVOR = 'Jalapeno'.freeze +PROTOTYPE_BUILD_TYPE = 'Debug'.freeze +PROTOTYPE_BUILD_DOMAIN = 'https://d2twmm2nzpx3bg.cloudfront.net' PROJECT_ROOT_FOLDER = File.dirname(File.expand_path(__dir__)) FASTLANE_FOLDER = File.join(PROJECT_ROOT_FOLDER, 'fastlane') diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 55060a395160..1650452281a1 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -135,47 +135,49 @@ end ##################################################################################### - # build_and_upload_installable_build + # build_and_upload_wordpress_prototype_build # ----------------------------------------------------------------------------------- - # Build a WordPress Installable Build and make it available for download + # Build a WordPress Prototype Build and make it available for download # ----------------------------------------------------------------------------------- # Usage: - # bundle exec fastlane build_and_upload_installable_build + # bundle exec fastlane build_and_upload_wordpress_prototype_build ##################################################################################### - desc 'Build an Installable Build and make it available for download' - lane :build_and_upload_wordpress_installable_build do + desc 'Build a WordPress Prototype Build and make it available for download' + lane :build_and_upload_wordpress_prototype_build do UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET'] + versionName = generate_prototype_build_number gradle( task: 'assemble', - flavor: "WordPress#{INSTALLABLE_BUILD_FLAVOR}", - build_type: INSTALLABLE_BUILD_TYPE, - properties: { installableBuildVersionName: generate_installable_build_number } + flavor: "WordPress#{PROTOTYPE_BUILD_FLAVOR}", + build_type: PROTOTYPE_BUILD_TYPE, + properties: { prototypeBuildVersionName: versionName } ) - upload_installable_build(product: 'WordPress') + upload_prototype_build(product: 'WordPress', versionName: versionName) end ##################################################################################### - # build_and_upload_jetpack_installable_build + # build_and_upload_jetpack_prototype_build # ----------------------------------------------------------------------------------- - # Build a Jetpack Installable Build and make it available for download + # Build a Jetpack Prototype Build and make it available for download # ----------------------------------------------------------------------------------- # Usage: - # bundle exec fastlane build_and_upload_installable_build + # bundle exec fastlane build_and_upload_jetpack_prototype_build ##################################################################################### - desc 'Build an Installable Build and make it available for download' - lane :build_and_upload_jetpack_installable_build do + desc 'Build a Jetpack Prototype Build and make it available for download' + lane :build_and_upload_jetpack_prototype_build do UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET'] + versionName = generate_prototype_build_number gradle( task: 'assemble', - flavor: "Jetpack#{INSTALLABLE_BUILD_FLAVOR}", - build_type: INSTALLABLE_BUILD_TYPE, - properties: { installableBuildVersionName: generate_installable_build_number } + flavor: "Jetpack#{PROTOTYPE_BUILD_FLAVOR}", + build_type: PROTOTYPE_BUILD_TYPE, + properties: { prototypeBuildVersionName: versionName } ) - upload_installable_build(product: 'Jetpack') + upload_prototype_build(product: 'Jetpack', versionName: versionName) end ##################################################################################### @@ -246,8 +248,8 @@ # # @param [String] product the display name of the app to upload to S3. 'WordPress' or 'Jetpack' # - def upload_installable_build(product:) - filename = "#{product.downcase}-installable-build-#{generate_installable_build_number}.apk" + def upload_prototype_build(product:, versionName:) + filename = "#{product.downcase}-prototype-build-#{versionName}.apk" upload_path = upload_to_s3( bucket: 'a8c-apps-public-artifacts', @@ -258,40 +260,32 @@ def upload_installable_build(product:) return if ENV['BUILDKITE_PULL_REQUEST'].nil? - install_url = "#{INSTALLABLE_BUILD_DOMAIN}/#{upload_path}" - qr_code_url = "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=#{CGI.escape(install_url)}&choe=UTF-8" - icon = "" - comment_body = <<~PR_COMMENT - - #{icon}📲 You can test these changes on #{product} by downloading #{filename} - - - 💡 Scan this QR code with your Android phone to download and install the APK directly on it. - - App#{product} - Build Flavor#{INSTALLABLE_BUILD_FLAVOR} - Build Type#{INSTALLABLE_BUILD_TYPE} - Commit#{ENV['BUILDKITE_COMMIT']} - - - Note: This installable build uses the #{INSTALLABLE_BUILD_FLAVOR}#{INSTALLABLE_BUILD_TYPE} build flavor, and does not support Google Login. - PR_COMMENT + install_url = "#{PROTOTYPE_BUILD_DOMAIN}/#{upload_path}" + comment_body = prototype_build_details_comment( + app_display_name: product, + app_icon: ":#{product.downcase}:", # Use Buildkite emoji based on product name + download_url: install_url, + metadata: { Flavor: PROTOTYPE_BUILD_FLAVOR, 'Build Type': PROTOTYPE_BUILD_TYPE, 'Version': versionName }, + footnote: 'Note: Google Login is not supported on these builds.', + fold: true + ) comment_on_pr( project: GHHELPER_REPO, pr_number: Integer(ENV['BUILDKITE_PULL_REQUEST']), - reuse_identifier: "#{product.downcase}-installable-build-link", + reuse_identifier: "#{product.downcase}-prototype-build-link", body: comment_body ) if ENV['BUILDKITE'] - message = "#{product} Installable Build: [#{filename}](#{install_url})" - sh('buildkite-agent', 'annotate', message, '--style', 'info', '--context', "installable-build-#{product}") + message = "#{product} Prototype Build: [#{filename}](#{install_url})" + buildkite_annotate(style: 'info', context: "prototype-build-#{product}", message: message) + buildkite_metadata(set: { versionName: versionName, 'build:flavor': PROTOTYPE_BUILD_FLAVOR, 'build:type': PROTOTYPE_BUILD_TYPE }) end end # This function is Buildkite-specific - def generate_installable_build_number + def generate_prototype_build_number if ENV['BUILDKITE'] commit = ENV['BUILDKITE_COMMIT'][0, 7] branch = ENV['BUILDKITE_BRANCH'].parameterize