feat: add option to disable screen view usage #2729
Workflow file for this run
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: Tests | |
on: | |
pull_request: | |
types: [opened, synchronize] # Don't rerun on `edited` to save time | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
module: [messagingpush, messaginginapp, base, datapipelines, core, tracking-migration] | |
name: Unit tests (${{ matrix.module }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-android | |
- name: Run unit tests (${{ matrix.module }}) | |
run: ./gradlew :${{ matrix.module }}:runJacocoTestReport | |
- name: Upload code coverage report | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN }} | |
with: | |
fail_ci_if_error: true # fail if upload fails so we can catch it and fix it right away. | |
verbose: true | |
files: ./${{ matrix.module }}/build/reports/jacoco/test/jacocoTestReport.xml,./${{ matrix.module }}/build/reports/jacoco/runJacocoTestReport/runJacocoTestReport.xml | |
- name: Publish test results (${{ matrix.module }}) | |
uses: mikepenz/action-junit-report@v4 | |
with: | |
report_paths: '**/build/test-results/test*/TEST-*.xml' | |
fail_on_failure: true | |
require_tests: true | |
if: ${{ always() }} # if running tests fails, we still want to parse the test results | |
instrumentation-test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
# Add more samples here as they are added to the project. | |
matrix: | |
sample: [kotlin_compose, java_layout] | |
api-level: [31] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-android | |
# Cache Gradle dependencies to speed up the build process | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v4 | |
continue-on-error: true | |
timeout-minutes: 5 | |
with: | |
cache-overwrite-existing: true | |
gradle-home-cache-cleanup: true | |
# Enable KVM (Kernel-based Virtual Machine) for better performance by allowing hardware virtualization | |
- 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 | |
# Cache the Android Virtual Device (AVD) to avoid recreating it each time | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
# Create AVD and generate snapshot for caching if not already cached | |
- 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 tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
cores: 3 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
ram-size: 4096M | |
target: google_apis | |
arch: x86_64 | |
# Run the instrumentation tests on the emulator. | |
script: ./gradlew :samples:${{ matrix.sample }}:connectedDebugAndroidTest --no-daemon --stacktrace -PuseKsp=true --debug | |
- name: Publish test results | |
uses: mikepenz/action-junit-report@v4 | |
if: always() | |
with: | |
report_paths: 'samples/${{ matrix.sample }}/build/outputs/androidTest-results/connected/TEST-*.xml' |