[UPD] TESTS - workflow - Try to change the build from prod to staging #23
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 Tests | |
| env: | |
| EXPO_PUBLIC_API_URL: ${{ vars.API_URL }} | |
| EXPO_PUBLIC_AUTH_URL: ${{ vars.AUTH_URL }} | |
| EXPO_PUBLIC_OPENAPI_URL: ${{ vars.OPENAPI_URL }} | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [test/e2e, test/e2e/**] | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| jobs: | |
| build-apk: | |
| name: π¨ Build APK | |
| if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' || github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Free disk space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| android: false | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| swap-storage: true | |
| - name: π Setup repo | |
| uses: actions/checkout@v4 | |
| - name: π Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: π Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: 'pnpm' | |
| - name: π Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: π¦ Install dependencies | |
| run: pnpm install | |
| - name: π Generate debug keystore | |
| run: | | |
| mkdir -p $HOME/.android | |
| keytool -genkeypair -v \ | |
| -keystore $HOME/.android/debug.keystore \ | |
| -storepass android \ | |
| -alias androiddebugkey \ | |
| -keypass android \ | |
| -keyalg RSA \ | |
| -keysize 2048 \ | |
| -validity 10000 \ | |
| -dname "CN=Android Debug,O=Android,C=US" | |
| - name: π¨ Prebuild & Build APK (release) | |
| env: | |
| JAVA_TOOL_OPTIONS: "-XX:MaxMetaspaceSize=2048m -Dfile.encoding=UTF-8" | |
| GRADLE_OPTS: "-Xmx4096m -XX:MaxMetaspaceSize=2048m -Dfile.encoding=UTF-8" | |
| run: | | |
| APP_ENV=staging npx expo prebuild --clean --platform android | |
| cd android && ./gradlew assembleRelease --no-daemon \ | |
| -PreactNativeArchitectures=x86_64 \ | |
| -x lintVitalRelease \ | |
| --max-workers=2 \ | |
| -Pkotlin.compiler.execution.strategy=in-process \ | |
| -Pandroid.injected.signing.store.file=$HOME/.android/debug.keystore \ | |
| -Pandroid.injected.signing.store.password=android \ | |
| -Pandroid.injected.signing.key.alias=androiddebugkey \ | |
| -Pandroid.injected.signing.key.password=android | |
| - name: π€ Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-release | |
| path: android/app/build/outputs/apk/release/app-release.apk | |
| retention-days: 1 | |
| e2e-full: | |
| name: π Full E2E Tests | |
| needs: build-apk | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Enable KVM | |
| run: sudo chmod 777 /dev/kvm | |
| - name: π Setup repo | |
| uses: actions/checkout@v4 | |
| - name: π Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: π Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: 'pnpm' | |
| - name: π¦ Install dependencies | |
| run: pnpm install | |
| - name: π₯ Download APK artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: app-release | |
| path: android/app/build/outputs/apk/release/ | |
| - name: π Install Maestro | |
| run: curl -Ls "https://get.maestro.mobile.dev" | bash && echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| - name: π€ Run full E2E tests on emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 34 | |
| arch: x86_64 | |
| pre-emulator-launch-script: | | |
| echo "persist.sys.locale=en-US" >> $HOME/.android/avd/test.avd/config.ini | |
| echo "persist.sys.language=en" >> $HOME/.android/avd/test.avd/config.ini | |
| echo "persist.sys.country=US" >> $HOME/.android/avd/test.avd/config.ini | |
| script: | | |
| adb kill-server | |
| adb start-server | |
| adb wait-for-device | |
| sleep 5 | |
| adb uninstall com.bearstudio.startuinative.staging || true | |
| adb install android/app/build/outputs/apk/release/app-release.apk | |
| pnpm test:e2e |