From 52211d5bc3bb347a7e6ca03d3d58529fdbd4fce8 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Fri, 7 Feb 2025 19:27:50 +0100 Subject: [PATCH] Move call to `pr_changed_files` to a separate file --- .buildkite/commands/run-ui-tests.sh | 4 ++++ .buildkite/commands/should-skip-ui-tests.sh | 4 ++++ .buildkite/pipeline.yml | 8 ++------ .buildkite/shared-pipeline-vars | 6 ------ 4 files changed, 10 insertions(+), 12 deletions(-) create mode 100755 .buildkite/commands/should-skip-ui-tests.sh diff --git a/.buildkite/commands/run-ui-tests.sh b/.buildkite/commands/run-ui-tests.sh index 6e46300596d..7e9cad0f02d 100755 --- a/.buildkite/commands/run-ui-tests.sh +++ b/.buildkite/commands/run-ui-tests.sh @@ -1,5 +1,9 @@ #!/bin/bash -eu +if .buildkite/commands/should-skip-ui-tests.sh > /dev/null 2>&1; then + exit 0 +fi + TEST_NAME=$1 DEVICE=$2 diff --git a/.buildkite/commands/should-skip-ui-tests.sh b/.buildkite/commands/should-skip-ui-tests.sh new file mode 100755 index 00000000000..1b4ac2391ba --- /dev/null +++ b/.buildkite/commands/should-skip-ui-tests.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Check if changes are limited to documentation, tooling and non-code files +pr_changed_files --all-match "*.md" "docs/**" "*.txt" "*.pot" "fastlane/**" ".github/**" ".buildkite/**" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index d0f74bc44ac..3bab13e4667 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -93,9 +93,7 @@ steps: ################# - label: ":microscope: UI Tests (iPhone)" command: .buildkite/commands/run-ui-tests.sh UITests 'iPhone 16' - # 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\// || build.branch =~ /^iangmaia\//) && $SKIP_UI_TESTS != 'true' + if: build.branch == 'trunk' || build.branch =~ /^release\// || build.branch =~ /^iangmaia\// plugins: [$CI_TOOLKIT] artifact_paths: - fastlane/test_output/* @@ -105,9 +103,7 @@ steps: - label: ":microscope: UI Tests (iPad)" command: .buildkite/commands/run-ui-tests.sh UITests "iPad (10th generation)" - # 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\// || build.branch =~ /^iangmaia\//) && $SKIP_UI_TESTS != 'true' + if: build.branch == 'trunk' || build.branch =~ /^release\// || build.branch =~ /^iangmaia\// plugins: [$CI_TOOLKIT] artifact_paths: - fastlane/test_output/* diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars index 41fc613056b..be34828d27d 100644 --- a/.buildkite/shared-pipeline-vars +++ b/.buildkite/shared-pipeline-vars @@ -9,9 +9,3 @@ 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" - -# Install/update the plugin first so we can use pr_changed_files -buildkite-agent plugin install $CI_TOOLKIT - -# 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/**")