|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: Android Testsuite |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + paths-ignore: |
| 23 | + - '**.md' |
| 24 | + - 'LICENSE' |
| 25 | + - '.eslint*' |
| 26 | + pull_request: |
| 27 | + paths-ignore: |
| 28 | + - '**.md' |
| 29 | + - 'LICENSE' |
| 30 | + - '.eslint*' |
| 31 | + |
| 32 | +jobs: |
| 33 | + test: |
| 34 | + name: Android ${{ matrix.versions.android }} Test |
| 35 | + runs-on: macos-latest |
| 36 | + |
| 37 | + # hoist configurations to top that are expected to be updated |
| 38 | + env: |
| 39 | + # Storing a copy of the repo |
| 40 | + repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }} |
| 41 | + |
| 42 | + node-version: 16 |
| 43 | + |
| 44 | + # These are the default Java configurations used by most tests. |
| 45 | + # To customize these options, add "java-distro" or "java-version" to the strategy matrix with its overriding value. |
| 46 | + default_java-distro: adopt |
| 47 | + default_java-version: 8 |
| 48 | + |
| 49 | + # These are the default Android System Image configurations used by most tests. |
| 50 | + # To customize these options, add "system-image-arch" or "system-image-target" to the strategy matrix with its overriding value. |
| 51 | + default_system-image-arch: x86_64 |
| 52 | + default_system-image-target: google_apis # Most system images have a google_api option. Set this as default. |
| 53 | + |
| 54 | + # configurations for each testing strategy (test matrix) |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + versions: |
| 58 | + - android: 5.1 |
| 59 | + android-api: 22 |
| 60 | + |
| 61 | + - android: 6 |
| 62 | + android-api: 23 |
| 63 | + |
| 64 | + - android: 7 |
| 65 | + android-api: 24 |
| 66 | + |
| 67 | + - android: 7.1 |
| 68 | + android-api: 25 |
| 69 | + |
| 70 | + - android: 8 |
| 71 | + android-api: 26 |
| 72 | + |
| 73 | + - android: 8.1 |
| 74 | + android-api: 27 |
| 75 | + system-image-target: default |
| 76 | + |
| 77 | + - android: 9 |
| 78 | + android-api: 28 |
| 79 | + |
| 80 | + - android: 10 |
| 81 | + android-api: 29 |
| 82 | + |
| 83 | + - android: 11 |
| 84 | + android-api: 30 |
| 85 | + java-version: 11 |
| 86 | + |
| 87 | + timeout-minutes: 60 |
| 88 | + |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v2 |
| 91 | + - uses: actions/setup-node@v2 |
| 92 | + with: |
| 93 | + node-version: ${{ env.node-version }} |
| 94 | + - uses: actions/setup-java@v2 |
| 95 | + env: |
| 96 | + java-version: ${{ matrix.versions.java-version == '' && env.default_java-version || matrix.versions.java-version }} |
| 97 | + java-distro: ${{ matrix.versions.java-distro == '' && env.default_java-distro || matrix.versions.java-distro }} |
| 98 | + with: |
| 99 | + distribution: ${{ env.java-distro }} |
| 100 | + java-version: ${{ env.java-version }} |
| 101 | + |
| 102 | + - name: Run Environment Information |
| 103 | + run: | |
| 104 | + node --version |
| 105 | + npm --version |
| 106 | + java -version |
| 107 | +
|
| 108 | + - name: Run npm install |
| 109 | + run: | |
| 110 | + export PATH="/usr/local/lib/android/sdk/platform-tools":$PATH |
| 111 | + export JAVA_HOME=$JAVA_HOME_11_X64 |
| 112 | + npm i -g cordova@latest |
| 113 | + npm ci |
| 114 | +
|
| 115 | + - name: Run paramedic install |
| 116 | + if: ${{ endswith(env.repo, '/cordova-paramedic') != true }} |
| 117 | + run: npm i -g github:apache/cordova-paramedic |
| 118 | + |
| 119 | + - uses: reactivecircus/android-emulator-runner@5de26e4bd23bf523e8a4b7f077df8bfb8e52b50e |
| 120 | + env: |
| 121 | + system-image-arch: ${{ matrix.versions.system-image-arch == '' && env.default_system-image-arch || matrix.versions.system-image-arch }} |
| 122 | + system-image-target: ${{ matrix.versions.system-image-target == '' && env.default_system-image-target || matrix.versions.system-image-target }} |
| 123 | + with: |
| 124 | + api-level: ${{ matrix.versions.android-api }} |
| 125 | + target: ${{ env.system-image-target }} |
| 126 | + arch: ${{ env.system-image-arch }} |
| 127 | + force-avd-creation: false |
| 128 | + disable-animations: false |
| 129 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim |
| 130 | + script: echo "Pregenerate the AVD before running Paramedic" |
| 131 | + |
| 132 | + - name: Run paramedic tests |
| 133 | + uses: reactivecircus/android-emulator-runner@5de26e4bd23bf523e8a4b7f077df8bfb8e52b50e |
| 134 | + env: |
| 135 | + system-image-arch: ${{ matrix.versions.system-image-arch == '' && env.default_system-image-arch || matrix.versions.system-image-arch }} |
| 136 | + system-image-target: ${{ matrix.versions.system-image-target == '' && env.default_system-image-target || matrix.versions.system-image-target }} |
| 137 | + test_config: 'android-${{ matrix.versions.android }}.config.json' |
| 138 | + # Generally, this should automatically work for cordova-paramedic & plugins. If the path is unique, this can be manually changed. |
| 139 | + test_plugin_path: ${{ endswith(env.repo, '/cordova-paramedic') && './spec/testable-plugin/' || './' }} |
| 140 | + paramedic: ${{ endswith(env.repo, '/cordova-paramedic') && 'node main.js' || 'cordova-paramedic' }} |
| 141 | + with: |
| 142 | + api-level: ${{ matrix.versions.android-api }} |
| 143 | + target: ${{ env.system-image-target }} |
| 144 | + arch: ${{ env.system-image-arch }} |
| 145 | + force-avd-creation: false |
| 146 | + disable-animations: false |
| 147 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim |
| 148 | + script: ${{ env.paramedic }} --config ./pr/local/${{ env.test_config }} --plugin ${{ env.test_plugin_path }} |
0 commit comments