Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 32 additions & 16 deletions .github/workflows/android-screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
screenshot-test-android:
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 60
steps:
- name: checkout
uses: actions/checkout@v6.0.2
Expand All @@ -41,6 +41,36 @@ jobs:
~/.android/avd/*
~/.android/adb*
key: avd-35
- name: Prepare Android test script
run: |
cat > android-test-script.sh << 'EOF'
#!/usr/bin/env bash
curl -L https://maven.google.com/androidx/test/services/test-services/1.6.0/test-services-1.6.0.apk --output test-services-1.6.0.apk
adb install -r -g test-services-1.6.0.apk
exit_code=1
for attempt in 1 2 3; do
echo "Android screenshot test attempt $attempt of 3"
adb uninstall org.jmonkeyengine.screenshottests.android || true
./gradlew :jme3-screenshot-tests:jme3-screenshot-tests-android:connectedDebugAndroidTest
exit_code=$?
if [ $exit_code -eq 0 ]; then
break
fi
if [ $attempt -lt 3 ]; then
echo "Attempt $attempt failed, retrying..."
fi
done
mkdir -p logcat
adb logcat -d > logcat/logcat_full.txt || true
adb logcat -d | grep org.jmonkeyengine.screenshottests.android > logcat/logcat.txt || true
mkdir -p report
adb pull /storage/emulated/0/googletest/test_outputfiles/report report/protoReport || true
adb pull /storage/emulated/0/googletest/test_outputfiles/changed-images report/changed-images || true
./gradlew :jme3-screenshot-tests:jme3-screenshot-tests-proto-report:upgradeProtoReport --args="$(pwd)/report/protoReport $(pwd)/report/extentReport" || true
echo "GRADLE_EXIT_CODE=$exit_code" >> $GITHUB_ENV
exit $exit_code
EOF
chmod +x android-test-script.sh
- name: Run Android Screenshot Test
uses: reactivecircus/android-emulator-runner@v2
with:
Expand All @@ -54,21 +84,7 @@ jobs:
profile: pixel_tablet
emulator-options: -no-window -gpu mesa -noaudio -no-boot-anim -camera-back none -no-snapshot -no-snapshot-save -no-snapshot-load
disable-animations: false
script: >
curl -L https://maven.google.com/androidx/test/services/test-services/1.6.0/test-services-1.6.0.apk --output test-services-1.6.0.apk;
adb install -r -g test-services-1.6.0.apk;
adb uninstall org.jmonkeyengine.screenshottests.android || true;
./gradlew :jme3-screenshot-tests:jme3-screenshot-tests-android:connectedDebugAndroidTest;
exit_code=$?;
mkdir -p logcat;
adb logcat -d > logcat/logcat_full.txt || true;
adb logcat -d | grep org.jmonkeyengine.screenshottests.android > logcat/logcat.txt || true;
mkdir -p report;
adb pull /storage/emulated/0/googletest/test_outputfiles/report report/protoReport || true;
adb pull /storage/emulated/0/googletest/test_outputfiles/changed-images report/changed-images || true;
./gradlew :jme3-screenshot-tests:jme3-screenshot-tests-proto-report:upgradeProtoReport --args="$(pwd)/report/protoReport $(pwd)/report/extentReport" || true;
echo "GRADLE_EXIT_CODE=$exit_code" >> $GITHUB_ENV;
exit $exit_code
script: bash android-test-script.sh
- name: Upload logcat
uses: actions/upload-artifact@v4
if: always()
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,28 @@ jobs:
uses: gradle/actions/wrapper-validation@v6.1.0
- name: Test with Gradle Wrapper
run: |
./gradlew :jme3-screenshot-tests:jme3-screenshot-tests-desktop:screenshotTest
for attempt in 1 2 3; do
echo "Screenshot test attempt $attempt of 3"
if ./gradlew :jme3-screenshot-tests:jme3-screenshot-tests-desktop:screenshotTest; then
exit 0
fi
if [ $attempt -lt 3 ]; then
echo "Attempt $attempt failed, retrying..."
fi
done
echo "All 3 attempts failed."
exit 1
- name: Report Screenshot Test failure
if: failure()
run: |
echo "::error title=Screenshot tests failed::Screenshot tests have failed.%0A%0A"\
"To review the differences:%0A"\
" 1. Download the 'screenshot-test-report' artifact from this run.%0A"\
" 2. Open jme3-screenshot-tests/build/reports/ScreenshotDiffReport.html%0A%0A"\
"If you did not intend to change any visuals: fix your changes so the tests pass.%0A"\
"If you intended to change visuals: review jme3-screenshot-tests/build/changed-images"\
" and commit replacements to jme3-screenshot-tests/src/test/resources.%0A%0A"\
"See https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-screenshot-tests/README.md for more information."
- name: Upload Test Reports
uses: actions/upload-artifact@v7.0.1
if: always()
Expand Down
138 changes: 0 additions & 138 deletions .github/workflows/screenshot-test-comment.yml

This file was deleted.

Loading