|
| 1 | +name: Nav3 Built-in Back Stack Mappers R8 Check |
| 2 | + |
| 3 | +# Verifies behavior of BackStackEntryMapper.SerialName from sentry-android-navigation3 in |
| 4 | +# R8-minified builds on an emulator. Runs tests in: |
| 5 | +# |
| 6 | +# - R8 full mode against the compile floor of kotlinx-serialization-core and its latest stable |
| 7 | +# release; and |
| 8 | +# - R8 compat mode against the compile floor. |
| 9 | +# |
| 10 | +# Also runs all the module's unit tests against the latest stable release. See |
| 11 | +# sentry-android-integration-tests/nav3-built-in-back-stack-mappers-r8-check/README.md. |
| 12 | + |
| 13 | +# Only runs for the paths below. Not a required check, so skipped runs don't block PRs. Catalog |
| 14 | +# filters match whole files, including changes to unrelated dependencies. |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - main |
| 19 | + paths: &nav3-r8-paths |
| 20 | + - 'sentry-android-navigation3/**' |
| 21 | + - 'sentry-android-integration-tests/nav3-built-in-back-stack-mappers-r8-check/**' |
| 22 | + # The settings, build script, and properties of the build that produces the check's APKs. |
| 23 | + - 'sentry-android-integration-tests/*.gradle.kts' |
| 24 | + - 'sentry-android-integration-tests/*.properties' |
| 25 | + - 'scripts/test-nav3-built-in-back-stack-mappers-r8.sh' |
| 26 | + - '.github/workflows/integration-tests-nav3-r8.yml' |
| 27 | + # Build settings, R8 flags, build logic, the Gradle version, and the version catalogs |
| 28 | + # (Kotlin, AGP and its R8, Compose, Nav3, and the kotlinx.serialization matrix). |
| 29 | + - 'gradle.properties' |
| 30 | + - 'settings.gradle.kts' |
| 31 | + - 'build.gradle.kts' |
| 32 | + - 'gradle/wrapper/**' |
| 33 | + - 'gradle/libs.versions.toml' |
| 34 | + - 'gradle/dependency-matrix.versions.toml' |
| 35 | + - 'buildSrc/**' |
| 36 | + - 'build-logic/**' |
| 37 | + # Utilities the mapper uses to handle exceptions. |
| 38 | + - 'sentry/src/main/java/io/sentry/util/**' |
| 39 | + pull_request: |
| 40 | + paths: *nav3-r8-paths |
| 41 | + |
| 42 | +permissions: |
| 43 | + contents: read |
| 44 | + |
| 45 | +concurrency: |
| 46 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 47 | + cancel-in-progress: true |
| 48 | + |
| 49 | +env: |
| 50 | + APK_DIR: "nav3-r8-check-apks" |
| 51 | + APK_ARTIFACT_NAME: "nav3-r8-check-apks" |
| 52 | + |
| 53 | +jobs: |
| 54 | + # Runs separately from the APK builds, so a unit test failure doesn't hide the R8 check's results. |
| 55 | + unit-tests: |
| 56 | + name: Unit tests |
| 57 | + runs-on: ubuntu-latest |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout code |
| 61 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 62 | + |
| 63 | + - name: Set up Java |
| 64 | + uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 |
| 65 | + with: |
| 66 | + distribution: 'temurin' |
| 67 | + java-version: '21' |
| 68 | + |
| 69 | + - name: Setup Gradle |
| 70 | + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 |
| 71 | + |
| 72 | + # Apps may ship a newer kotlinx.serialization than sentry-android-navigation3 compiles |
| 73 | + # against. The Build workflow runs the unit tests against the floor. |
| 74 | + - name: Run unit tests against the latest stable kotlinx.serialization |
| 75 | + run: ./gradlew :sentry-android-navigation3:testReleaseUnitTest -Pnav3TestKotlinx=latestStable |
| 76 | + |
| 77 | + build: |
| 78 | + name: Build |
| 79 | + runs-on: ubuntu-latest |
| 80 | + |
| 81 | + steps: |
| 82 | + - name: Checkout code |
| 83 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 84 | + |
| 85 | + - name: Set up Java |
| 86 | + uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 |
| 87 | + with: |
| 88 | + distribution: 'temurin' |
| 89 | + java-version: '21' |
| 90 | + |
| 91 | + - name: Setup Gradle |
| 92 | + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 |
| 93 | + |
| 94 | + - name: Build APKs |
| 95 | + run: ./scripts/test-nav3-built-in-back-stack-mappers-r8.sh build "${{ env.APK_DIR }}" |
| 96 | + |
| 97 | + - name: Upload APK artifact |
| 98 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 |
| 99 | + with: |
| 100 | + name: ${{ env.APK_ARTIFACT_NAME }} |
| 101 | + path: ${{ env.APK_DIR }} |
| 102 | + retention-days: 1 |
| 103 | + |
| 104 | + # Run on API 23, Nav3's minSdk, to verify that the minified app and its dependencies work on the |
| 105 | + # oldest supported runtime. |
| 106 | + run: |
| 107 | + name: Run on API Level 23 |
| 108 | + needs: build |
| 109 | + runs-on: ubuntu-latest |
| 110 | + steps: |
| 111 | + - name: Checkout code |
| 112 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 113 | + |
| 114 | + - name: Enable KVM |
| 115 | + run: | |
| 116 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 117 | + sudo udevadm control --reload-rules |
| 118 | + sudo udevadm trigger --name-match=kvm |
| 119 | +
|
| 120 | + - name: Download APK artifact |
| 121 | + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 |
| 122 | + with: |
| 123 | + name: ${{ env.APK_ARTIFACT_NAME }} |
| 124 | + path: ${{ env.APK_DIR }} |
| 125 | + |
| 126 | + - name: Run check |
| 127 | + uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2.38.0 |
| 128 | + with: |
| 129 | + api-level: 23 |
| 130 | + target: google_apis |
| 131 | + arch: x86_64 |
| 132 | + disable-animations: true |
| 133 | + disable-spellchecker: true |
| 134 | + emulator-options: -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save |
| 135 | + script: ./scripts/test-nav3-built-in-back-stack-mappers-r8.sh run "${{ env.APK_DIR }}" |
0 commit comments