mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-01-31 00:00:03 +08:00
chore: fix Android CI build
This commit is contained in:
34
.github/workflows/ci.yml
vendored
34
.github/workflows/ci.yml
vendored
@@ -66,14 +66,38 @@ jobs:
|
||||
cache-dependency-path: package-lock.json
|
||||
- name: Install node modules
|
||||
run: npm ci
|
||||
- name: Install JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
- name: Install JDK
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 1.8
|
||||
distribution: "zulu"
|
||||
java-version: "17"
|
||||
java-package: jdk
|
||||
- name: Ensure Android build-tools 33.0.2
|
||||
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" "build-tools;33.0.2"
|
||||
- name: Install Gradle 7.6.1
|
||||
run: |
|
||||
set -euo pipefail
|
||||
GRADLE_VERSION=7.6.1
|
||||
curl -sSL "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" -o gradle.zip
|
||||
unzip -q gradle.zip -d "$HOME/gradle"
|
||||
echo "$HOME/gradle/gradle-${GRADLE_VERSION}/bin" >> "$GITHUB_PATH"
|
||||
rm gradle.zip
|
||||
- name: Update test cert for httpbin.org
|
||||
run: npm run update:cert
|
||||
- name: Add workaround for missing DX files in build-tools 32 (https://stackoverflow.com/a/68430992)
|
||||
run: ln -s $ANDROID_HOME/build-tools/32.0.0/d8 $ANDROID_HOME/build-tools/32.0.0/dx && ln -s $ANDROID_HOME/build-tools/32.0.0/lib/d8.jar $ANDROID_HOME/build-tools/32.0.0/lib/dx.jar
|
||||
- name: Shim missing DX binaries (https://stackoverflow.com/a/68430992)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
BUILD_TOOLS_PATH="$(ls -d $ANDROID_HOME/build-tools/*/ | sort -V | tail -n 1)"
|
||||
D8_BIN="${BUILD_TOOLS_PATH}d8"
|
||||
DX_BIN="${BUILD_TOOLS_PATH}dx"
|
||||
D8_JAR="${BUILD_TOOLS_PATH}lib/d8.jar"
|
||||
DX_JAR="${BUILD_TOOLS_PATH}lib/dx.jar"
|
||||
if [ -f "$D8_BIN" ] && [ ! -e "$DX_BIN" ]; then
|
||||
ln -s "$D8_BIN" "$DX_BIN"
|
||||
fi
|
||||
if [ -f "$D8_JAR" ] && [ ! -e "$DX_JAR" ]; then
|
||||
ln -s "$D8_JAR" "$DX_JAR"
|
||||
fi
|
||||
- name: Build test app
|
||||
run: scripts/build-test-app.sh --android --device
|
||||
- name: Upload artifact to BrowserStack
|
||||
|
||||
@@ -17,13 +17,20 @@ if [ $PLATFORM = "android" ]; then
|
||||
-F "file=@$TEMP/platforms/android/app/build/outputs/apk/debug/app-debug.apk" \
|
||||
-F "data={\"custom_id\": \"HttpTestAppAndroid\"}"
|
||||
else
|
||||
rm -rf $TEMP/HttpDemo.ipa
|
||||
pushd $TEMP/platforms/ios/build/emulator
|
||||
rm -rf ./Payload
|
||||
mkdir -p ./Payload
|
||||
cp -r ./HttpDemo.app ./Payload/HttpDemo.app
|
||||
zip -r $TEMP/HttpDemo.ipa ./Payload
|
||||
popd
|
||||
rm -rf "$TEMP/HttpDemo.ipa"
|
||||
IOS_BUILD_DIR="$TEMP/platforms/ios/build/Debug-iphonesimulator"
|
||||
APP_PATH="$IOS_BUILD_DIR/HttpDemo.app"
|
||||
if [ ! -d "$APP_PATH" ]; then
|
||||
echo "Unable to locate $APP_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PAYLOAD_DIR="$TEMP/Payload"
|
||||
rm -rf "$PAYLOAD_DIR"
|
||||
mkdir -p "$PAYLOAD_DIR"
|
||||
cp -R "$APP_PATH" "$PAYLOAD_DIR/HttpDemo.app"
|
||||
(cd "$TEMP" && zip -qr HttpDemo.ipa Payload)
|
||||
rm -rf "$PAYLOAD_DIR"
|
||||
|
||||
curl -u $BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY \
|
||||
-X POST \
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
"author": "Sefa Ilkimen",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"cordova": "11.0.0",
|
||||
"cordova-android": "10.1.1",
|
||||
"cordova-browser": "6.0.0",
|
||||
"cordova-ios": "6.2.0",
|
||||
"cordova": "12.0.0",
|
||||
"cordova-android": "12.0.1",
|
||||
"cordova-browser": "7.0.0",
|
||||
"cordova-ios": "7.1.1",
|
||||
"cordova-plugin-device": "2.0.3"
|
||||
},
|
||||
"cordova": {
|
||||
@@ -26,4 +26,4 @@
|
||||
"cordova-plugin-device": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,6 @@ const helpers = {
|
||||
};
|
||||
|
||||
const messageFactory = {
|
||||
handshakeFailed: function() { return 'TLS connection could not be established: javax.net.ssl.SSLHandshakeException: Handshake failed' },
|
||||
sslTrustAnchor: function () { return 'TLS connection could not be established: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.' },
|
||||
invalidCertificate: function (domain) { return 'The certificate for this server is invalid. You might be connecting to a server that is pretending to be “' + domain + '” which could put your confidential information at risk.' }
|
||||
}
|
||||
@@ -612,7 +611,9 @@ const tests = [
|
||||
},
|
||||
validationFunc: function (driver, result, targetInfo) {
|
||||
result.type.should.be.equal('rejected');
|
||||
result.data.should.be.eql({ status: -2, error: targetInfo.isAndroid ? messageFactory.sslTrustAnchor() : messageFactory.invalidCertificate('sha512.badssl.com') });
|
||||
result.data.status.should.be.equal(-2);
|
||||
result.data.error.should.include(targetInfo.isAndroid ? 'javax.net.ssl.SSLHandshakeException' : 'The certificate for this server is invalid');
|
||||
// result.data.should.be.eql({ status: -2, error: targetInfo.isAndroid ? messageFactory.s^slTrustAnchor() : messageFactory.invalidCertificate('sha512.badssl.com') });
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1175,7 +1176,8 @@ const tests = [
|
||||
},
|
||||
validationFunc: function (driver, result) {
|
||||
result.type.should.be.equal('rejected');
|
||||
result.data.should.be.eql({ status: -2, error: messageFactory.handshakeFailed() });
|
||||
result.data.status.should.be.equal(-2);
|
||||
result.data.error.should.include('UNSUPPORTED_PROTOCOL');
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
@@ -70,8 +70,8 @@ const configs = {
|
||||
},
|
||||
browserstackAndroidDevice: {
|
||||
'appium-version': '1.22.0',
|
||||
device: 'Samsung Galaxy S8',
|
||||
os_version: '7.0',
|
||||
device: 'Samsung Galaxy S22 Ultra',
|
||||
os_version: '12.0',
|
||||
project: 'HTTP Test App',
|
||||
autoWebview: true,
|
||||
app: 'HttpTestAppAndroid',
|
||||
|
||||
@@ -536,7 +536,7 @@ describe('Common helpers', function () {
|
||||
null,
|
||||
(response) => {
|
||||
response.status.should.be.equal(errorCodes.POST_PROCESSING_FAILED);
|
||||
response.error.should.include('Unexpected token N in JSON at position 0');
|
||||
response.error.should.include('Unexpected token');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user