From 22b2014de7ad7531c1ac9061c9c192f3b1894e9f Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 6 Feb 2025 18:03:34 +0100 Subject: [PATCH] Skip running UI tests if there are no relevant changes --- .buildkite/pipeline.yml | 10 ++++++---- .buildkite/shared-pipeline-vars | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 835efcdd631..c99446b3fd5 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -94,8 +94,9 @@ steps: - 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\// + # Only run on `trunk` and `release/*` (see p91TBi-cBM-p2#comment-13736) and when code changes are detected + if: | + (build.branch == 'trunk' || build.branch =~ /^release\//) && $SKIP_UI_TESTS != 'true' plugins: [$CI_TOOLKIT] artifact_paths: - fastlane/test_output/* @@ -106,8 +107,9 @@ steps: - label: ":microscope: UI Tests (iPad)" command: .buildkite/commands/run-ui-tests.sh UITests "iPad (10th generation)" depends_on: build - # Only run on `trunk` and `release/*` -- See p91TBi-cBM-p2#comment-13736 - if: build.branch == 'trunk' || build.branch =~ /^release\// + # Only run on `trunk` and `release/*` (see p91TBi-cBM-p2#comment-13736) and when code changes are detected + if: | + (build.branch == 'trunk' || build.branch =~ /^release\//) && $SKIP_UI_TESTS != 'true' plugins: [$CI_TOOLKIT] artifact_paths: - fastlane/test_output/* diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars index 2a7cb971dda..4eedf93176d 100644 --- a/.buildkite/shared-pipeline-vars +++ b/.buildkite/shared-pipeline-vars @@ -4,8 +4,11 @@ # to set up some variables that will be interpolated in the `.yml` pipeline before uploading it. XCODE_VERSION=$(sed 's/^~> *//' .xcode-version) -CI_TOOLKIT_PLUGIN_VERSION="3.9.1" +CI_TOOLKIT_PLUGIN_VERSION="iangmaia/pr-changed-files" # Note: `-v4` suffix was added to use xcode-16.1-v4 image; remember to remove that suffix during the next Xcode update export IMAGE_ID="xcode-$XCODE_VERSION-v4" export CI_TOOLKIT="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION" + +# Skip UI tests if changes are limited to docs, assets, or other non-code files +export SKIP_UI_TESTS=$(pr_changed_files --all-match "*.md" "docs/**" "*.txt" "*.pot" "*.strings" "fastlane/**" ".github/**" ".buildkite/**")