From d059f345e6e5caab37a7ea09261e4fc0a655c17b Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Thu, 21 Oct 2021 22:49:05 +0200 Subject: [PATCH 1/6] (ci): test actions from official apache plugins --- .github/workflows/android.yml | 148 ++++++++++++++++++++++++++++++++++ .github/workflows/ios.yml | 88 ++++++++++++++++++++ .github/workflows/lint.yml | 56 +++++++++++++ 3 files changed, 292 insertions(+) create mode 100644 .github/workflows/android.yml create mode 100644 .github/workflows/ios.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..806baeb --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,148 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Android Testsuite + +on: + push: + paths-ignore: + - '**.md' + - 'LICENSE' + - '.eslint*' + pull_request: + paths-ignore: + - '**.md' + - 'LICENSE' + - '.eslint*' + +jobs: + test: + name: Android ${{ matrix.versions.android }} Test + runs-on: macos-latest + + # hoist configurations to top that are expected to be updated + env: + # Storing a copy of the repo + repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + + node-version: 16 + + # These are the default Java configurations used by most tests. + # To customize these options, add "java-distro" or "java-version" to the strategy matrix with its overriding value. + default_java-distro: adopt + default_java-version: 8 + + # These are the default Android System Image configurations used by most tests. + # To customize these options, add "system-image-arch" or "system-image-target" to the strategy matrix with its overriding value. + default_system-image-arch: x86_64 + default_system-image-target: google_apis # Most system images have a google_api option. Set this as default. + + # configurations for each testing strategy (test matrix) + strategy: + matrix: + versions: + - android: 5.1 + android-api: 22 + + - android: 6 + android-api: 23 + + - android: 7 + android-api: 24 + + - android: 7.1 + android-api: 25 + + - android: 8 + android-api: 26 + + - android: 8.1 + android-api: 27 + system-image-target: default + + - android: 9 + android-api: 28 + + - android: 10 + android-api: 29 + + - android: 11 + android-api: 30 + java-version: 11 + + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.node-version }} + - uses: actions/setup-java@v2 + env: + java-version: ${{ matrix.versions.java-version == '' && env.default_java-version || matrix.versions.java-version }} + java-distro: ${{ matrix.versions.java-distro == '' && env.default_java-distro || matrix.versions.java-distro }} + with: + distribution: ${{ env.java-distro }} + java-version: ${{ env.java-version }} + + - name: Run Environment Information + run: | + node --version + npm --version + java -version + + - name: Run npm install + run: | + export PATH="/usr/local/lib/android/sdk/platform-tools":$PATH + export JAVA_HOME=$JAVA_HOME_11_X64 + npm i -g cordova@latest + npm ci + + - name: Run paramedic install + if: ${{ endswith(env.repo, '/cordova-paramedic') != true }} + run: npm i -g github:apache/cordova-paramedic + + - uses: reactivecircus/android-emulator-runner@5de26e4bd23bf523e8a4b7f077df8bfb8e52b50e + env: + system-image-arch: ${{ matrix.versions.system-image-arch == '' && env.default_system-image-arch || matrix.versions.system-image-arch }} + system-image-target: ${{ matrix.versions.system-image-target == '' && env.default_system-image-target || matrix.versions.system-image-target }} + with: + api-level: ${{ matrix.versions.android-api }} + target: ${{ env.system-image-target }} + arch: ${{ env.system-image-arch }} + force-avd-creation: false + disable-animations: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim + script: echo "Pregenerate the AVD before running Paramedic" + + - name: Run paramedic tests + uses: reactivecircus/android-emulator-runner@5de26e4bd23bf523e8a4b7f077df8bfb8e52b50e + env: + system-image-arch: ${{ matrix.versions.system-image-arch == '' && env.default_system-image-arch || matrix.versions.system-image-arch }} + system-image-target: ${{ matrix.versions.system-image-target == '' && env.default_system-image-target || matrix.versions.system-image-target }} + test_config: 'android-${{ matrix.versions.android }}.config.json' + # Generally, this should automatically work for cordova-paramedic & plugins. If the path is unique, this can be manually changed. + test_plugin_path: ${{ endswith(env.repo, '/cordova-paramedic') && './spec/testable-plugin/' || './' }} + paramedic: ${{ endswith(env.repo, '/cordova-paramedic') && 'node main.js' || 'cordova-paramedic' }} + with: + api-level: ${{ matrix.versions.android-api }} + target: ${{ env.system-image-target }} + arch: ${{ env.system-image-arch }} + force-avd-creation: false + disable-animations: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim + script: ${{ env.paramedic }} --config ./pr/local/${{ env.test_config }} --plugin ${{ env.test_plugin_path }} diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml new file mode 100644 index 0000000..47f83e4 --- /dev/null +++ b/.github/workflows/ios.yml @@ -0,0 +1,88 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: iOS Testsuite + +on: + push: + paths-ignore: + - '**.md' + - 'LICENSE' + - '.eslint*' + pull_request: + paths-ignore: + - '**.md' + - 'LICENSE' + - '.eslint*' + +jobs: + test: + name: iOS ${{ matrix.versions.ios-version }} Test + runs-on: macos-latest + + # hoist configurations to top that are expected to be updated + env: + # Storing a copy of the repo + repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + + node-version: 16 + + # > Starting April 26, 2021, all iOS and iPadOS apps submitted to the App Store must be built with Xcode 12 and the iOS 14 SDK. + # Because of Apple's requirement, listed above, We will only be using the latest Xcode release for testing. + # To customize these options, add "xcode-version" to the strategy matrix with its overriding value. + default_xcode-version: latest-stable + + strategy: + matrix: + versions: + - ios-version: 12.x + - ios-version: 13.x + - ios-version: 14.x + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.node-version }} + - uses: maxim-lobanov/setup-xcode@881be567d30efed8fb3f12b5099d68c3fb72aa3d + env: + xcode-version: ${{ matrix.versions.xcode-version == '' && env.default_xcode-version || matrix.versions.xcode-version }} + with: + xcode-version: ${{ env.xcode-version }} + + - name: Run Environment Information + run: | + node --version + npm --version + xcodebuild -version + + - name: Run npm install + run: | + npm i -g cordova@latest ios-deploy@latest + npm ci + + - name: Run paramedic install + if: ${{ endswith(env.repo, '/cordova-paramedic') != true }} + run: npm i -g github:apache/cordova-paramedic + + - name: Run paramedic tests + env: + test_config: 'ios-${{ matrix.versions.ios-version }}.config.json' + # Generally, this should automatically work for cordova-paramedic & plugins. If the path is unique, this can be manually changed. + test_plugin_path: ${{ endswith(env.repo, '/cordova-paramedic') && './spec/testable-plugin/' || './' }} + paramedic: ${{ endswith(env.repo, '/cordova-paramedic') && 'node main.js' || 'cordova-paramedic' }} + run: ${{ env.paramedic }} --config ./pr/local/${{ env.test_config }} --plugin ${{ env.test_plugin_path }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..26716d7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Lint Test + +on: + push: + paths: + - '**.js' + - '.eslint*' + - '.github/workflow/lint.yml' + pull_request: + paths: + - '**.js' + - '.eslint*' + - '.github/workflow/lint.yml' + +jobs: + test: + name: Lint Test + runs-on: ubuntu-latest + env: + node-version: 16 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.node-version }} + + - name: Run Environment Information + run: | + node --version + npm --version + + - name: Run npm install + run: | + npm ci + + - name: Run lint test + run: | + npm run lint From 764efb3109b97b4c24e4c3e8e583c70f69dc3ed2 Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Thu, 21 Oct 2021 22:53:00 +0200 Subject: [PATCH 2/6] test less versions --- .github/workflows/android.yml | 15 --------------- .github/workflows/ios.yml | 1 - 2 files changed, 16 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 806baeb..bada1f6 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -55,21 +55,6 @@ jobs: strategy: matrix: versions: - - android: 5.1 - android-api: 22 - - - android: 6 - android-api: 23 - - - android: 7 - android-api: 24 - - - android: 7.1 - android-api: 25 - - - android: 8 - android-api: 26 - - android: 8.1 android-api: 27 system-image-target: default diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 47f83e4..f8b4977 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -49,7 +49,6 @@ jobs: strategy: matrix: versions: - - ios-version: 12.x - ios-version: 13.x - ios-version: 14.x From 7c4d5f4a836fed6a18d3893c6f3a375e28460a62 Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Thu, 21 Oct 2021 22:55:12 +0200 Subject: [PATCH 3/6] use npm i instead of ci because we have package-lock ignored right now --- .github/workflows/android.yml | 2 +- .github/workflows/ios.yml | 2 +- .github/workflows/lint.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index bada1f6..fac0d3a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -95,7 +95,7 @@ jobs: export PATH="/usr/local/lib/android/sdk/platform-tools":$PATH export JAVA_HOME=$JAVA_HOME_11_X64 npm i -g cordova@latest - npm ci + npm i - name: Run paramedic install if: ${{ endswith(env.repo, '/cordova-paramedic') != true }} diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index f8b4977..0c6e121 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -72,7 +72,7 @@ jobs: - name: Run npm install run: | npm i -g cordova@latest ios-deploy@latest - npm ci + npm i - name: Run paramedic install if: ${{ endswith(env.repo, '/cordova-paramedic') != true }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 26716d7..fab9743 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -49,7 +49,7 @@ jobs: - name: Run npm install run: | - npm ci + npm i - name: Run lint test run: | From f7ea974983a36aaa2f2306268792e893c4425184 Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Thu, 21 Oct 2021 23:18:27 +0200 Subject: [PATCH 4/6] merge config for paramedic? --- plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.xml b/plugin.xml index be9d647..55d967b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -31,7 +31,7 @@ - + @@ -43,7 +43,7 @@ - + From bbfb5fd3378ebafbb3038075670711569dad1bdc Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Sat, 23 Oct 2021 09:31:21 +0200 Subject: [PATCH 5/6] Use --force for paramedic android --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index fac0d3a..097cbd3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -99,7 +99,7 @@ jobs: - name: Run paramedic install if: ${{ endswith(env.repo, '/cordova-paramedic') != true }} - run: npm i -g github:apache/cordova-paramedic + run: npm i -g github:NiklasMerz/cordova-paramedic#plugin-conflict - uses: reactivecircus/android-emulator-runner@5de26e4bd23bf523e8a4b7f077df8bfb8e52b50e env: From 5f21006ad177d82dcb672fbb93c313a5a4ac1acd Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Wed, 22 Dec 2021 10:13:30 +0100 Subject: [PATCH 6/6] Set Swift version in test --- tests/plugin.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/plugin.xml b/tests/plugin.xml index 0f1e62d..3c47dce 100644 --- a/tests/plugin.xml +++ b/tests/plugin.xml @@ -12,4 +12,6 @@ + +