fix: change runs-on to ubuntu for E2E Android #283
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 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: 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: | | |
| # Install root node dependencies | |
| yarn install | |
| # Install example app node dependencies | |
| yarn --cwd apps/${{ env.WORKING_DIRECTORY }} install | |
| # Start Metro in the background | |
| E2E=true yarn --cwd apps/${{ env.WORKING_DIRECTORY }} start &> output.log & | |
| # Build the Android app | |
| cd apps/${{ env.WORKING_DIRECTORY }}/android && ./gradlew assembleDebug | |
| # 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 E2E tests | |
| yarn e2e | |
| - name: Upload test report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: report | |
| path: | | |
| report.html | |
| jest-html-reporters-attach/ |