diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml new file mode 100644 index 0000000..3be7762 --- /dev/null +++ b/.github/workflows/e2e-tests.yml @@ -0,0 +1,134 @@ +name: E2E Tests + +on: + pull_request: + +jobs: + e2e-test: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Free up disk space + run: | + echo "Disk space before cleanup:" + df -h + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + sudo docker image prune --all --force + echo "Disk space after cleanup:" + df -h + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + + - name: Install SDK dependencies + run: npm install + + - name: Build SDK + run: npm run build + + - name: Install example app dependencies + working-directory: ./example + run: npm install + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "17" + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Cache Gradle + 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: Install Maestro CLI + run: | + curl -Ls "https://get.maestro.mobile.dev" | bash + echo "$HOME/.maestro/bin" >> $GITHUB_PATH + + - name: Verify Maestro installation + run: maestro --version + + - 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: Cache AVD + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-31 + + - 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: 31 + arch: x86_64 + target: google_apis + profile: pixel_6 + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: echo "Generated AVD snapshot for caching." + + - name: Build Android app + working-directory: ./example + run: | + npx expo prebuild --platform android + cd android + ./gradlew assembleDebug + ls -la app/build/outputs/apk/debug/ + + - name: Run Maestro tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 31 + arch: x86_64 + target: google_apis + profile: pixel_6 + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: | + adb install example/android/app/build/outputs/apk/debug/app-debug.apk + mkdir -p maestro-output + maestro test ./example/maestro/ --format junit --output maestro-results.xml || true + maestro record ./example/maestro/ --output maestro-output/ || maestro test ./example/maestro/ + test -f maestro-results.xml && mv maestro-results.xml example/ || echo "No results file" + test -d maestro-output && mv maestro-output example/ || echo "No maestro output directory" + ls -la example/ + + - name: Upload Maestro test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: maestro-test-results + path: | + example/maestro-results.xml + example/maestro-output/ + ~/.maestro/tests/ + retention-days: 7 + if-no-files-found: warn diff --git a/example/app.json b/example/app.json index 521138a..f734028 100644 --- a/example/app.json +++ b/example/app.json @@ -45,6 +45,13 @@ "experiments": { "typedRoutes": true, "reactCompiler": true - } + }, + "extra": { + "router": {}, + "eas": { + "projectId": "9c680ba9-b514-4d3e-9b75-6d7e7baf0e3e" + } + }, + "owner": "mxwidgetsdk" } }