You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2021/08/28 07:12:46 UTC
[cordova-paramedic] branch master updated: feat(gh-actions): add
workflow (#215)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git
The following commit(s) were added to refs/heads/master by this push:
new 95bb3b3 feat(gh-actions): add workflow (#215)
95bb3b3 is described below
commit 95bb3b31b3d3ed367576abdd87a4e564f870fcf4
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Sat Aug 28 16:12:39 2021 +0900
feat(gh-actions): add workflow (#215)
* ci(gh-actions): enable android, chrome, & ios workflow
* ci(gh-actions): update browser workflow
* ci(gh-actions): update android workflow
* add caching step
* hoist configurations
* update the step names
* feat(paramedic-plugin): add platform configs
* feat(android): dump AndroidMaifest & platfom config w/ paramedic-plugin cleanup
* fix(android): update build out maybe location list
* chore(paramedic-plugin): cleanup plugin package
* ci(gh-actions): correct android automation test name
* feat(android): auto fetch chromedriver_version
* fix(android): set automationName as Appium
* test(android): skip appium tests
* ci(gh-actions): remove android emulator-build & macos pinning
* ci(gh-actions): update android cache key
* ci(gh-actions): remove android cache step
* style(android): split path join
Co-authored-by: Tim Brust <ti...@sinnerschrader.com>
---
.github/workflows/android.yml | 81 +++++++++++++++++++++++++++++++++++
.github/workflows/chrome.yml | 45 +++++++++++++++++++
.github/workflows/ios.yml | 53 +++++++++++++++++++++++
conf/pr/local/android-11.config.json | 7 +++
conf/pr/local/android-5.1.config.json | 1 -
conf/pr/local/ios-11.4.config.json | 7 +++
lib/ParamedicApp.js | 24 ++++++++++-
lib/ParamedicTargetChooser.js | 4 +-
lib/appium/AppiumRunner.js | 2 +
lib/appium/helpers/wdHelper.js | 5 ++-
lib/paramedic.js | 2 +-
lib/utils/utilities.js | 11 +++--
paramedic-plugin/package.json | 9 ++--
paramedic-plugin/plugin.xml | 23 +++++++++-
14 files changed, 258 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
new file mode 100644
index 0000000..f3a6bb1
--- /dev/null
+++ b/.github/workflows/android.yml
@@ -0,0 +1,81 @@
+# 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, pull_request]
+
+jobs:
+ test:
+ name: Android Latest Test
+ runs-on: macos-latest
+
+ # hoist configurations to top that are expected to be updated
+ env:
+ node-version: 16
+ java-version: 11
+ java-distro: 'adopt'
+ android-api: 30
+
+ # E.g. android-11 from the file: ./pr/local/android-11.config.json
+ target-test: android-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
+ 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
+ npm ci
+
+ - uses: reactivecircus/android-emulator-runner@v2
+ with:
+ api-level: ${{ env.android-api }}
+ target: google_apis
+ arch: x86_64
+ 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@v2
+ with:
+ api-level: ${{ env.android-api }}
+ target: google_apis
+ arch: x86_64
+ force-avd-creation: false
+ disable-animations: false
+ emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
+ script: node main.js --config ./pr/local/${{ env.target-test }}.config.json --plugin ./spec/testable-plugin/
diff --git a/.github/workflows/chrome.yml b/.github/workflows/chrome.yml
new file mode 100644
index 0000000..f19e498
--- /dev/null
+++ b/.github/workflows/chrome.yml
@@ -0,0 +1,45 @@
+# 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: Chrome Testsuite
+
+on: [push, pull_request]
+
+jobs:
+ test:
+ name: Chrome Latest Test
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v2
+ with:
+ node-version: 16
+
+ - name: Install xvfb
+ run: sudo apt-get install xvfb
+
+ - name: Environment Information
+ run: |
+ node --version
+ npm --version
+
+ - name: npm install and test
+ run: |
+ npm i -g cordova
+ npm ci
+ xvfb-run --auto-servernum node main.js --config ./pr/local/browser.config.json --plugin ./spec/testable-plugin/
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
new file mode 100644
index 0000000..771e61c
--- /dev/null
+++ b/.github/workflows/ios.yml
@@ -0,0 +1,53 @@
+# 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, pull_request]
+
+jobs:
+ test:
+ name: iOS ${{ matrix.versions.ios }}
+ runs-on: macos-latest
+ strategy:
+ matrix:
+ versions:
+ - ios: 13.6
+ xcode: 11.6
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: maxim-lobanov/setup-xcode@v1.1
+ with:
+ xcode-version: ${{ matrix.versions.xcode }}
+
+ - name: Use Node.js 12
+ uses: actions/setup-node@v1
+ with:
+ node-version: 12
+
+ - name: Environment Information
+ run: |
+ node --version
+ npm --version
+
+ - name: npm install and test
+ run: |
+ npm i -g cordova ios-deploy
+ npm ci
+ node main.js --config ./pr/local/ios-13.6.config.json --plugin ./spec/testable-plugin/
diff --git a/conf/pr/local/android-11.config.json b/conf/pr/local/android-11.config.json
new file mode 100644
index 0000000..85b93ee
--- /dev/null
+++ b/conf/pr/local/android-11.config.json
@@ -0,0 +1,7 @@
+{
+ "platform": "android@nightly",
+ "action": "run",
+ "cleanUpAfterRun": true,
+ "verbose": true,
+ "skipAppiumTests": true
+}
diff --git a/conf/pr/local/android-5.1.config.json b/conf/pr/local/android-5.1.config.json
index 51ffab8..1bca536 100644
--- a/conf/pr/local/android-5.1.config.json
+++ b/conf/pr/local/android-5.1.config.json
@@ -2,6 +2,5 @@
"platform": "android@latest",
"action": "run",
"cleanUpAfterRun": true,
- "target": "api22",
"verbose": true
}
diff --git a/conf/pr/local/ios-11.4.config.json b/conf/pr/local/ios-11.4.config.json
new file mode 100644
index 0000000..27bbc9e
--- /dev/null
+++ b/conf/pr/local/ios-11.4.config.json
@@ -0,0 +1,7 @@
+{
+ "platform": "ios@latest",
+ "action": "run",
+ "cleanUpAfterRun": true,
+ "target": "iPhone-8, 11.4",
+ "verbose": true
+}
diff --git a/lib/ParamedicApp.js b/lib/ParamedicApp.js
index 7f70920..93364ba 100644
--- a/lib/ParamedicApp.js
+++ b/lib/ParamedicApp.js
@@ -59,7 +59,9 @@ class ParamedicApp {
this.installPlugins();
this.setUpStartPage();
return this.installPlatform()
- .then(() => this.checkPlatformRequirements());
+ .then(() => this.checkPlatformRequirements())
+ .then(() => this.checkDumpAndroidManifest())
+ .then(() => this.checkDumpAndroidConfigXml());
}
installPlugins () {
@@ -141,6 +143,26 @@ class ParamedicApp {
logger.info('cordova-paramedic: successfully finished checking the requirements for platform: ' + this.platformId);
});
}
+
+ checkDumpAndroidManifest () {
+ if (!this.isAndroid) return Q();
+
+ logger.normal('cordova-paramedic: start AndroidManifest.xml Dump');
+ return execPromise('cat ./platforms/android/app/src/main/AndroidManifest.xml')
+ .then(() => {
+ logger.normal('cordova-paramedic: end AndroidManifest.xml Dump');
+ });
+ }
+
+ checkDumpAndroidConfigXml () {
+ if (!this.isAndroid) return Q();
+
+ logger.normal('cordova-paramedic: start config.xml Dump');
+ return execPromise('cat ./platforms/android/app/src/main/res/xml/config.xml')
+ .then(() => {
+ logger.info('cordova-paramedic: end config.xml Dump');
+ });
+ }
}
module.exports = ParamedicApp;
diff --git a/lib/ParamedicTargetChooser.js b/lib/ParamedicTargetChooser.js
index a42dab1..2ffa36c 100644
--- a/lib/ParamedicTargetChooser.js
+++ b/lib/ParamedicTargetChooser.js
@@ -32,7 +32,7 @@ class ParamedicTargetChooser {
}
chooseTarget (emulator, target) {
- let targetObj = '';
+ let targetObj = Q();
switch (this.platform) {
case utilities.ANDROID:
@@ -59,7 +59,7 @@ class ParamedicTargetChooser {
if (target) {
logger.info('cordova-paramedic: Target defined as: ' + target);
- return { target };
+ return Q({ target });
}
return this.startAnAndroidEmulator(target).then(emulatorId => ({ target: emulatorId }));
diff --git a/lib/appium/AppiumRunner.js b/lib/appium/AppiumRunner.js
index d08b50a..905b8ad 100644
--- a/lib/appium/AppiumRunner.js
+++ b/lib/appium/AppiumRunner.js
@@ -161,6 +161,7 @@ class AppiumRunner {
// compose a command to run the Appium server
switch (this.options.platform) {
case utilities.ANDROID:
+ additionalArgs += ' --allow-insecure chromedriver_autodownload'
break;
case utilities.IOS:
@@ -339,6 +340,7 @@ function getPackagePath (options) {
case utilities.ANDROID:
let packagePath = null;
const maybePackagePaths = [
+ path.join(fullAppPath, 'platforms', 'android', 'app', 'build', 'outputs', 'apk', 'debug', 'app-debug.apk'),
path.join(fullAppPath, 'platforms', 'android', 'app', 'build', 'outputs', 'apk', 'android-debug.apk'),
path.join(fullAppPath, 'platforms', 'android', 'build', 'outputs', 'apk', 'debug', 'app-debug.apk')
];
diff --git a/lib/appium/helpers/wdHelper.js b/lib/appium/helpers/wdHelper.js
index 3d70c34..838a496 100644
--- a/lib/appium/helpers/wdHelper.js
+++ b/lib/appium/helpers/wdHelper.js
@@ -34,6 +34,7 @@ const { utilities } = require('../../utils');
module.exports.getDriver = function (platform) {
let normalizedPlatform;
+ let automationName;
let driverConfig = {};
let serverConfig = {};
let driver;
@@ -41,10 +42,12 @@ module.exports.getDriver = function (platform) {
switch (platform.toLowerCase()) {
case utilities.ANDROID:
normalizedPlatform = 'Android';
+ automationName = 'Appium';
break;
case utilities.IOS:
normalizedPlatform = 'iOS';
+ automationName = 'XCUITest';
break;
default:
@@ -79,7 +82,7 @@ module.exports.getDriver = function (platform) {
deviceName: global.DEVICE_NAME || '',
app: global.PACKAGE_PATH,
autoAcceptAlerts: true,
- automationName: 'XCUITest'
+ automationName
};
if (global.UDID) {
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 677ccbb..1ca768d 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -424,7 +424,7 @@ class ParamedicRunner {
}
// For now we always trying to run test app on emulator
- return (new ParamedicTargetChooser(this.tempFolder.name, this.config)).chooseTarget(
+ return new ParamedicTargetChooser(this.tempFolder.name, this.config).chooseTarget(
true, // useEmulator
this.config.getTarget() // preferredTarget
).then(targetObj => {
diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index 72f63cd..3248cd2 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -88,9 +88,14 @@ function getSimulatorModelId (cli, target) {
logger.info(`Filtering for Targeted Emulator: ${target}`);
// Return the individual target that is filtered from the known simulators/emulators based on provided target name. (default: ^iPhone)
- return result.stdout
- .split('\n')
- .filter(i => i.match(target))
+ const allSimulators = result.stdout
+ .split('\n');
+ const matchingSimulators = allSimulators.filter(i => i.match(target));
+ if (!matchingSimulators.length) {
+ logger.warn('Unable to find requested simulator, falling back to the first available!');
+ return allSimulators.filter(i => i.match(/^iPhone/))[0].trim();
+ }
+ return matchingSimulators
.pop()
.trim();
}
diff --git a/paramedic-plugin/package.json b/paramedic-plugin/package.json
index 1e79c6c..3026f0d 100644
--- a/paramedic-plugin/package.json
+++ b/paramedic-plugin/package.json
@@ -4,11 +4,8 @@
"license": "Apache 2.0",
"description": "Cordova Paramedic Plugin is responsible for the test results reporting",
"main": "paramedic.js",
- "engines" : {
- "node" : ">=0.11.2"
+ "engines": {
+ "node": ">=12.0.0"
},
- "repository": {
- "type": "git",
- "url": "git://github.com/apache/cordova-paramedic.git"
- }
+ "repository": "github:apache/cordova-paramedic"
}
diff --git a/paramedic-plugin/plugin.xml b/paramedic-plugin/plugin.xml
index af4d54a..3848017 100644
--- a/paramedic-plugin/plugin.xml
+++ b/paramedic-plugin/plugin.xml
@@ -19,7 +19,8 @@
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
- id="cordova-plugin-paramedic"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="cordova-plugin-paramedic"
version="1.2.1-dev">
<name>Paramedic</name>
@@ -34,4 +35,24 @@
<runs/>
</js-module>
+ <platform name="ios">
+ <config-file target="config.xml" parent="/*">
+ <preference name="scheme" value="app" />
+ <preference name="hostname" value="localhost" />
+ </config-file>
+ </platform>
+
+ <platform name="android">
+ <config-file target="config.xml" parent="/*">
+ <!-- <preference name="AndroidInsecureFileModeEnabled" value="true" /> -->
+ <!-- the logging server is http so force the webview to also be http -->
+ <preference name="scheme" value="http" />
+ <!-- <preference name="localhost" value="apptest.cordova.apache.org" /> -->
+ </config-file>
+
+ <edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
+ <!-- Cleartext Traffic should be avoided. Currently the way paramedic proxy the results, cleartext is needed, even when the scheme is set to http. -->
+ <application android:usesCleartextTraffic="true" />
+ </edit-config>
+ </platform>
</plugin>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org