Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
AnasNaouchi committed Nov 8, 2023
2 parents 0cef83d + ee96e52 commit b2102c2
Show file tree
Hide file tree
Showing 17 changed files with 193 additions and 140 deletions.
101 changes: 26 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will build and test the project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Android CI

on: push
Expand All @@ -12,101 +9,55 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build project
# TODO: Remove `touch local.properties` command line once the BuildConfig props are removed from the SDK.
run: |
touch local.properties
./gradlew sdk:build -x test
run: ./gradlew sdk:build -x test

unit-test:
name: Unit test
name: Unit tests with coverage report
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Run unit tests
# TODO: Remove `touch local.properties` command line once the BuildConfig props are removed from the SDK.
run: |
touch local.properties
./gradlew sdk:testProductionDebugUnitTest
- name: Upload test report
if: always()
uses: actions/upload-artifact@v2
with:
name: test-report
path: sdk/build/reports

instrumentation-test:
name: Instrumentation test
# Due to Android emulator issue on Ubuntu, we use macOS instead.
runs-on: macos-latest
needs: build
strategy:
matrix:
api-level: [ 29 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
fetch-depth: 0 # required for SonarCloud

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Gradle cache
uses: gradle/gradle-build-action@v2

- name: AVD cache
- name: Cache Gradle dependencies
uses: actions/cache@v3
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 }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
disable-animations: true
force-avd-creation: false
profile: Nexus 6
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# TODO: Remove `touch local.properties` command line once the BuildConfig props are removed from the SDK.
script: |
touch local.properties
./gradlew sdk:connectedProductionDebugAndroidTest
- name: Run unit tests
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Switch to jacocoTestReport when instrumentation flakiness is fixed
run: ./gradlew sdk:jacocoUnitTestReport sdk:sonar

- name: Upload test report
if: always()
uses: actions/upload-artifact@v2
with:
name: test-report
path: sdk/build/reports
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b2102c2

Please sign in to comment.