try bumping min to 23 #774
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: unit-and-instrumented-tests | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
JAVA_DISTRIBUTION: "corretto" | |
JAVA_VERSION: "17" | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup java 17 for gradle | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Run unit tests | |
run: ./gradlew :Branch-SDK:testDebugUnitTest | |
- name: Save test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unit-test | |
path: ./Branch-SDK/build/ | |
instrumented-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
api-level: [23, 34] | |
target: [google_apis] | |
arch: [x86_64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Setup java 17 for gradle | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
./gradlew :Branch-SDK:connectedDebugAndroidTest | |
- name: Save test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: instrumented-test-api-level-${{ matrix.api-level }} | |
path: ./Branch-SDK/build/ | |
jacoco-test-coverage: | |
name: jacoco-test-coverage | |
runs-on: ubuntu-latest | |
needs: [unit-tests, instrumented-tests] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup java 17 for gradle | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Run Coverage | |
run: ./gradlew :Branch-SDK:jacocoTestReport --info | |
- name: Upload Coverage Test Report | |
if: success() | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./Branch-SDK/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml | |
fail_ci_if_error: true |