chore: upgrade macos workflows #253
Workflow file for this run
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: E2E Android | |
| on: | |
| pull_request: | |
| paths: | |
| - .github/workflows/e2e-android.yml | |
| - apps/common/example/** | |
| - android/** | |
| - src/** | |
| - e2e/** | |
| - package.json | |
| # push: | |
| # branches: | |
| # - main | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| WORKING_DIRECTORY: paper-example | |
| API_LEVEL: 34 | |
| SYSTEM_IMAGES: system-images;android-34;google_apis;x86_64 | |
| AVD_NAME: rn-svg-avd | |
| concurrency: | |
| group: android-e2e-example-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # - name: Free Disk Space (Ubuntu) | |
| # uses: jlumbroso/free-disk-space@main | |
| # with: | |
| # tool-cache: true | |
| # android: false | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'zulu' | |
| cache: 'gradle' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| cache: 'yarn' | |
| - name: Install root node dependencies | |
| run: yarn | |
| - name: Install example app node dependencies | |
| working-directory: apps/${{ env.WORKING_DIRECTORY }} | |
| run: yarn | |
| - name: Install AVD dependencies | |
| # libxkbfile1 is removed by "Free Disk Space (Ubuntu)" step first. Here we install it again | |
| # as it seems to be needed by the emulator. | |
| run: | | |
| sudo apt update | |
| sudo apt-get install -y libpulse0 libgl1 libxkbfile1 | |
| - name: Build Android app | |
| working-directory: apps/${{ env.WORKING_DIRECTORY }}/android | |
| run: ./gradlew assembleDebug | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-${{ env.API_LEVEL }} | |
| - name: Create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ env.API_LEVEL }} | |
| target: default | |
| profile: pixel_2 | |
| ram-size: '4096M' | |
| disk-size: '5G' | |
| disable-animations: false | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| avd-name: e2e_emulator | |
| arch: x86_64 | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Run emulator, Metro, and E2E | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ env.API_LEVEL }} | |
| target: default | |
| profile: pixel_2 | |
| ram-size: '4096M' | |
| disk-size: '5G' | |
| disable-animations: false | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| avd-name: e2e_emulator | |
| arch: x86_64 | |
| script: | | |
| # Start Metro in the background | |
| E2E=true yarn --cwd apps/${{ env.WORKING_DIRECTORY }} start &> output.log & | |
| # Wait for emulator to boot fully | |
| $ANDROID_HOME/platform-tools/adb wait-for-device | |
| $ANDROID_HOME/platform-tools/adb shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;' | |
| # Install the app APK | |
| $ANDROID_HOME/platform-tools/adb install -r apps/${{ env.WORKING_DIRECTORY }}/android/app/build/outputs/apk/debug/app-debug.apk | |
| # Launch the app using bash | |
| bash -c 'until $ANDROID_HOME/platform-tools/adb shell monkey -p com.paperexample 1 | grep -q "Events injected: 1"; do sleep 1; echo "Retrying app launch..."; done' | |
| # Run your E2E tests | |
| E2E=true yarn e2e | |
| # - name: Start Metro server | |
| # working-directory: apps/${{ env.WORKING_DIRECTORY }} | |
| # run: E2E=true yarn start &> output.log & | |
| # - name: Install APK | |
| # run: $ANDROID_HOME/platform-tools/adb install -r apps/${{ env.WORKING_DIRECTORY }}/android/app/build/outputs/apk/debug/app-debug.apk | |
| # - name: Launch APK | |
| # run: | | |
| # PACKAGE="com.example" | |
| # ACTIVITY=".MainActivity" | |
| # echo "Launching $PACKAGE/$ACTIVITY..." | |
| # $ANDROID_HOME/platform-tools/adb shell am start -n "$PACKAGE/$ACTIVITY" | |
| # $ANDROID_HOME/platform-tools/adb shell 'until pidof com.example > /dev/null; do sleep 1; done' | |
| # echo "App started." | |
| # - name: Run E2E Tests | |
| # run: E2E=true yarn e2e | |
| - name: Upload test report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: report | |
| path: | | |
| report.html | |
| jest-html-reporters-attach/ |