From 01e91a9236f1808cbac58b8f65499a107cd95724 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 29 Jul 2024 15:05:15 +0300 Subject: [PATCH] =?UTF-8?q?Update=20Github=20workflow=20configurations=20?= =?UTF-8?q?=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++----- .github/workflows/library.yml | 7 +++---- .github/workflows/utils.yml | 9 ++++---- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 077f4e77..d2c2ef1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,10 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - runs-on: macos-13 + runs-on: ubuntu-latest + strategy: + matrix: + api-level: [34] steps: - name: Cancel Previous workflow runs @@ -31,6 +34,12 @@ jobs: distribution: temurin java-version: 17 + - 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: Create local.properties file run: touch local.properties && echo "mapbox.repo.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties @@ -46,18 +55,38 @@ jobs: - name: Clean & Build project skipping tests run: ./gradlew clean build -x test --stacktrace + - 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 }} + arch: x86_64 + 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 Instrumented Tests uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 34 + api-level: ${{ matrix.api-level }} arch: x86_64 - force-avd-creation: true + 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 connectedDebug --stacktrace --info + script: ./gradlew connectedDebug --stacktrace - name: Run jacocoTestReport for each module - run: ./gradlew jacocoTestReport --stacktrace --info + run: ./gradlew jacocoTestReport --stacktrace - name: Merge jacoco reports from all modules run: ./gradlew jacocoFullReport --stacktrace diff --git a/.github/workflows/library.yml b/.github/workflows/library.yml index 79cf0856..f980df34 100644 --- a/.github/workflows/library.yml +++ b/.github/workflows/library.yml @@ -25,13 +25,12 @@ jobs: access_token: ${{ github.token }} - name: Checkout 🛎️ - uses: actions/checkout@v2 - with: - fetch-depth: 2 + uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v1 with: + distribution: temurin java-version: 17 - name: Create local.properties file @@ -58,7 +57,7 @@ jobs: - name: Run Instrumented Tests manually uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 22 + api-level: 34 script: ./gradlew :library:connectedDebug --stacktrace --info - name: Run unit tests with Gradle diff --git a/.github/workflows/utils.yml b/.github/workflows/utils.yml index 5bbcf846..03d3025e 100644 --- a/.github/workflows/utils.yml +++ b/.github/workflows/utils.yml @@ -22,16 +22,15 @@ jobs: - name: Cancel previous workflow runs uses: styfle/cancel-workflow-action@0.9.1 with: - access_token: ${{ github.token }} + access_token: ${{ github.token }} - name: Checkout 🛎️ - uses: actions/checkout@v2 - with: - fetch-depth: 2 + uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v1 with: + distribution: temurin java-version: 17 - name: Create local.properties file @@ -58,7 +57,7 @@ jobs: - name: Run Instrumented Tests manually uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 22 + api-level: 34 script: ./gradlew :utils:connectedDebug --stacktrace - name: Generate & upload utils snapshot artifact AAR (Android Archive) file to Sonatype