Fix Android SDK versions to match project requirements #22
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: CI/CD with BrowserStack | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| env: | |
| NODE_VERSION: '20' | |
| JAVA_VERSION: '17' | |
| jobs: | |
| test: | |
| name: Build & Test on BrowserStack | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 📦 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: ☕ Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ env.JAVA_VERSION }} | |
| - name: 📱 Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| with: | |
| packages: | | |
| platform-tools | |
| platforms;android-36 | |
| build-tools;36.0.0 | |
| ndk;27.1.12297006 | |
| accept-android-sdk-licenses: true | |
| - name: 📥 Install dependencies | |
| run: npm ci | |
| - name: 💾 Cache Gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| android/.gradle | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: 🔨 Build Android APK | |
| timeout-minutes: 40 | |
| run: | | |
| cd android | |
| chmod +x gradlew | |
| echo "=== Build Configuration ===" | |
| echo "ANDROID_HOME: $ANDROID_HOME" | |
| echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT" | |
| echo "Building for x86_64 architecture only" | |
| echo "=== Pre-build: Check NDK ===" | |
| if [ -d "$ANDROID_HOME/ndk/27.1.12297006" ]; then | |
| echo "NDK already installed" | |
| else | |
| echo "NDK will be installed during build (this may take 10-15 minutes)" | |
| fi | |
| echo "=== Starting Gradle build ===" | |
| echo "This may take 30-40 minutes on first build due to NDK installation" | |
| echo "Progress will be shown below..." | |
| # Run with info logging to see progress | |
| ./gradlew assembleDebug \ | |
| --no-daemon \ | |
| --info \ | |
| -PreactNativeArchitectures=x86_64 \ | |
| --console=plain 2>&1 | tee build.log || { | |
| echo "=== Build failed ===" | |
| echo "Last 50 lines of build log:" | |
| tail -50 build.log | |
| exit 1 | |
| } | |
| echo "=== Build completed ===" | |
| if [ ! -f "app/build/outputs/apk/debug/app-debug.apk" ]; then | |
| echo "ERROR: APK not found after build!" | |
| ls -la app/build/outputs/apk/debug/ || echo "Output directory doesn't exist" | |
| exit 1 | |
| fi | |
| echo "APK found:" | |
| ls -lh app/build/outputs/apk/debug/ | |
| cd .. | |
| env: | |
| ANDROID_HOME: ${{ env.ANDROID_HOME }} | |
| ANDROID_SDK_ROOT: ${{ env.ANDROID_SDK_ROOT }} | |
| GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.console=plain" | |
| - name: 🧪 Run E2E Tests on BrowserStack | |
| run: npm run test:e2e:browserstack:all | |
| env: | |
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
| BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
| BROWSERSTACK_APP_ID: ${{ secrets.BROWSERSTACK_APP_ID }} | |
| - name: 📊 Generate Allure Report | |
| if: always() | |
| run: | | |
| npx allure-commandline generate allure-results --clean -o allure-report || echo "Allure report generation skipped (no results)" | |
| - name: 📤 Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| allure-results/ | |
| test-results/ | |
| screenshots/ | |
| retention-days: 7 | |
| if-no-files-found: ignore | |