mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 20:28:32 +09:00
[Fix] (ci): split APK retrace validation steps
This commit is contained in:
@@ -123,7 +123,7 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: Test retrace APK on Android AVD
|
||||
- name: Retrace and validate Espryt (DirectGLES)
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 35
|
||||
@@ -133,8 +133,11 @@ jobs:
|
||||
disable-animations: true
|
||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none
|
||||
script: >-
|
||||
set +e;
|
||||
sh android-plugin/trace-replay-ci.sh
|
||||
--apk-dir android-retrace-apks
|
||||
--apk-file "$(find android-retrace-apks -name 'MobileGL-EsprytTrace-release.apk' -print -quit)"
|
||||
--package top.mobilegl.plugin.espryt.trace
|
||||
--backend DirectGLES
|
||||
--result-root android-retrace-result
|
||||
--fixture-root android-retrace-fixture
|
||||
--case minecraft-1.21.4-startup
|
||||
@@ -150,13 +153,48 @@ jobs:
|
||||
--crop-width 0
|
||||
--crop-height 0
|
||||
--fuzz-percent 20
|
||||
--timeout-seconds 180
|
||||
--espryt-package top.mobilegl.plugin.espryt.trace
|
||||
--espryt-apk-name MobileGL-EsprytTrace-release.apk
|
||||
--espryt-backend DirectGLES
|
||||
--magma-package top.mobilegl.plugin.magma.trace
|
||||
--magma-apk-name MobileGL-MagmaTrace-release.apk
|
||||
--magma-backend DirectVulkan
|
||||
--timeout-seconds 180;
|
||||
status=$?;
|
||||
mkdir -p android-retrace-result/status;
|
||||
echo "${status}" > android-retrace-result/status/DirectGLES.status;
|
||||
exit 0
|
||||
|
||||
- name: Retrace and validate Magma (DirectVulkan)
|
||||
if: always()
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 35
|
||||
target: google_apis
|
||||
arch: x86_64
|
||||
profile: pixel_6
|
||||
disable-animations: true
|
||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none
|
||||
script: >-
|
||||
set +e;
|
||||
sh android-plugin/trace-replay-ci.sh
|
||||
--apk-file "$(find android-retrace-apks -name 'MobileGL-MagmaTrace-release.apk' -print -quit)"
|
||||
--package top.mobilegl.plugin.magma.trace
|
||||
--backend DirectVulkan
|
||||
--result-root android-retrace-result
|
||||
--fixture-root android-retrace-fixture
|
||||
--case minecraft-1.21.4-startup
|
||||
--trace-archive tools/trace_replay/fixtures/minecraft-1.21.4-startup.tgz
|
||||
--trace-file trace.trace
|
||||
--golden tools/trace_replay/fixtures/minecraft-1.21.4-startup.0000092195.png
|
||||
--target-call 92195
|
||||
--width 854
|
||||
--height 480
|
||||
--tolerance 20
|
||||
--crop-x 0
|
||||
--crop-y 0
|
||||
--crop-width 0
|
||||
--crop-height 0
|
||||
--fuzz-percent 20
|
||||
--timeout-seconds 180;
|
||||
status=$?;
|
||||
mkdir -p android-retrace-result/status;
|
||||
echo "${status}" > android-retrace-result/status/DirectVulkan.status;
|
||||
exit 0
|
||||
|
||||
- name: Upload Android retrace result
|
||||
if: always()
|
||||
@@ -165,3 +203,14 @@ jobs:
|
||||
name: MobileGL-android-retrace-result-${{ env.date_today }}-${{ env.short_sha }}
|
||||
path: android-retrace-result/**
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Check Android retrace results
|
||||
if: always()
|
||||
run: |
|
||||
direct_gles_status="$(cat android-retrace-result/status/DirectGLES.status 2>/dev/null || echo 1)"
|
||||
direct_vulkan_status="$(cat android-retrace-result/status/DirectVulkan.status 2>/dev/null || echo 1)"
|
||||
echo "DirectGLES status: ${direct_gles_status}"
|
||||
echo "DirectVulkan status: ${direct_vulkan_status}"
|
||||
if [ "${direct_gles_status}" -ne 0 ] || [ "${direct_vulkan_status}" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,9 @@ usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
sh android-plugin/trace-replay-ci.sh \
|
||||
--apk-dir DIR \
|
||||
--apk-file FILE \
|
||||
--package PACKAGE \
|
||||
--backend BACKEND \
|
||||
--result-root DIR \
|
||||
--fixture-root DIR \
|
||||
--case NAME \
|
||||
@@ -21,13 +23,7 @@ Usage:
|
||||
--crop-width N \
|
||||
--crop-height N \
|
||||
--fuzz-percent N \
|
||||
--timeout-seconds N \
|
||||
--espryt-package PACKAGE \
|
||||
--espryt-apk-name APK_NAME \
|
||||
--espryt-backend BACKEND \
|
||||
--magma-package PACKAGE \
|
||||
--magma-apk-name APK_NAME \
|
||||
--magma-backend BACKEND
|
||||
--timeout-seconds N
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -52,7 +48,9 @@ require_value() {
|
||||
fi
|
||||
}
|
||||
|
||||
apk_dir=""
|
||||
apk_file=""
|
||||
package_name=""
|
||||
backend=""
|
||||
result_root=""
|
||||
fixture_root=""
|
||||
case_name=""
|
||||
@@ -69,16 +67,12 @@ crop_width=""
|
||||
crop_height=""
|
||||
fuzz_percent=""
|
||||
timeout_seconds=""
|
||||
espryt_package=""
|
||||
espryt_apk_name=""
|
||||
espryt_backend=""
|
||||
magma_package=""
|
||||
magma_apk_name=""
|
||||
magma_backend=""
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--apk-dir) apk_dir="$(next_arg "$@")"; shift 2 ;;
|
||||
--apk-file) apk_file="$(next_arg "$@")"; shift 2 ;;
|
||||
--package) package_name="$(next_arg "$@")"; shift 2 ;;
|
||||
--backend) backend="$(next_arg "$@")"; shift 2 ;;
|
||||
--result-root) result_root="$(next_arg "$@")"; shift 2 ;;
|
||||
--fixture-root) fixture_root="$(next_arg "$@")"; shift 2 ;;
|
||||
--case) case_name="$(next_arg "$@")"; shift 2 ;;
|
||||
@@ -95,18 +89,14 @@ while [ "$#" -gt 0 ]; do
|
||||
--crop-height) crop_height="$(next_arg "$@")"; shift 2 ;;
|
||||
--fuzz-percent) fuzz_percent="$(next_arg "$@")"; shift 2 ;;
|
||||
--timeout-seconds) timeout_seconds="$(next_arg "$@")"; shift 2 ;;
|
||||
--espryt-package) espryt_package="$(next_arg "$@")"; shift 2 ;;
|
||||
--espryt-apk-name) espryt_apk_name="$(next_arg "$@")"; shift 2 ;;
|
||||
--espryt-backend) espryt_backend="$(next_arg "$@")"; shift 2 ;;
|
||||
--magma-package) magma_package="$(next_arg "$@")"; shift 2 ;;
|
||||
--magma-apk-name) magma_apk_name="$(next_arg "$@")"; shift 2 ;;
|
||||
--magma-backend) magma_backend="$(next_arg "$@")"; shift 2 ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) die "unknown argument: $1" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
require_value "${apk_dir}" "--apk-dir"
|
||||
require_value "${apk_file}" "--apk-file"
|
||||
require_value "${package_name}" "--package"
|
||||
require_value "${backend}" "--backend"
|
||||
require_value "${result_root}" "--result-root"
|
||||
require_value "${fixture_root}" "--fixture-root"
|
||||
require_value "${case_name}" "--case"
|
||||
@@ -123,13 +113,8 @@ require_value "${crop_width}" "--crop-width"
|
||||
require_value "${crop_height}" "--crop-height"
|
||||
require_value "${fuzz_percent}" "--fuzz-percent"
|
||||
require_value "${timeout_seconds}" "--timeout-seconds"
|
||||
require_value "${espryt_package}" "--espryt-package"
|
||||
require_value "${espryt_apk_name}" "--espryt-apk-name"
|
||||
require_value "${espryt_backend}" "--espryt-backend"
|
||||
require_value "${magma_package}" "--magma-package"
|
||||
require_value "${magma_apk_name}" "--magma-apk-name"
|
||||
require_value "${magma_backend}" "--magma-backend"
|
||||
|
||||
test -f "${apk_file}" || die "APK does not exist: ${apk_file}"
|
||||
test -f "${trace_archive}" || die "trace archive does not exist: ${trace_archive}"
|
||||
test -f "${golden_path}" || die "golden image does not exist: ${golden_path}"
|
||||
|
||||
@@ -139,13 +124,6 @@ quote_android_path() {
|
||||
printf '%s' "$1" | sed "s/'/'\\\\''/g"
|
||||
}
|
||||
|
||||
find_apk() {
|
||||
apk_name="$1"
|
||||
apk_path="$(find "${apk_dir}" -name "${apk_name}" -print -quit)"
|
||||
test -n "${apk_path}" || die "APK not found under ${apk_dir}: ${apk_name}"
|
||||
printf '%s' "${apk_path}"
|
||||
}
|
||||
|
||||
prepare_fixture() {
|
||||
fixture_dir="${fixture_root}/${safe_case}"
|
||||
rm -rf "${fixture_dir}"
|
||||
@@ -174,14 +152,11 @@ copy_fixture_to_app() {
|
||||
}
|
||||
|
||||
run_retrace() {
|
||||
package_name="$1"
|
||||
apk_path="$2"
|
||||
backend="$3"
|
||||
app_dir="/data/user/0/${package_name}/files/trace-replay"
|
||||
result_dir="${result_root}/${safe_case}-${backend}"
|
||||
|
||||
mkdir -p "${result_dir}"
|
||||
adb install -r "${apk_path}"
|
||||
adb install -r "${apk_file}"
|
||||
copy_fixture_to_app "${package_name}"
|
||||
adb shell am force-stop "${package_name}"
|
||||
adb logcat -c
|
||||
@@ -223,5 +198,4 @@ run_retrace() {
|
||||
mkdir -p "${fixture_root}" "${result_root}"
|
||||
prepare_fixture
|
||||
|
||||
run_retrace "${espryt_package}" "$(find_apk "${espryt_apk_name}")" "${espryt_backend}"
|
||||
run_retrace "${magma_package}" "$(find_apk "${magma_apk_name}")" "${magma_backend}"
|
||||
run_retrace
|
||||
|
||||
Reference in New Issue
Block a user