Skip to content

Commit 74c29ef

Browse files
authored
Merge branch 'release/22.4' into merge/release-22.3.1-into-release-22.4
2 parents 7726597 + 40bbdba commit 74c29ef

File tree

237 files changed

+6383
-1739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+6383
-1739
lines changed

.buildkite/commands/build-for-testing.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash -eu
22

3+
if .buildkite/commands/should-skip-job.sh --job-type build; then
4+
exit 0
5+
fi
6+
37
echo "--- :rubygems: Setting up Gems"
48
install_gems
59

.buildkite/commands/lint-localized-strings-format.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash -eu
22

3+
if .buildkite/commands/should-skip-job.sh --job-type localization; then
4+
exit 0
5+
fi
6+
37
echo "--- :writing_hand: Copy Files"
48
SECRETS_DIR=~/.configure/woocommerce-ios/secrets
59
mkdir -pv $SECRETS_DIR

.buildkite/commands/prototype-build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash -eu
22

3+
if .buildkite/commands/should-skip-job.sh --job-type build; then
4+
exit 0
5+
fi
6+
37
echo "--- :rubygems: Setting up Gems"
48
install_gems
59

.buildkite/commands/run-ui-tests.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash -eu
22

3-
if .buildkite/commands/should-skip-tests.sh; then
4-
message="Skipping UI Tests as only documentation, tooling and/or non-code files were changed"
5-
echo "$message" | buildkite-agent annotate --style "info" --context "skip-ui-tests"
6-
echo "$message"
3+
if .buildkite/commands/should-skip-job.sh --job-type validation; then
74
exit 0
85
fi
96

.buildkite/commands/run-unit-tests.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash -eu
22

3-
if .buildkite/commands/should-skip-tests.sh; then
4-
message="Skipping Unit Tests as only documentation, tooling and/or non-code files were changed"
5-
echo "$message" | buildkite-agent annotate --style "info" --context "skip-unit-tests"
6-
echo "$message"
3+
if .buildkite/commands/should-skip-job.sh --job-type validation; then
74
exit 0
85
fi
96

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
if .buildkite/commands/should-skip-job.sh --job-type validation; then
4+
exit 0
5+
fi
6+
7+
echo "--- :rubygems: Setting up Gems"
8+
install_gems
9+
10+
echo "--- :cocoapods: Setting up Pods"
11+
install_cocoapods
12+
13+
echo "--- :swift: Setting up Swift Packages"
14+
install_swiftpm_dependencies
15+
16+
echo "--- 🧪 Testing"
17+
bundle exec fastlane run scan \
18+
scheme:WordPressAuthenticator \
19+
prelaunch_simulator:true \
20+
device:'iPhone 16'
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash -eu
2+
3+
# Usage: should-skip-job.sh --job-type [validation|build|localization]
4+
# --job-type validation: For jobs like unit/UI tests, authenticator tests...
5+
# Skip when changes are limited to documentation, tooling, non-code files, and localization files
6+
# --job-type localization: For jobs that check localization files
7+
# Check if any localization files have changed
8+
# Return true (skip) if NO localization files have changed
9+
# --job-type build: For jobs building app binaries, e.g. Build, Prototype Builds...
10+
# Skip when changes are limited to documentation, tooling, and non-code files
11+
# Does not skip if localization files changed
12+
#
13+
# Return codes:
14+
# 0 - Job should be skipped (script also handles displaying the message and annotation)
15+
# 1 - Job should not be skipped
16+
# 15 - Error in script parameters
17+
18+
COMMON_PATTERNS=(
19+
"*.md"
20+
"*.pot"
21+
"*.txt"
22+
".gitignore"
23+
"config/Version.Public.xcconfig"
24+
"docs/**"
25+
"fastlane/**"
26+
"Gemfile"
27+
"Gemfile.lock"
28+
)
29+
30+
LOCALIZATION_PATTERNS=(
31+
"**/*.strings"
32+
"**/*.stringsdict"
33+
)
34+
35+
# Check if arguments are valid
36+
if [ -z "${1:-}" ] || [ "$1" != "--job-type" ] || [ -z "${2:-}" ]; then
37+
echo "Error: Must specify --job-type [validation|build|localization]"
38+
buildkite-agent step cancel
39+
exit 15
40+
fi
41+
42+
# Function to display skip message and create annotation
43+
show_skip_message() {
44+
local job_type=$1
45+
local message="Skipping ${BUILDKITE_LABEL:-Job} - no relevant files changed"
46+
local context="skip-$(echo "${BUILDKITE_LABEL:-$job_type}" | sed -E -e 's/[^[:alnum:]]+/-/g' | tr A-Z a-z)"
47+
48+
echo "$message" | buildkite-agent annotate --style "info" --context "$context"
49+
echo "$message"
50+
}
51+
52+
job_type="$2"
53+
case "$job_type" in
54+
"validation")
55+
# We should skip if changes are limited to documentation, tooling, non-code files, and localization files
56+
PATTERNS=("${COMMON_PATTERNS[@]}" "${LOCALIZATION_PATTERNS[@]}")
57+
if pr_changed_files --all-match "${PATTERNS[@]}"; then
58+
show_skip_message "$job_type"
59+
exit 0
60+
fi
61+
exit 1
62+
;;
63+
"localization")
64+
# Check if any localization files have changed
65+
# Return true (skip) if NO localization files have changed
66+
if ! pr_changed_files --any-match "${LOCALIZATION_PATTERNS[@]}"; then
67+
show_skip_message "$job_type"
68+
exit 0
69+
fi
70+
exit 1
71+
;;
72+
"build")
73+
# We should skip if changes are limited to documentation, tooling, and non-code files
74+
# We'll let the job run (won't skip) if PR includes changes in localization files though
75+
PATTERNS=("${COMMON_PATTERNS[@]}")
76+
if pr_changed_files --all-match "${PATTERNS[@]}"; then
77+
show_skip_message "$job_type"
78+
exit 0
79+
fi
80+
exit 1
81+
;;
82+
*)
83+
echo "Error: Job type must be either 'validation', 'build', or 'localization'"
84+
buildkite-agent step cancel
85+
exit 15
86+
;;
87+
esac

.buildkite/commands/should-skip-tests.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.buildkite/pipeline.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,7 @@ steps:
4545
context: Unit Tests
4646

4747
- label: ":microscope: Standalone WordPressAuthenticator Unit Tests"
48-
command: |
49-
echo "--- :rubygems: Setting up Gems"
50-
install_gems
51-
52-
echo "--- :cocoapods: Setting up Pods"
53-
install_cocoapods
54-
55-
echo "--- :swift: Setting up Swift Packages"
56-
install_swiftpm_dependencies
57-
58-
echo "--- 🧪 Testing"
59-
bundle exec fastlane run scan \
60-
scheme:WordPressAuthenticator \
61-
prelaunch_simulator:true \
62-
device:'iPhone 16'
48+
command: .buildkite/commands/run-wordpress-authenticator-tests.sh
6349
plugins: [$CI_TOOLKIT]
6450
artifact_paths:
6551
- fastlane/test_output/*
@@ -115,10 +101,10 @@ steps:
115101
# UI Tests
116102
#################
117103
- label: ":microscope: UI Tests (iPhone)"
118-
command: .buildkite/commands/run-ui-tests.sh UITests 'iPhone 16'
104+
command: .buildkite/commands/run-ui-tests.sh UITests "iPhone 16"
119105
depends_on: build
120106
# Only run on `trunk` and `release/*` -- See p91TBi-cBM-p2#comment-13736
121-
if: build.branch == 'trunk' || build.branch =~ /^release\//
107+
if: build.branch == "trunk" || build.branch =~ /^release\//
122108
plugins: [$CI_TOOLKIT]
123109
artifact_paths:
124110
- fastlane/test_output/*
@@ -127,10 +113,10 @@ steps:
127113
context: UI Tests (iPhone)
128114

129115
- label: ":microscope: UI Tests (iPad)"
130-
command: .buildkite/commands/run-ui-tests.sh UITests "iPad (10th generation)"
116+
command: .buildkite/commands/run-ui-tests.sh UITests "iPad Pro 13-inch (M4)"
131117
depends_on: build
132118
# Only run on `trunk` and `release/*` -- See p91TBi-cBM-p2#comment-13736
133-
if: build.branch == 'trunk' || build.branch =~ /^release\//
119+
if: build.branch == "trunk" || build.branch =~ /^release\//
134120
plugins: [$CI_TOOLKIT]
135121
artifact_paths:
136122
- fastlane/test_output/*

.buildkite/shared-pipeline-vars

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.
55

66
XCODE_VERSION=$(sed 's/^~> *//' .xcode-version)
7-
CI_TOOLKIT_PLUGIN_VERSION="4.0.0"
7+
CI_TOOLKIT_PLUGIN_VERSION="5.3.1"
88

9-
# Note: `-v4` suffix was added to use xcode-16.1-v4 image; remember to remove that suffix during the next Xcode update
10-
export IMAGE_ID="xcode-$XCODE_VERSION-v4"
9+
# FIXME: The -v2 suffix is required only as long as we use the 16.3 image.
10+
# This if check is here just so that we won't break the build if we forget about the suffix when it comes upgrade time.
11+
# But if you are reading this and 16.3 is no longer in use, please remove the check and the suffix.
12+
if [ "$XCODE_VERSION" = "16.3" ]; then
13+
export IMAGE_ID="xcode-$XCODE_VERSION-v2"
14+
else
15+
export IMAGE_ID="xcode-$XCODE_VERSION"
16+
fi
1117
export CI_TOOLKIT="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION"

0 commit comments

Comments
 (0)