Skip to content

Commit

Permalink
Move call to pr_changed_files to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
iangmaia committed Feb 7, 2025
1 parent bcc39c1 commit 52211d5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .buildkite/commands/run-ui-tests.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions .buildkite/commands/should-skip-ui-tests.sh
Original file line number Diff line number Diff line change
@@ -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/**"
8 changes: 2 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand All @@ -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/*
Expand Down
6 changes: 0 additions & 6 deletions .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
Expand Up @@ -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/**")

0 comments on commit 52211d5

Please sign in to comment.