From 07ceabd4e250ee2a7312319fd1719b5c82e805df Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 4 Dec 2025 13:36:19 +1100 Subject: [PATCH 1/6] Add Buildkite step to optionally trigger FAD build on `trunk` --- .buildkite/pipeline.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index a3e9f2d9153..e49d86eadf4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -31,6 +31,20 @@ steps: - github_commit_status: context: Prototype Build + - group: ":rocket: Prototype Build" + if: build.branch == trunk + steps: + - input: Deploy Prototype Build + prompt: Share a Prototype Build via Firebase App Distribution? + key: prototype_triggered + - label: Prototype Build + depends: prototype_triggered + command: .buildkite/commands/prototype-build.sh + plugins: [$CI_TOOLKIT] + notify: + - github_commit_status: + context: Prototype Build From Trunk + ################# # Run Unit Tests ################# From 10c2f4ac096af3550f5a44e10ec0f1189087b0ef Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 4 Dec 2025 13:39:31 +1100 Subject: [PATCH 2/6] Delete steps unrelated with FAD on trunk testing --- .buildkite/pipeline.yml | 116 ---------------------------------------- 1 file changed, 116 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index e49d86eadf4..1e8d9ec7196 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -9,28 +9,6 @@ env: # This is the default pipeline โ€“ it will build and test the app steps: - ################# - # Build the app - ################# - - label: ":pipeline: Build" - key: build - command: .buildkite/commands/build-for-testing.sh - plugins: [$CI_TOOLKIT] - notify: - - github_commit_status: - context: Build - - ################# - # Create Prototype Build - ################# - - label: ":hammer_and_wrench: Prototype Build" - command: .buildkite/commands/prototype-build.sh - plugins: [$CI_TOOLKIT] - if: build.pull_request.id != null - notify: - - github_commit_status: - context: Prototype Build - - group: ":rocket: Prototype Build" if: build.branch == trunk steps: @@ -44,97 +22,3 @@ steps: notify: - github_commit_status: context: Prototype Build From Trunk - - ################# - # Run Unit Tests - ################# - - label: ":microscope: Unit Tests" - command: .buildkite/commands/run-unit-tests.sh - depends_on: build - plugins: [$CI_TOOLKIT] - artifact_paths: - - fastlane/test_output/* - notify: - - github_commit_status: - context: Unit Tests - - - label: ":microscope: Standalone WordPressAuthenticator Unit Tests" - command: .buildkite/commands/run-wordpress-authenticator-tests.sh - plugins: [$CI_TOOLKIT] - artifact_paths: - - fastlane/test_output/* - notify: - - github_commit_status: - context: WordPressAuthenticator Unit Tests - - ################# - # Linters - ################# - - group: Linters - steps: - - label: ":radioactive_sign: Danger - PR Check" - command: danger - key: danger - if: build.pull_request.id != null - retry: - manual: - permit_on_passed: true - agents: - queue: linter - notify: - - github_commit_status: - context: Danger - PR Check - - - label: ":swift: SwiftLint" - command: swiftlint - notify: - - github_commit_status: - context: SwiftLint - agents: - queue: linter - - - - label: ๐Ÿงน Lint Translations - command: gplint /workdir/WooCommerce/Resources/AppStoreStrings.pot - plugins: - - docker#v3.8.0: - image: public.ecr.aws/automattic/glotpress-validator:1.0.0 - agents: - queue: default - notify: - - github_commit_status: - context: Lint Translations - - - label: ":sleuth_or_spy: Lint Localized Strings Format" - command: .buildkite/commands/lint-localized-strings-format.sh - plugins: [$CI_TOOLKIT] - notify: - - github_commit_status: - context: Lint Localized Strings Format - - ################# - # UI Tests - ################# - - label: ":microscope: UI Tests (iPhone)" - command: .buildkite/commands/run-ui-tests.sh UITests "iPhone 16" - depends_on: build - # Only run on `trunk` and `release/*` -- See p91TBi-cBM-p2#comment-13736 - if: build.branch == "trunk" || build.branch =~ /^release\// - plugins: [$CI_TOOLKIT] - artifact_paths: - - fastlane/test_output/* - notify: - - github_commit_status: - context: UI Tests (iPhone) - - - label: ":microscope: UI Tests (iPad)" - command: .buildkite/commands/run-ui-tests.sh UITests "iPad Pro 13-inch (M4)" - depends_on: build - # Only run on `trunk` and `release/*` -- See p91TBi-cBM-p2#comment-13736 - if: build.branch == "trunk" || build.branch =~ /^release\// - plugins: [$CI_TOOLKIT] - artifact_paths: - - fastlane/test_output/* - notify: - - github_commit_status: - context: UI Tests (iPad) From bcc015064b5f40beffac741dcb3ec28eb7fbb93c Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 4 Dec 2025 13:40:11 +1100 Subject: [PATCH 3/6] Change branch name to test on this branch --- .buildkite/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 1e8d9ec7196..52ce545212c 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -10,13 +10,13 @@ env: # This is the default pipeline โ€“ it will build and test the app steps: - group: ":rocket: Prototype Build" - if: build.branch == trunk + if: build.branch == "test-fad-on-trunk" steps: - input: Deploy Prototype Build prompt: Share a Prototype Build via Firebase App Distribution? key: prototype_triggered - label: Prototype Build - depends: prototype_triggered + depends_on: prototype_triggered command: .buildkite/commands/prototype-build.sh plugins: [$CI_TOOLKIT] notify: From c6ef381584cdd944df1b8e8986ca4f14e6fa6bb6 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 4 Dec 2025 13:47:11 +1100 Subject: [PATCH 4/6] Fix branch name --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 52ce545212c..0042b3ff45f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -10,7 +10,7 @@ env: # This is the default pipeline โ€“ it will build and test the app steps: - group: ":rocket: Prototype Build" - if: build.branch == "test-fad-on-trunk" + if: build.branch == "test-fad-from-trunk" steps: - input: Deploy Prototype Build prompt: Share a Prototype Build via Firebase App Distribution? From 7b2bbf666dbacc40cd7c3feb06e35d9e18befd29 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 4 Dec 2025 13:53:41 +1100 Subject: [PATCH 5/6] Only add PR number to release notes if one is available --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b681784c356..fa7324b793c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -777,10 +777,10 @@ platform :ios do build_for_prototype_build release_notes = <<~NOTES - Pull Request: ##{pull_request_number || 'N/A'} Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}` Commit: #{ENV.fetch('BUILDKITE_COMMIT', 'N/A')[0...7]} NOTES + release_notes += "Pull Request: ##{pull_request_number}" unless pull_request_number.nil? firebase_app_distribution( app: FIREBASE_APP_ID, From b22721e670f95d314a899286d66e6196c98be60b Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 4 Dec 2025 13:57:53 +1100 Subject: [PATCH 6/6] Refactor `pull_request_number` method into a constant No need to read every time --- fastlane/Fastfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index fa7324b793c..c09d3ccb3cd 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -780,7 +780,7 @@ platform :ios do Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}` Commit: #{ENV.fetch('BUILDKITE_COMMIT', 'N/A')[0...7]} NOTES - release_notes += "Pull Request: ##{pull_request_number}" unless pull_request_number.nil? + release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil? firebase_app_distribution( app: FIREBASE_APP_ID, @@ -796,13 +796,13 @@ platform :ios do dsym_path: './build/WooCommerce.app.dSYM.zip' ) - next if pull_request_number.nil? + next if PULL_REQUEST_NUMBER.nil? # PR Comment comment_body = prototype_build_details_comment(app_display_name: 'WooCommerce iOS Prototype') comment_on_pr( project: GITHUB_REPO, - pr_number: pull_request_number, + pr_number: PULL_REQUEST_NUMBER, reuse_identifier: 'prototype-build-link', body: comment_body ) @@ -812,7 +812,7 @@ platform :ios do lane :build_for_prototype_build do |fetch_code_signing: true| update_certs_and_profiles_enterprise if fetch_code_signing - pr_prefix = pull_request_number&.then { |num| "pr#{num}" } + pr_prefix = PULL_REQUEST_NUMBER&.then { |num| "pr#{num}" } commit_short_hash = ENV.fetch('BUILDKITE_COMMIT', '0')[0...7] build_number = [pr_prefix, commit_short_hash].compact.join('-') @@ -1526,11 +1526,8 @@ TEST_ANALYTICS_ENVIRONMENT = %w[ # Release Management Utils # ----------------------------------------------------------------------------------- -def pull_request_number - # Buildkite sets this env var to the PR number if on a PR, but to 'false' (and not nil) if not on a PR - pr_num = ENV.fetch('BUILDKITE_PULL_REQUEST', 'false') - pr_num == 'false' ? nil : Integer(pr_num) -end +# Buildkite sets this env var to the PR number if on a PR, but to 'false' (and not nil) if not on a PR +PULL_REQUEST_NUMBER = ENV['BUILDKITE_PULL_REQUEST']&.then { |n| n == 'false' ? nil : Integer(n) } def create_backmerge_pr version = release_version_current