|
14 | 14 | - 'docs/**'
|
15 | 15 | - '*.md'
|
16 | 16 |
|
| 17 | +env: |
| 18 | + ANDROID_SDK_VERSION: 28 |
| 19 | + ANDROID_EMU_NAME: test |
| 20 | + XCODE_VERSION: 14.2 |
| 21 | + IOS_DEVICE_NAME: iPhone 12 |
| 22 | + IOS_PLATFORM_VERSION: 16.2 |
| 23 | + |
17 | 24 | jobs:
|
18 | 25 | build:
|
19 | 26 |
|
20 |
| - runs-on: macOS-latest |
21 |
| - |
22 | 27 | strategy:
|
23 | 28 | matrix:
|
24 |
| - java: [ 8, 11, 17 ] |
| 29 | + include: |
| 30 | + - java: 8 |
| 31 | + platform: macos-latest |
| 32 | + e2e-tests: android |
| 33 | + - java: 11 |
| 34 | + platform: macos-12 |
| 35 | + e2e-tests: ios |
| 36 | + - java: 17 |
| 37 | + platform: ubuntu-latest |
| 38 | + fail-fast: false |
| 39 | + |
| 40 | + runs-on: ${{ matrix.platform }} |
25 | 41 |
|
26 |
| - name: JDK ${{ matrix.java }} |
| 42 | + name: JDK ${{ matrix.java }} - ${{ matrix.platform }} |
27 | 43 | steps:
|
28 | 44 | - uses: actions/checkout@v3
|
| 45 | + |
29 | 46 | - name: Set up JDK ${{ matrix.java }}
|
30 | 47 | uses: actions/setup-java@v3
|
31 | 48 | with:
|
32 | 49 | distribution: 'zulu'
|
33 | 50 | java-version: ${{ matrix.java }}
|
34 | 51 | cache: 'gradle'
|
| 52 | + |
35 | 53 | - name: Build with Gradle
|
36 | 54 | run: ./gradlew clean build
|
| 55 | + |
| 56 | + - name: Install Node.js |
| 57 | + if: ${{ matrix.e2e-tests == 'android' || matrix.e2e-tests == 'ios' }} |
| 58 | + uses: actions/setup-node@v3 |
| 59 | + with: |
| 60 | + node-version: 'lts/*' |
| 61 | + |
| 62 | + - name: Install Appium |
| 63 | + if: matrix.e2e-tests == 'android' || matrix.e2e-tests == 'ios' |
| 64 | + run: npm install -g appium@next |
| 65 | + |
| 66 | + - name: Install UIA2 driver |
| 67 | + if: matrix.e2e-tests == 'android' |
| 68 | + run: appium driver install uiautomator2 |
| 69 | + |
| 70 | + - name: AVD cache |
| 71 | + if: matrix.e2e-tests == 'android' |
| 72 | + uses: actions/cache@v3 |
| 73 | + id: avd-cache |
| 74 | + with: |
| 75 | + path: | |
| 76 | + ~/.android/avd/* |
| 77 | + ~/.android/adb* |
| 78 | + key: avd-${{ env.ANDROID_SDK_VERSION }} |
| 79 | + |
| 80 | + - name: Generate AVD snapshot for caching |
| 81 | + if: matrix.e2e-tests == 'android' && steps.avd-cache.outputs.cache-hit != 'true' |
| 82 | + uses: reactivecircus/android-emulator-runner@v2 |
| 83 | + with: |
| 84 | + api-level: ${{ env.ANDROID_SDK_VERSION }} |
| 85 | + avd-name: ${{ env.ANDROID_EMU_NAME }} |
| 86 | + force-avd-creation: false |
| 87 | + script: echo "Generated AVD snapshot for caching." |
| 88 | + |
| 89 | + - name: Run Android E2E tests |
| 90 | + if: matrix.e2e-tests == 'android' |
| 91 | + uses: reactivecircus/android-emulator-runner@v2 |
| 92 | + with: |
| 93 | + api-level: ${{ env.ANDROID_SDK_VERSION }} |
| 94 | + avd-name: ${{ env.ANDROID_EMU_NAME }} |
| 95 | + force-avd-creation: false |
| 96 | + emulator-options: -no-snapshot -delay-adb |
| 97 | + script: ./gradlew uiAutomationTest |
| 98 | + |
| 99 | + - name: Install XCUITest driver |
| 100 | + if: matrix.e2e-tests == 'ios' |
| 101 | + run: appium driver install xcuitest |
| 102 | + |
| 103 | + - name: Prebuild XCUITest driver |
| 104 | + if: matrix.e2e-tests == 'ios' |
| 105 | + run: appium driver run xcuitest build-wda |
| 106 | + |
| 107 | + - name: Select Xcode |
| 108 | + if: matrix.e2e-tests == 'ios' |
| 109 | + uses: maxim-lobanov/setup-xcode@v1 |
| 110 | + with: |
| 111 | + xcode-version: "${{ env.XCODE_VERSION }}" |
| 112 | + |
| 113 | + - name: Prepare iOS simulator |
| 114 | + if: matrix.e2e-tests == 'ios' |
| 115 | + run: | |
| 116 | + xcrun simctl list |
| 117 | + target_sim_id=$(xcrun simctl list devices available | grep "$IOS_DEVICE_NAME (" | cut -d "(" -f2 | cut -d ")" -f1) |
| 118 | + open -Fn "/Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Applications/Simulator.app" |
| 119 | + xcrun simctl bootstatus $target_sim_id -b |
| 120 | +
|
| 121 | + - name: Run iOS E2E tests |
| 122 | + if: matrix.e2e-tests == 'ios' |
| 123 | + run: ./gradlew xcuiTest |
0 commit comments