CI: Add blank app fixture runner and appium tests #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: Test Blank React Native app | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| workflow_dispatch: | |
| inputs: | |
| platform: | |
| description: 'Project Type' | |
| required: true | |
| type: choice | |
| options: | |
| - 'React Native' | |
| - 'Expo' | |
| default: 'React Native' | |
| version: | |
| description: 'Version (RN e.g. 0.80.2 OR Expo SDK e.g. 52.0.0)' | |
| required: true | |
| default: '0.80.2' | |
| run_ios: | |
| description: 'Test iOS' | |
| type: boolean | |
| default: true | |
| run_android: | |
| description: 'Test Android' | |
| type: boolean | |
| default: true | |
| permissions: | |
| contents: read | |
| env: | |
| NODE_VERSION: 20 | |
| APP_DIR: 'tested_app' | |
| jobs: | |
| # ==================================================== | |
| # JOB 1: Setup Fixture | |
| # ==================================================== | |
| setup: | |
| name: Setup Fixture | |
| runs-on: ubuntu-latest | |
| outputs: | |
| platform: ${{ steps.vars.outputs.platform }} | |
| run_ios: ${{ steps.vars.outputs.run_ios }} | |
| run_android: ${{ steps.vars.outputs.run_android }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Resolve Inputs | |
| id: vars | |
| shell: bash | |
| run: | | |
| PLATFORM="${{ github.event.inputs.platform || 'React Native' }}" | |
| RUN_IOS="${{ github.event.inputs.run_ios || 'true' }}" | |
| RUN_ANDROID="${{ github.event.inputs.run_android || 'true' }}" | |
| echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT" | |
| echo "run_ios=$RUN_IOS" >> "$GITHUB_OUTPUT" | |
| echo "run_android=$RUN_ANDROID" >> "$GITHUB_OUTPUT" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'yarn' | |
| - name: Build Library | |
| run: | | |
| yarn | |
| yarn prepare | |
| rm -f adyen-react-native-*.tgz | |
| npm pack | |
| mv adyen-react-native-*.tgz adyen-react-native.tgz | |
| - name: Generate Fixture | |
| run: | | |
| VERSION="${{ github.event.inputs.version || '0.80.2' }}" | |
| bash ./e2e-tests/scripts/setup.sh ${{ env.APP_DIR }} "${{ steps.vars.outputs.platform }}" "$VERSION" | |
| - name: Upload Fixture | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fixture | |
| path: ${{ env.APP_DIR }} | |
| retention-days: 1 | |
| # ==================================================== | |
| # JOB 2: iOS Build & Test | |
| # ==================================================== | |
| ios-test: | |
| name: iOS Test | |
| needs: setup | |
| if: ${{ needs.setup.outputs.run_ios == 'true' }} | |
| runs-on: macos-15 | |
| timeout-minutes: 45 | |
| env: | |
| ADYEN_CLIENT_KEY: ${{ secrets.ADYEN_CLIENT_KEY }} | |
| ADYEN_PUBLIC_KEY: ${{ secrets.ADYEN_PUBLIC_KEY }} | |
| IOS_DEVICE_NAME: 'iPhone 17' | |
| IOS_VERSION: '26.1' | |
| RUBY_VERSION: '3.2' | |
| steps: | |
| - name: Download Fixture | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: fixture | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup Ruby & Cocoapods | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ env.RUBY_VERSION }} | |
| - name: Install Dependencies | |
| run: | | |
| yarn install | |
| - name: Setup Appium | |
| run: | | |
| npm i -g appium | |
| appium driver install xcuitest | |
| - name: Start Appium | |
| run: bash ./start_appium.sh 4723 90 | |
| - name: Inject Secrets | |
| if: ${{ env.ADYEN_CLIENT_KEY != '' && env.ADYEN_PUBLIC_KEY != '' }} | |
| run: | | |
| bash ./inject_secrets.sh | |
| - name: Run iOS Test | |
| run: | | |
| bash ./build-ios.sh "${{ needs.setup.outputs.platform }}" "${{ env.IOS_DEVICE_NAME }}" "${{ env.IOS_VERSION }}" | |
| - name: Upload Appium Failure Screenshot (iOS) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium_failure_ios | |
| path: appium_failure.png | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| - name: Upload Appium Page Source (iOS) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium_page_source_ios | |
| path: appium_page_source.xml | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| # ==================================================== | |
| # JOB 3: Android Build & Test | |
| # ==================================================== | |
| android-test: | |
| name: Android Test | |
| needs: setup | |
| if: ${{ needs.setup.outputs.run_android == 'true' }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 45 | |
| env: | |
| ADYEN_CLIENT_KEY: ${{ secrets.ADYEN_CLIENT_KEY }} | |
| ADYEN_PUBLIC_KEY: ${{ secrets.ADYEN_PUBLIC_KEY }} | |
| ANDROID_API_LEVEL: 35 | |
| steps: | |
| - name: Checkout Actions | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: .github/actions | |
| sparse-checkout-cone-mode: false | |
| - name: Download Fixture | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: fixture | |
| - name: Setup Android Emulator | |
| uses: ./.github/actions/setup-android-emulator | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| android-api-level: ${{ env.ANDROID_API_LEVEL }} | |
| java-version: ${{ env.JAVA_VERSION }} | |
| - name: Install Dependencies | |
| run: | | |
| yarn install | |
| - name: Setup Appium | |
| run: | | |
| npm i -g appium | |
| appium driver install uiautomator2 | |
| - name: Start Appium | |
| run: bash ./start_appium.sh 4723 30 | |
| - name: Inject Secrets | |
| if: ${{ env.ADYEN_CLIENT_KEY != '' && env.ADYEN_PUBLIC_KEY != '' }} | |
| run: | | |
| bash ./inject_secrets.sh | |
| - name: Run Android Test | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ env.ANDROID_API_LEVEL }} | |
| target: google_apis | |
| arch: x86_64 | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| script: | | |
| bash ./build-android.sh "${{ needs.setup.outputs.platform }}" | |
| - name: Upload Appium Failure Screenshot (Android) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium_failure_android | |
| path: appium_failure.png | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| - name: Upload Appium Page Source (Android) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium_page_source_android | |
| path: appium_page_source.xml | |
| if-no-files-found: ignore | |
| retention-days: 1 |