From b498ddf364a7046d8f00f5209dde3c46c8bcf243 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 13 May 2025 11:33:14 +1000 Subject: [PATCH 1/5] Add `pipefail` to inline commands to run tests in CI --- .buildkite/pipeline.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index f6accd43f04c..9ec2eb7244d4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -116,6 +116,8 @@ steps: exit 0 fi + set -o pipefail + .buildkite/commands/shared-set-up.sh xcodebuild \ -scheme Keystone \ @@ -134,6 +136,8 @@ steps: exit 0 fi + set -o pipefail + .buildkite/commands/shared-set-up.sh xcodebuild \ -scheme WordPressData \ From 82139e8d95a6a7bd34cc706cb67fd0fa02db4bce Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 13 May 2025 17:35:45 +1000 Subject: [PATCH 2/5] Run Keystone and WordPressData unit tests in CI on iOS 18.4 The only iOS version available out of the box with the 16.3 stack. --- .buildkite/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9ec2eb7244d4..f9d401db04e7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -121,7 +121,7 @@ steps: .buildkite/commands/shared-set-up.sh xcodebuild \ -scheme Keystone \ - -destination 'platform=iOS Simulator,OS=18.2,name=iPhone 16' \ + -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16' \ test \ | xcbeautify plugins: [$CI_TOOLKIT_PLUGIN] @@ -141,7 +141,7 @@ steps: .buildkite/commands/shared-set-up.sh xcodebuild \ -scheme WordPressData \ - -destination 'platform=iOS Simulator,OS=18.2,name=iPhone 16' \ + -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16' \ test \ | xcbeautify plugins: [$CI_TOOLKIT_PLUGIN] From f413a08f52ff4f5d928e28b90c9237f977f64c65 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 26 Jun 2025 16:10:25 +1000 Subject: [PATCH 3/5] DRY command to run unit tests focused to a scheme in CI --- .../commands/run-unit-tests-for-scheme.sh | 17 +++++++++++ .buildkite/pipeline.yml | 28 ++----------------- 2 files changed, 19 insertions(+), 26 deletions(-) create mode 100755 .buildkite/commands/run-unit-tests-for-scheme.sh diff --git a/.buildkite/commands/run-unit-tests-for-scheme.sh b/.buildkite/commands/run-unit-tests-for-scheme.sh new file mode 100755 index 000000000000..b01b1c4c2d2b --- /dev/null +++ b/.buildkite/commands/run-unit-tests-for-scheme.sh @@ -0,0 +1,17 @@ +#!/bin/bash -euo pipefail + +SCHEME="${1:?Usage $0 SCHEME}" +DEVICE="iPhone 16" +OS_VERSION="18.4" + +if "$(dirname "${BASH_SOURCE[0]}")/should-skip-job.sh" --job-type validation; then + exit 0 +fi + +$(dirname "${BASH_SOURCE[0]}")/shared-set-up.sh + +xcodebuild \ + -scheme "${SCHEME}" \ + -destination "platform=iOS Simulator,OS=${OS_VERSION},name=${DEVICE}" \ + test \ + | xcbeautify diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index f9d401db04e7..45eef2262bf0 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -111,19 +111,7 @@ steps: - github_commit_status: context: "Reader Unit Tests" - label: "🔬 Keystone Unit Tests" - command: | - if .buildkite/commands/should-skip-job.sh --job-type validation; then - exit 0 - fi - - set -o pipefail - - .buildkite/commands/shared-set-up.sh - xcodebuild \ - -scheme Keystone \ - -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16' \ - test \ - | xcbeautify + command: .buildkite/commands/run-unit-tests-for-scheme.sh Keystone plugins: [$CI_TOOLKIT_PLUGIN] artifact_paths: - "build/results/*" @@ -131,19 +119,7 @@ steps: - github_commit_status: context: "Unit Tests Keystone" - label: "🔬 WordPressData Unit Tests" - command: | - if .buildkite/commands/should-skip-job.sh --job-type validation; then - exit 0 - fi - - set -o pipefail - - .buildkite/commands/shared-set-up.sh - xcodebuild \ - -scheme WordPressData \ - -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16' \ - test \ - | xcbeautify + command: .buildkite/commands/run-unit-tests-for-scheme.sh WordPressData plugins: [$CI_TOOLKIT_PLUGIN] artifact_paths: - "build/results/*" From 6c2b7a63f1d5cbe1aabd64bdcd93c436eaa8881b Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 26 Jun 2025 16:17:23 +1000 Subject: [PATCH 4/5] Disable Keystone tests in CI --- .buildkite/pipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 45eef2262bf0..70392aa25504 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -112,6 +112,8 @@ steps: context: "Reader Unit Tests" - label: "🔬 Keystone Unit Tests" command: .buildkite/commands/run-unit-tests-for-scheme.sh Keystone + # Disabled till https://github.com/wordpress-mobile/WordPress-iOS/pull/24537 is completed + if: false plugins: [$CI_TOOLKIT_PLUGIN] artifact_paths: - "build/results/*" From 62c6317e9bd03a2e6d25aeaa3dafcb60b31a8d22 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 27 Jun 2025 10:44:05 +1000 Subject: [PATCH 5/5] Add schema to Buildkite pipeline and address `if: false` violation --- .buildkite/pipeline.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 70392aa25504..af462cee5f5c 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,3 +1,6 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json +--- + # Most of the steps need to run on a macOS agent, so let's define it as a root property. agents: queue: mac @@ -113,7 +116,10 @@ steps: - label: "🔬 Keystone Unit Tests" command: .buildkite/commands/run-unit-tests-for-scheme.sh Keystone # Disabled till https://github.com/wordpress-mobile/WordPress-iOS/pull/24537 is completed - if: false + # + # The boolean value has to be a string explicitly. + # See validation error against schema. + if: "false" plugins: [$CI_TOOLKIT_PLUGIN] artifact_paths: - "build/results/*"