Skip to content

Commit 0177147

Browse files
committed
chore: fix Android CI build
1 parent 41861aa commit 0177147

File tree

4 files changed

+50
-19
lines changed

4 files changed

+50
-19
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,38 @@ jobs:
6666
cache-dependency-path: package-lock.json
6767
- name: Install node modules
6868
run: npm ci
69-
- name: Install JDK 1.8
70-
uses: actions/setup-java@v1
69+
- name: Install JDK
70+
uses: actions/setup-java@v2
7171
with:
72-
java-version: 1.8
72+
distribution: "zulu"
73+
java-version: "17"
74+
java-package: jdk
75+
- name: Ensure Android build-tools 33.0.2
76+
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" "build-tools;33.0.2"
77+
- name: Install Gradle 7.6.1
78+
run: |
79+
set -euo pipefail
80+
GRADLE_VERSION=7.6.1
81+
curl -sSL "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" -o gradle.zip
82+
unzip -q gradle.zip -d "$HOME/gradle"
83+
echo "$HOME/gradle/gradle-${GRADLE_VERSION}/bin" >> "$GITHUB_PATH"
84+
rm gradle.zip
7385
- name: Update test cert for httpbin.org
7486
run: npm run update:cert
75-
- name: Add workaround for missing DX files in build-tools 32 (https://stackoverflow.com/a/68430992)
76-
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
87+
- name: Shim missing DX binaries (https://stackoverflow.com/a/68430992)
88+
run: |
89+
set -euo pipefail
90+
BUILD_TOOLS_PATH="$(ls -d $ANDROID_HOME/build-tools/*/ | sort -V | tail -n 1)"
91+
D8_BIN="${BUILD_TOOLS_PATH}d8"
92+
DX_BIN="${BUILD_TOOLS_PATH}dx"
93+
D8_JAR="${BUILD_TOOLS_PATH}lib/d8.jar"
94+
DX_JAR="${BUILD_TOOLS_PATH}lib/dx.jar"
95+
if [ -f "$D8_BIN" ] && [ ! -e "$DX_BIN" ]; then
96+
ln -s "$D8_BIN" "$DX_BIN"
97+
fi
98+
if [ -f "$D8_JAR" ] && [ ! -e "$DX_JAR" ]; then
99+
ln -s "$D8_JAR" "$DX_JAR"
100+
fi
77101
- name: Build test app
78102
run: scripts/build-test-app.sh --android --device
79103
- name: Upload artifact to BrowserStack

scripts/upload-browserstack.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,20 @@ if [ $PLATFORM = "android" ]; then
1717
-F "file=@$TEMP/platforms/android/app/build/outputs/apk/debug/app-debug.apk" \
1818
-F "data={\"custom_id\": \"HttpTestAppAndroid\"}"
1919
else
20-
rm -rf $TEMP/HttpDemo.ipa
21-
pushd $TEMP/platforms/ios/build/emulator
22-
rm -rf ./Payload
23-
mkdir -p ./Payload
24-
cp -r ./HttpDemo.app ./Payload/HttpDemo.app
25-
zip -r $TEMP/HttpDemo.ipa ./Payload
26-
popd
20+
rm -rf "$TEMP/HttpDemo.ipa"
21+
IOS_BUILD_DIR="$TEMP/platforms/ios/build/Debug-iphonesimulator"
22+
APP_PATH="$IOS_BUILD_DIR/HttpDemo.app"
23+
if [ ! -d "$APP_PATH" ]; then
24+
echo "Unable to locate $APP_PATH" >&2
25+
exit 1
26+
fi
27+
28+
PAYLOAD_DIR="$TEMP/Payload"
29+
rm -rf "$PAYLOAD_DIR"
30+
mkdir -p "$PAYLOAD_DIR"
31+
cp -R "$APP_PATH" "$PAYLOAD_DIR/HttpDemo.app"
32+
(cd "$TEMP" && zip -qr HttpDemo.ipa Payload)
33+
rm -rf "$PAYLOAD_DIR"
2734

2835
curl -u $BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY \
2936
-X POST \

test/e2e-app-template/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"author": "Sefa Ilkimen",
1111
"license": "Apache-2.0",
1212
"dependencies": {
13-
"cordova": "11.0.0",
14-
"cordova-android": "10.1.1",
15-
"cordova-browser": "6.0.0",
16-
"cordova-ios": "6.2.0",
13+
"cordova": "12.0.0",
14+
"cordova-android": "12.0.1",
15+
"cordova-browser": "7.0.0",
16+
"cordova-ios": "7.1.1",
1717
"cordova-plugin-device": "2.0.3"
1818
},
1919
"cordova": {
@@ -26,4 +26,4 @@
2626
"cordova-plugin-device": {}
2727
}
2828
}
29-
}
29+
}

test/e2e-tooling/caps.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ const configs = {
7070
},
7171
browserstackAndroidDevice: {
7272
'appium-version': '1.22.0',
73-
device: 'Samsung Galaxy S8',
74-
os_version: '7.0',
73+
device: 'Samsung Galaxy S22 Ultra',
74+
os_version: '12.0',
7575
project: 'HTTP Test App',
7676
autoWebview: true,
7777
app: 'HttpTestAppAndroid',

0 commit comments

Comments
 (0)