Skip to content

Commit e624c99

Browse files
committed
Revert "Capture emulator screenshot in Android workflow"
This reverts commit c64a649.
1 parent e7b0a61 commit e624c99

File tree

3 files changed

+2
-50
lines changed

3 files changed

+2
-50
lines changed

.github/workflows/scripts-android.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,4 @@ jobs:
3636
arch: x86_64
3737
target: google_apis
3838
script: |
39-
./scripts/run-android-instrumentation-tests.sh "${{ steps.build-android-app.outputs.gradle_project_dir }}" "${{ steps.build-android-app.outputs.package_name }}"
40-
- name: Upload emulator screenshot
41-
if: ${{ success() }}
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: android-emulator-screenshot
45-
path: out/android-emulator/hello-codenameone.png
46-
if-no-files-found: error
39+
./scripts/run-android-instrumentation-tests.sh "${{ steps.build-android-app.outputs.gradle_project_dir }}"

scripts/build-android-app.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ if [ -n "${GITHUB_OUTPUT:-}" ]; then
370370
echo "gradle_project_dir=$GRADLE_PROJECT_DIR"
371371
echo "apk_path=$APK_PATH"
372372
echo "instrumentation_test_class=$PACKAGE_NAME.HelloCodenameOneInstrumentedTest"
373-
echo "package_name=$PACKAGE_NAME"
374373
} >> "$GITHUB_OUTPUT"
375374
ba_log "Published GitHub Actions outputs for downstream steps"
376375
fi

scripts/run-android-instrumentation-tests.sh

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ set -euo pipefail
55
ra_log() { echo "[run-android-instrumentation-tests] $1"; }
66

77
if [ $# -lt 1 ]; then
8-
ra_log "Usage: $0 <gradle_project_dir> [package_name]" >&2
8+
ra_log "Usage: $0 <gradle_project_dir>" >&2
99
exit 1
1010
fi
1111

1212
GRADLE_PROJECT_DIR="$1"
13-
PACKAGE_NAME="${2:-}"
1413

1514
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1615
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -94,13 +93,6 @@ ra_log "Device build fingerprint: $(adb_target shell getprop ro.build.fingerprin
9493
ra_log "Installed instrumentation targets:"
9594
adb_target shell pm list instrumentation || true
9695

97-
if [ -z "$PACKAGE_NAME" ]; then
98-
PACKAGE_NAME="$(adb_target shell pm list instrumentation 2>/dev/null | sed -n 's/.*target=\([^)]*\)).*/\1/p' | tr -d '\r' | head -n 1 || true)"
99-
if [ -n "$PACKAGE_NAME" ]; then
100-
ra_log "Detected application package from instrumentation list: $PACKAGE_NAME"
101-
fi
102-
fi
103-
10496
if [ ! -d "$GRADLE_PROJECT_DIR" ]; then
10597
ra_log "Gradle project directory not found: $GRADLE_PROJECT_DIR" >&2
10698
exit 1
@@ -118,35 +110,3 @@ ORIGINAL_JAVA_HOME="${JAVA_HOME:-}"; export JAVA_HOME="$JAVA17_HOME"
118110
)
119111
export JAVA_HOME="$ORIGINAL_JAVA_HOME"
120112
ra_log "Instrumentation tests completed successfully"
121-
122-
if [ -z "$PACKAGE_NAME" ]; then
123-
ra_log "Application package name not available; skipping screenshot capture" >&2
124-
exit 1
125-
fi
126-
127-
ra_log "Launching $PACKAGE_NAME before capturing screenshot"
128-
adb_target shell monkey -p "$PACKAGE_NAME" -c android.intent.category.LAUNCHER 1 >/dev/null 2>&1 || {
129-
ra_log "Failed to launch $PACKAGE_NAME via monkey" >&2
130-
exit 1
131-
}
132-
133-
SCREENSHOT_DEVICE_PATH="/sdcard/Download/cn1-instrumentation-screenshot.png"
134-
SCREENSHOT_DIR="$REPO_ROOT/out/android-emulator"
135-
SCREENSHOT_PATH="$SCREENSHOT_DIR/hello-codenameone.png"
136-
mkdir -p "$SCREENSHOT_DIR"
137-
rm -f "$SCREENSHOT_PATH"
138-
139-
ra_log "Capturing emulator screenshot to $SCREENSHOT_DEVICE_PATH"
140-
adb_target shell rm "$SCREENSHOT_DEVICE_PATH" >/dev/null 2>&1 || true
141-
adb_target shell screencap -p "$SCREENSHOT_DEVICE_PATH" >/dev/null || {
142-
ra_log "Failed to capture screenshot on device" >&2
143-
exit 1
144-
}
145-
146-
ra_log "Pulling screenshot to $SCREENSHOT_PATH"
147-
adb_target pull "$SCREENSHOT_DEVICE_PATH" "$SCREENSHOT_PATH" >/dev/null || {
148-
ra_log "Failed to pull screenshot from device" >&2
149-
exit 1
150-
}
151-
adb_target shell rm "$SCREENSHOT_DEVICE_PATH" >/dev/null 2>&1 || true
152-
ra_log "Screenshot available at $SCREENSHOT_PATH"

0 commit comments

Comments
 (0)