From 6001ba73f07e55bf47abe9a07e2453e60451fc9c Mon Sep 17 00:00:00 2001 From: William Harris Date: Fri, 28 Nov 2025 21:39:49 +0000 Subject: [PATCH 1/3] test: connectedAndroidTest single test just to make sure its still working --- .github/workflows/actions.yml | 115 +++++++++++++++++++ scripts/deprecated_run_android_tests.sh | 2 +- scripts/run_verify_connected_android_test.sh | 36 ++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 scripts/run_verify_connected_android_test.sh diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 41ccc750f..e5e32891e 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -460,6 +460,121 @@ jobs: android/app/build/outputs/logs/ retention-days: 90 + # NOTE: this single cAT integration test is just to make sure cAT isn't broken + # if we revert back to cAT as the main integration test, we can remove this job + verify-connected-android-test-working-single-integration-test: + name: Test Android App + needs: [set_build_datetime] + runs-on: ubuntu-latest + strategy: + matrix: + arch: [x86_64] # Only test on x86_64 to save time and resources + fail-fast: false + env: + ENTRY_FILE: "index.tsx" + GRADLE_ABI: ${{ matrix.arch }} + BUILD_ARCH: ${{ matrix.arch }} + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + + # Execute the common setup with emulator configuration + - name: Common Setup + id: common-setup + uses: ./.github/actions/common-setup + with: + optional_cache_key: "integration-test" + gradle_max_workers: "4" + node_version: "22.x" + arch: ${{ matrix.arch }} + android_api_level: ${{ env.ANDROID_API_LEVEL }} + android_target: ${{ env.ANDROID_TARGET }} + android_profile: ${{ env.ANDROID_PROFILE }} + run_emulator_setup: "true" + + - name: Make scripts executable + run: | + chmod +x scripts/wait_for_emulator.sh + chmod +x scripts/run_verify_connected_android_test.sh + + - name: Download APK artifacts + uses: actions/download-artifact@v4 + with: + name: android-apk-artifacts-${{ matrix.arch }} + path: android/app/build/outputs/apk + + - name: Download Test APK artifacts + uses: actions/download-artifact@v4 + with: + name: android-test-apk-artifacts-${{ matrix.arch }} + path: android/app/build/outputs/apk/androidTest + + - name: Download Coverage artifacts + uses: actions/download-artifact@v4 + with: + name: android-coverage-artifacts-${{ matrix.arch }} + path: android/${{ env.main_project_module }}/build/ + + - name: Debug directory structure + run: | + echo "Directory structure after download:" + find android/${{ env.main_project_module }}/build/ -type d + + - name: Run Android Tests + id: run_tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.ANDROID_API_LEVEL }} + target: ${{ env.ANDROID_TARGET }} + arch: ${{ matrix.arch }} + profile: ${{ env.ANDROID_PROFILE }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot -memory 2048 + disable-animations: true + # TODO: make a PR so this thing can properly take a multiline script call + # too easy to make mistakes with line this long + # super annoying to have to make yet another script to forget to chmod +x on accident + script: ./scripts/wait_for_emulator.sh && ./scripts/run_verify_connected_android_test.sh ${{ matrix.arch }} ${{ env.main_project_module }} ${{ env.ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL }} + + # Publish integration test results + - name: Publish Integration Test Results + uses: dorny/test-reporter@v2 + if: always() + with: + name: 'Integration Tests' + path: android/app/build/outputs/*.xml,android/app/build/outputs/**/*.xml + reporter: java-junit + fail-on-error: true + + - name: Upload Coverage Report + if: always() + uses: actions/upload-artifact@v4 + with: + name: android-test-coverage-report-${{ needs.set_build_datetime.outputs.build_datetime }} + path: | + android/app/build/reports/ + android/app/build/reports/jacoco/jacocoAndroidTestReport/ + android/app/build/outputs/code_coverage/ + android/app/build/outputs/logs/ + android/app/build/test-results/ + retention-days: 90 + + - name: Upload Emulator Log + if: always() + uses: actions/upload-artifact@v4 + with: + name: verify-connected-android-test-emulator-log + path: verify-connected-android-test-emulator.log + retention-days: 90 + + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true # connected-android-integration-test: # name: Test Android App diff --git a/scripts/deprecated_run_android_tests.sh b/scripts/deprecated_run_android_tests.sh index 64f6f0942..18139d7bf 100755 --- a/scripts/deprecated_run_android_tests.sh +++ b/scripts/deprecated_run_android_tests.sh @@ -30,6 +30,6 @@ export BUILD_ARCH=$ARCH ./gradlew -PBUILD_ARCH="$ARCH" \ -PreactNativeArchitectures="$ARCH" \ :"$MAIN_PROJECT_MODULE":connected${ARCH_SUFFIX}DebugAndroidTest \ - --parallel --max-workers=4 --build-cache + --parallel --max-workers=$(nproc) --build-cache echo "Android tests completed successfully!" \ No newline at end of file diff --git a/scripts/run_verify_connected_android_test.sh b/scripts/run_verify_connected_android_test.sh new file mode 100644 index 000000000..7fc56e858 --- /dev/null +++ b/scripts/run_verify_connected_android_test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +# Script to run Android tests in CI + +echo "Starting Android tests..." + +# Get the architecture from command line or default to x86_64 +ARCH=${1:-x86_64} +MAIN_PROJECT_MODULE=${2:-app} +ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL=${3:-5} + +# Determine the build variant suffix based on architecture +if [ "$ARCH" == "arm64-v8a" ]; then + ARCH_SUFFIX="Arm64V8a" +else + ARCH_SUFFIX="X8664" +fi + +echo "Running tests for architecture: $ARCH (using suffix: $ARCH_SUFFIX)" + +# Navigate to the Android directory +cd android + +# Set environment variables +export ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL=$ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL +export BUILD_ARCH=$ARCH + +# Run the tests with the appropriate architecture suffix +./gradlew -PBUILD_ARCH="$ARCH" \ + -PreactNativeArchitectures="$ARCH" \ + :"$MAIN_PROJECT_MODULE":connected${ARCH_SUFFIX}DebugAndroidTest \ + -Pandroid.testInstrumentationRunnerArguments.class=com.github.quarck.calnotify.calendarmonitor.ComponentIsolationTest \ + --parallel --max-workers=$(nproc) --build-cache + +echo "Android tests completed successfully!" \ No newline at end of file From b3375fe6f340b994643fd58e098520c6709463a3 Mon Sep 17 00:00:00 2001 From: William Harris Date: Fri, 28 Nov 2025 21:45:22 +0000 Subject: [PATCH 2/3] fix: name and remove some un needed steps --- .github/workflows/actions.yml | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index e5e32891e..8bccfc7db 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -463,7 +463,7 @@ jobs: # NOTE: this single cAT integration test is just to make sure cAT isn't broken # if we revert back to cAT as the main integration test, we can remove this job verify-connected-android-test-working-single-integration-test: - name: Test Android App + name: "Verify Connected Android Test Still Works (Working Single Integration Test)" needs: [set_build_datetime] runs-on: ubuntu-latest strategy: @@ -500,24 +500,6 @@ jobs: chmod +x scripts/wait_for_emulator.sh chmod +x scripts/run_verify_connected_android_test.sh - - name: Download APK artifacts - uses: actions/download-artifact@v4 - with: - name: android-apk-artifacts-${{ matrix.arch }} - path: android/app/build/outputs/apk - - - name: Download Test APK artifacts - uses: actions/download-artifact@v4 - with: - name: android-test-apk-artifacts-${{ matrix.arch }} - path: android/app/build/outputs/apk/androidTest - - - name: Download Coverage artifacts - uses: actions/download-artifact@v4 - with: - name: android-coverage-artifacts-${{ matrix.arch }} - path: android/${{ env.main_project_module }}/build/ - - name: Debug directory structure run: | echo "Directory structure after download:" @@ -549,19 +531,6 @@ jobs: reporter: java-junit fail-on-error: true - - name: Upload Coverage Report - if: always() - uses: actions/upload-artifact@v4 - with: - name: android-test-coverage-report-${{ needs.set_build_datetime.outputs.build_datetime }} - path: | - android/app/build/reports/ - android/app/build/reports/jacoco/jacocoAndroidTestReport/ - android/app/build/outputs/code_coverage/ - android/app/build/outputs/logs/ - android/app/build/test-results/ - retention-days: 90 - - name: Upload Emulator Log if: always() uses: actions/upload-artifact@v4 From 40f4084dfde0c517c26c79d63512894185f626c9 Mon Sep 17 00:00:00 2001 From: William Harris Date: Sat, 29 Nov 2025 19:47:00 +0000 Subject: [PATCH 3/3] ci: maybe fix action --- .github/workflows/actions.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 8bccfc7db..bd9437090 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -503,7 +503,11 @@ jobs: - name: Debug directory structure run: | echo "Directory structure after download:" - find android/${{ env.main_project_module }}/build/ -type d + if [ -d "android/${{ env.main_project_module }}/build/" ]; then + find android/${{ env.main_project_module }}/build/ -type d + else + echo "Directory android/${{ env.main_project_module }}/build/ doesn't exist" + fi - name: Run Android Tests id: run_tests @@ -720,7 +724,11 @@ jobs: - name: Debug directory structure run: | echo "Directory structure after download:" - find android/${{ env.main_project_module }}/build/ -type d + if [ -d "android/${{ env.main_project_module }}/build/" ]; then + find android/${{ env.main_project_module }}/build/ -type d + else + echo "Directory android/${{ env.main_project_module }}/build/ doesn't exist" + fi - name: Run Android Tests id: run_tests