Skip to content

Commit 0f3e51e

Browse files
Update unit-and-instrumented-tests-action.yml
1 parent 2b05b44 commit 0f3e51e

File tree

1 file changed

+12
-43
lines changed

1 file changed

+12
-43
lines changed

.github/workflows/unit-and-instrumented-tests-action.yml

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,21 @@ jobs:
2929
with:
3030
name: unit-test-api-level-$API_CURRENT
3131
path: ./Branch-SDK/build/
32-
instrumented-test-api-level-current:
33-
name: instrumented-test-api-level-$API_CURRENT
34-
runs-on: macos-13
32+
test:
33+
runs-on: ubuntu-latest
3534
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v3
38-
# create an emulator with google apis, runs on java 8
39-
- name: Setup java 8 for emulator
40-
uses: actions/setup-java@v4
41-
with:
42-
distribution: ${{ env.JAVA_DISTRIBUTION }}
43-
java-version: 8
44-
- name: Create Android emulator
45-
run: |
46-
echo "Yes licenses"
47-
Yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
48-
echo "sdkmanager version"
49-
$ANDROID_HOME/tools/bin/sdkmanager --version
50-
echo "Yes install image"
51-
Yes | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-32;google_apis_playstore;x86_64"
52-
echo "no" | $ANDROID_HOME/tools/bin/avdmanager --verbose create avd --force --name test --package "system-images;android-32;google_apis_playstore;x86_64"
53-
# boots and waits for the emulator to be ready
54-
- name: Launch Emulator
55-
timeout-minutes: 15
35+
- name: checkout
36+
uses: actions/checkout@v4
37+
- name: Enable KVM
5638
run: |
57-
echo "Start emulator and wait for boot to complete."
58-
echo $ANDROID_HOME/tools/emulator -list-avds
59-
$ANDROID_HOME/tools/emulator -list-avds
60-
$ANDROID_HOME/platform-tools/adb reconnect
61-
echo $ANDROID_HOME/platform-tools/adb devices
62-
$ANDROID_HOME/platform-tools/adb devices
63-
echo "Starting emulator"
64-
nohup $ANDROID_HOME/tools/emulator -avd test -no-metrics -no-audio -no-boot-anim -no-snapshot-load -camera-back none -camera-front none -qemu -m 2048 2>&1 &
65-
echo "wait-for-device"
66-
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do echo "waiting..."; sleep 1; done; input keyevent 82'
67-
echo "Emulator has finished booting"
68-
# repo's gradle is configured to run on java 17
69-
- name: Setup java 17 for gradle
70-
uses: actions/setup-java@v4
39+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
40+
sudo udevadm control --reload-rules
41+
sudo udevadm trigger --name-match=kvm
42+
- name: run tests
43+
uses: reactivecircus/[email protected]
7144
with:
72-
distribution: ${{ env.JAVA_DISTRIBUTION }}
73-
java-version: ${{ env.JAVA_VERSION }}
74-
# gradlew will automatically connect to booted emulator
75-
- name: Run instrumented tests
76-
run: |
77-
./gradlew :Branch-SDK:connectedDebugAndroidTest -Dorg.gradle.jvmargs="-Xmx8192M -Dkotlin.daemon.jvm.options\\=\"-Xmx8192M\"" --info
45+
api-level: 29
46+
script: ./gradlew :Branch-SDK:connectedDebugAndroidTest
7847
# contains the reports and apk
7948
- name: Save test artifacts
8049
if: success() || failure()

0 commit comments

Comments
 (0)