fix: portal before host (#36) #149
  
    
      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: 🤖 Test Android | |
| on: | |
| pull_request: | |
| paths: | |
| - ".github/workflows/android-e2e-test.yml" | |
| - "package.json" | |
| - "yarn.lock" | |
| - "android/**" | |
| - "example/**" | |
| - "e2e/**" | |
| - "src/**" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/android-e2e-test.yml" | |
| - "package.json" | |
| - "yarn.lock" | |
| - "android/**" | |
| - "example/**" | |
| - "e2e/**" | |
| - "src/**" | |
| jobs: | |
| build-android: | |
| name: 🏗️ Build E2E apk | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: android-e2e-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "microsoft" | |
| java-version: "17" | |
| - name: Restore Gradle cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Set app active arch | |
| run: sed -i.bak 's/reactNativeArchitectures=.*/reactNativeArchitectures=x86_64/' example/android/gradle.properties | |
| - name: Run Gradle Build for example/android/ | |
| run: cd example/android && ./gradlew assembleRelease --build-cache && cd ../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-e2e-apk | |
| path: example/android/app/build/outputs/apk/** | |
| e2e-test: | |
| name: ⚙️ Automated test cases | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| WORKING_DIRECTORY: example | |
| concurrency: | |
| group: android-e2e-${{ matrix.devices.api }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| strategy: | |
| matrix: | |
| devices: [{ api: 31, target: google_apis }] | |
| needs: build-android | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Download a single artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-e2e-apk | |
| path: example/android/app/build/outputs/apk/ | |
| - name: Install Maestro | |
| run: | | |
| curl -fsSL "https://get.maestro.mobile.dev" | bash | |
| echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| export MAESTRO_DRIVER_STARTUP_TIMEOUT=600000 | |
| - name: Enable KVM group perms | |
| 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-${{ matrix.devices.api }}-${{ matrix.devices.target }} | |
| - name: Prepare snapshot engine | |
| run: cd e2e && npm install | |
| - name: Start snapshot engine (background) | |
| shell: bash | |
| run: | | |
| node e2e/snapshot-engine.js > server.log 2>&1 & | |
| echo $! > server.pid | |
| - name: Run emulator and tests | |
| uses: reactivecircus/[email protected] | |
| with: | |
| api-level: ${{ matrix.devices.api }} | |
| target: ${{ matrix.devices.target }} | |
| profile: pixel_2 | |
| ram-size: "4096M" | |
| disk-size: "10G" | |
| disable-animations: false | |
| avd-name: e2e_emulator_${{ matrix.devices.api }} | |
| arch: x86_64 | |
| script: | | |
| adb install -r -d -t example/android/app/build/outputs/apk/release/app-release.apk | |
| maestro --platform android test -e DEVICE="e2e_emulator_31" e2e/flows/* --format html ./e2e/reports/debug --debug-output ./e2e/reports/debug --flatten-debug-output | |
| - name: Show snapshot engine logs | |
| if: always() | |
| run: | | |
| echo "===== FULL server.log =====" | |
| cat server.log || true | |
| - name: Kill snapshot engine | |
| if: always() | |
| shell: bash | |
| run: | | |
| if [ -f server.pid ]; then | |
| kill $(cat server.pid) || true | |
| rm -f server.pid | |
| fi | |
| - name: Upload test report | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: ./e2e/reports | |
| name: e2e-report-android |