Skip to content

Commit f1f11ab

Browse files
Wire Maestro smoke tests into Buildkite
1 parent fb1d3df commit f1f11ab

4 files changed

Lines changed: 145 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Run the Maestro smoke suite through the repository runner.
5+
#
6+
# Expected CI secrets:
7+
# MAESTRO_WOO_SHARED_STORE_URL
8+
# MAESTRO_WOO_SHARED_EMAIL
9+
# MAESTRO_WOO_SHARED_PASSWORD
10+
# MAESTRO_WOO_SHARED_CONSUMER_KEY
11+
# MAESTRO_WOO_SHARED_CONSUMER_SECRET
12+
#
13+
# Optional controls:
14+
# MAESTRO_STORE=shared|lab
15+
# MAESTRO_INCLUDE_TAGS=smoke_core,smoke_extended,destructive
16+
# MAESTRO_REPEAT=3
17+
# MAESTRO_APK_PATH=/path/to/beta.apk
18+
19+
if .buildkite/commands/should-skip-job.sh --job-type validation; then
20+
echo "Skipping Maestro tests - no relevant changes"
21+
exit 0
22+
fi
23+
24+
STORE="${MAESTRO_STORE:-shared}"
25+
INCLUDE_TAGS="${MAESTRO_INCLUDE_TAGS:-smoke_core}"
26+
REPEAT="${MAESTRO_REPEAT:-1}"
27+
OUTPUT_DIR="${MAESTRO_OUTPUT_DIR:-WooCommerce/build/outputs/maestro-smoke}"
28+
29+
if [[ -n "${MAESTRO_APK_PATH:-}" ]]; then
30+
APK_PATH="$MAESTRO_APK_PATH"
31+
else
32+
echo "--- Building and installing wasabi debug APK"
33+
"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh"
34+
./gradlew :WooCommerce:installWasabiDebug
35+
APK_PATH=""
36+
fi
37+
38+
echo "--- Running Maestro smoke tests"
39+
set +e
40+
if [[ -n "$APK_PATH" ]]; then
41+
.maestro/scripts/run-smoke-tests.sh \
42+
--store "$STORE" \
43+
--include-tags "$INCLUDE_TAGS" \
44+
--repeat "$REPEAT" \
45+
--output-dir "$OUTPUT_DIR" \
46+
--no-open \
47+
--apk "$APK_PATH"
48+
else
49+
.maestro/scripts/run-smoke-tests.sh \
50+
--store "$STORE" \
51+
--include-tags "$INCLUDE_TAGS" \
52+
--repeat "$REPEAT" \
53+
--output-dir "$OUTPUT_DIR" \
54+
--no-open
55+
fi
56+
MAESTRO_EXIT_STATUS=$?
57+
set -e
58+
59+
echo "--- Collecting Maestro results"
60+
mkdir -p WooCommerce/build/buildkite-test-analytics
61+
LATEST_REPORT_DIR="$(find "$OUTPUT_DIR" -mindepth 1 -maxdepth 1 -type d | sort | tail -n 1)"
62+
if [[ -n "$LATEST_REPORT_DIR" && -f "$LATEST_REPORT_DIR/report.xml" ]]; then
63+
cp "$LATEST_REPORT_DIR/report.xml" WooCommerce/build/buildkite-test-analytics/maestro-report.xml
64+
fi
65+
66+
if [[ "$MAESTRO_EXIT_STATUS" -ne 0 ]]; then
67+
echo "^^^ +++"
68+
echo "Maestro smoke tests were not clean. Check flaky/failure details in artifacts."
69+
fi
70+
71+
exit "$MAESTRO_EXIT_STATUS"

.buildkite/pipeline.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,22 @@ steps:
117117
artifact_paths:
118118
- "**/build/instrumented-tests/**/*"
119119

120+
- input: Run Maestro smoke tests?
121+
prompt: "Run on-demand Maestro smoke tests. Requires MAESTRO_WOO_* secrets and an Android device/emulator."
122+
key: maestro_smoke_tests_triggered
123+
124+
- label: ":maestro: Maestro smoke tests"
125+
depends_on: maestro_smoke_tests_triggered
126+
command: .buildkite/commands/run-maestro-tests.sh
127+
plugins:
128+
- $CI_TOOLKIT
129+
- $TEST_COLLECTOR :
130+
<<: *test_collector_common_params
131+
api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_MAESTRO_TESTS"
132+
artifact_paths:
133+
- "WooCommerce/build/outputs/maestro-smoke/**/*"
134+
- "WooCommerce/build/buildkite-test-analytics/maestro-report.xml"
135+
120136

121137
- label: "🐘 Populate Gradle build cache"
122138
command: .buildkite/commands/gradle-cache-build.sh
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
agents:
5+
queue: "android"
6+
7+
env:
8+
MAESTRO_STORE: "shared"
9+
MAESTRO_INCLUDE_TAGS: "smoke_core,smoke_extended,destructive"
10+
MAESTRO_REPEAT: "1"
11+
12+
steps:
13+
- label: ":maestro: Release Maestro smoke tests"
14+
command: .buildkite/commands/run-maestro-tests.sh
15+
plugins:
16+
- $CI_TOOLKIT
17+
- $TEST_COLLECTOR :
18+
files: "WooCommerce/build/buildkite-test-analytics/*.xml"
19+
format: "junit"
20+
api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_MAESTRO_TESTS"
21+
artifact_paths:
22+
- "WooCommerce/build/outputs/maestro-smoke/**/*"
23+
- "WooCommerce/build/buildkite-test-analytics/maestro-report.xml"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
# Intended Buildkite schedule:
5+
# Bi-weekly Thursday night before the Monday production rollout.
6+
# Branch: active release branch.
7+
#
8+
# This is deliberately not a nightly pipeline.
9+
10+
agents:
11+
queue: "android"
12+
13+
env:
14+
MAESTRO_STORE: "shared"
15+
MAESTRO_INCLUDE_TAGS: "smoke_core,smoke_extended,destructive"
16+
MAESTRO_REPEAT: "3"
17+
18+
steps:
19+
- label: ":maestro: Thursday Maestro smoke burst"
20+
command: .buildkite/commands/run-maestro-tests.sh
21+
plugins:
22+
- $CI_TOOLKIT
23+
- $TEST_COLLECTOR :
24+
files: "WooCommerce/build/buildkite-test-analytics/*.xml"
25+
format: "junit"
26+
api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_MAESTRO_TESTS"
27+
artifact_paths:
28+
- "WooCommerce/build/outputs/maestro-smoke/**/*"
29+
- "WooCommerce/build/buildkite-test-analytics/maestro-report.xml"
30+
31+
notify:
32+
- slack:
33+
channels:
34+
- "#woo-android-notifs"
35+
if: "build.state != 'passed'"

0 commit comments

Comments
 (0)