Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ updates:
- package-ecosystem: "gradle"
# The separate sample and test builds read this build's version catalog, so one directory
# covers them. Listing them too opens one PR per directory for the same bump.
#
# Also bumps the <matrix>-stable versions in gradle/dependency-matrix.versions.toml. Don't add
# ignore rules for those modules (see the rules at the top of that file).
directory: "/"
registries:
- gradle-plugin-portal
Expand Down
200 changes: 200 additions & 0 deletions .github/workflows/integration-tests-nav3-r8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
name: Nav3 BackStackEntryMapper R8 Check

# Verifies behavior of BackStackEntryMapper.SerialName from sentry-android-navigation3 in
# R8-minified builds on an emulator (R8 full mode with the
# compile floor, the latest stable release, and any newer release candidate of
# kotlinx.serialization, from gradle/dependency-matrix.versions.toml, and R8 compat mode with the
# floor). Also runs all of the module's unit tests against the newer versions. See sentry-android-integration-tests/nav3-backstack-entry-mapper-r8-check/README.md.
#
# Release candidate failures are warnings, except on PRs that change kotlinxSerialization-preview,
# such as the weekly updater's.

# Runs on every PR and every push to main, without paths filters: the relevance job decides
# whether the check runs, using scripts/nav3-r8-check-relevant.sh as the only list of relevant
# changes.
on:
push:
branches:
- main
pull_request:

permissions:
contents: read

# A new push only cancels a superseded PR run. On main, a run that started finishes, as the API 23
# job only runs there and would otherwise rarely complete; a newer push waits for it instead.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
APK_DIR: "nav3-r8-check-apks"
APK_ARTIFACT_NAME: "nav3-r8-check-apks"

jobs:
# Decides whether the changes affect the check, with scripts/nav3-r8-check-relevant.sh. The
# other jobs are skipped (and report as skipped) if they don't, e.g., for PRs that don't touch
# Nav3 or that only bump unrelated versions in gradle/libs.versions.toml.
#
# Also decides whether release candidate failures fail the check (but only on PRs that change
# kotlinxSerialization-preview).
relevance:
name: Check relevance
runs-on: ubuntu-latest
outputs:
relevant: ${{ steps.check.outputs.relevant }}
preview-required: ${{ steps.check.outputs.preview-required }}

steps:
# A PR's checkout is a merge commit, whose first parent is the base branch, and a push to
# main is usually one squashed commit, so two commits are usually enough to diff the changes.
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 2

- name: Check whether the changes affect the check
id: check
env:
PUSH_BEFORE: ${{ github.event.before }}
run: |
previewRequired=false
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
relevant="$(./scripts/nav3-r8-check-relevant.sh HEAD^1 HEAD)"
if ./scripts/dependency-matrix.sh changed-roles HEAD^1 HEAD kotlinxSerialization | grep -qx preview; then
previewRequired=true
fi
else
# A push may contain several commits, so diff against the commit main pointed to before
# it. If that commit can't be fetched (e.g., after a force push), run the check.
if [[ -n "$PUSH_BEFORE" && ! "$PUSH_BEFORE" =~ ^0+$ ]] \
&& { git cat-file -e "${PUSH_BEFORE}^{commit}" 2> /dev/null \
|| git fetch --depth=1 origin "$PUSH_BEFORE"; }; then
relevant="$(./scripts/nav3-r8-check-relevant.sh --any-catalog-change "$PUSH_BEFORE" HEAD)"
else
relevant=true
fi
fi
if [[ "$previewRequired" == "true" ]] \
&& ! ./scripts/dependency-matrix.sh extra-versions kotlinxSerialization | grep -q '^preview '; then
echo "::notice::kotlinxSerialization-preview changed, but isn't newer than kotlinxSerialization-stable, so no release candidate is tested."
fi
echo "relevant=$relevant" >> "$GITHUB_OUTPUT"
echo "preview-required=$previewRequired" >> "$GITHUB_OUTPUT"
echo "Nav3 R8 check relevant: $relevant"
echo "kotlinx.serialization release candidate required: $previewRequired"

# Runs separately from the APK builds, so a unit test failure doesn't hide the R8 check's results.
unit-tests:
name: Unit tests
needs: relevance
if: needs.relevance.outputs.relevant == 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Java
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: 'temurin'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1

# Apps may ship a newer kotlinx.serialization than sentry-android-navigation3 compiles
# against. The Build workflow runs the unit tests against the floor.
- name: Run unit tests against newer kotlinx.serialization versions
env:
NAV3_PREVIEW_REQUIRED: ${{ needs.relevance.outputs.preview-required }}
run: ./scripts/test-nav3-kotlinx-versions.sh

build:
name: Build
needs: relevance
if: needs.relevance.outputs.relevant == 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Java
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: 'temurin'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1

- name: Build APKs
env:
NAV3_PREVIEW_REQUIRED: ${{ needs.relevance.outputs.preview-required }}
run: ./scripts/test-nav3-backstack-entry-mapper-r8.sh build "${{ env.APK_DIR }}"

- name: Upload APK artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: ${{ env.APK_ARTIFACT_NAME }}
path: ${{ env.APK_DIR }}
retention-days: 1

run:
name: Run on API Level ${{ matrix.api-level }}
needs: [relevance, build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Tests against API 37.0 on every run. Also tests against API 23 (Nav3's minSdkVersion) when changes reach main.
# The latter lets us catch issues present on the oldest Nav3 app runtime without slowing down PRs.
api-level: ${{ fromJSON(github.event_name == 'push' && '[23, "37.0"]' || '["37.0"]') }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- 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: Download APK artifact
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: ${{ env.APK_ARTIFACT_NAME }}
path: ${{ env.APK_DIR }}

# The runner ships an outdated avdmanager that writes target=android-0 into the
# AVD config for minor-versioned packages (android-37.x), so the emulator clamps
# to API 3 and boots misconfigured. Update cmdline-tools so avdmanager parses it.
# See https://github.com/ReactiveCircus/android-emulator-runner/issues/482
- name: Update SDK cmdline-tools
if: matrix.api-level == '37.0'
run: |
SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}"
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --install "cmdline-tools;latest" > /dev/null
# sdkmanager won't overwrite the preinstalled dir, so it installs to latest-2.
if [ -d "$SDK/cmdline-tools/latest-2" ]; then
rm -rf "$SDK/cmdline-tools/latest"
mv "$SDK/cmdline-tools/latest-2" "$SDK/cmdline-tools/latest"
fi

- name: Run check
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2.38.0
env:
NAV3_PREVIEW_REQUIRED: ${{ needs.relevance.outputs.preview-required }}
with:
api-level: ${{ matrix.api-level }}
# API 37 has no plain google_apis image.
target: ${{ matrix.api-level == 23 && 'google_apis' || 'google_apis_ps16k' }}
# Use canary for API 37, matching the critical UI tests.
channel: ${{ matrix.api-level == 23 && 'stable' || 'canary' }}
arch: x86_64
disable-animations: true
disable-spellchecker: true
emulator-options: -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save
script: ./scripts/test-nav3-backstack-entry-mapper-r8.sh run "${{ env.APK_DIR }}"
25 changes: 23 additions & 2 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Update Dependencies

on:
# Run every day.
schedule:
# Run every day.
- cron: '0 3 * * *'
# And on on every PR merge so we get the updated dependencies ASAP, and to make sure the changelog doesn't conflict.
# Run weekly (select btw daily or weekly via `if:`).
- cron: '0 4 * * 1'
# Also trigger on pushes to main (individual jobs decide whether to run). E.g., lets us get updated
# dependencies ASAP and make sure the changelog doesn't conflict.
push:
branches:
- main
Expand All @@ -15,11 +18,29 @@ permissions:
actions: write

jobs:
# Update the Sentry Native SDK dependency daily and on pushes to main.
native:
if: github.event.schedule != '0 4 * * 1'
runs-on: ubuntu-latest
steps:
- uses: getsentry/github-workflows/updater@36529d71129a14967bea1fb81bcaf2a5943cf877 # v3
with:
path: scripts/update-sentry-native-ndk.sh
name: Native SDK
ssh-key: ${{ secrets.CI_DEPLOY_KEY }}

# Update weekly the kotlinx-serialization-core release candidate used by the Nav3 R8 check and
# unit tests. (Dependabot separately bumps the latest stable / non-preview release.)
nav3-kotlinx-serialization-preview:
if: github.event.schedule == '0 4 * * 1'
runs-on: ubuntu-latest
steps:
- uses: getsentry/github-workflows/updater@36529d71129a14967bea1fb81bcaf2a5943cf877 # v3
with:
path: scripts/update-kotlinx-serialization-preview.sh
name: Nav3 kotlinx.serialization RC check
# Release candidates only. kotlinx.serialization publishes no alpha or beta releases.
pattern: '^v?(?<version>[0-9.]+-RC[0-9]*)$'
# Only the Nav3 tests use this version; the SDK's dependency doesn't change.
changelog-entry: false
ssh-key: ${{ secrets.CI_DEPLOY_KEY }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

## Unreleased

### Features

- Nav3: Add `BackStackEntryMapper.SerialName`, a convenience mapper that names back stack entries after their kotlinx.serialization serial names ([#6703](https://github.com/getsentry/sentry-java/pull/6703))
- Nav3: Record why a back stack entry is `/unknown`, as `unknown_entry_reason` next to it in the back stack record and navigation transactions, and as `to_unknown_entry_reason` and `from_unknown_entry_reason` on breadcrumbs (e.g., `not_serializable` or `serializer_not_found` for the built-in mappers, `unmapped` if a custom mapper returns `null`) ([#6781](https://github.com/getsentry/sentry-java/pull/6781))
- A mapper that throws now records `"unknown_entry_reason": "mapping_failed"` instead of `"dropped_by_sentry": "mapping_failed"` in the entry's arguments

### Fixes

- Session Replay: Mask Compose images loaded with Coil 3.1+ `AsyncImage` when `maskAllImages` is enabled ([#6759](https://github.com/getsentry/sentry-java/pull/6759))
Expand All @@ -17,6 +23,7 @@

### Dependencies

- Nav3: `sentry-android-navigation3` now depends on `kotlinx-serialization-core` 1.7.3 or later, the version every Nav3 release already depends on, so it never raises a Nav3 app's version ([#6703](https://github.com/getsentry/sentry-java/pull/6703))
- Nav3: `sentry-android-navigation3` no longer declares a dependency on `androidx.lifecycle:lifecycle-runtime-compose`. Nav3 apps already depend on it via `navigation3-ui`, so no app changes are necessary ([#6699](https://github.com/getsentry/sentry-java/pull/6699))

## 8.65.1
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all clean compile javadocs dryRelease update format checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check preMerge publish
.PHONY: all clean compile javadocs dryRelease update format checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical runNav3BackStackEntryMapperR8Test check preMerge publish

all: stop clean javadocs compile
assembleUiTests: assembleUiTestRelease
Expand Down Expand Up @@ -52,6 +52,10 @@ assembleUiTestCriticalRelease:
runUiTestCritical:
./scripts/test-ui-critical.sh

# Build and run the R8 check for BackStackEntryMapper.SerialName on a booted emulator
runNav3BackStackEntryMapperR8Test:
./scripts/test-nav3-backstack-entry-mapper-r8.sh

# Run tests and lint
check:
./gradlew check
Expand Down
42 changes: 42 additions & 0 deletions gradle/dependency-matrix.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Dependency test matrices, registered as the `matrixLibs` catalog: compile against the oldest
# supported version and test against newer releases too.
#
# Kept apart from libs.versions.toml so that each matrix's tests can run on PRs that change its
# versions, without also running on every unrelated dependency bump.
#
# Each matrix <name> has up to three version keys, named by role:
#
# - <name>-floor: the oldest version we support, which we compile and test against. Only changed
# by hand, in a reviewed change. No library entry references it, so Dependabot never bumps it.
# Builds apply it explicitly (e.g., `version { strictly(...) }`) instead.
# - <name>-stable: the latest stable release. Bumped by Dependabot through the <name>-stableTracker
# library entry, which references it and is used by no build.
# - <name>-preview: the latest pre-release, which is tested only while it's newer than
# <name>-stable. Bumped by a weekly updater job in .github/workflows/update-deps.yml. No library
# entry references it, so Dependabot never bumps it.
#
# Rules for adding a matrix:
#
# - Never give the floor or preview keys a library entry with `version.ref`, and never protect them
# with a Dependabot `ignore` rule: ignore rules match a dependency's group and name, so they would
# also stop Dependabot from bumping <name>-stable.
# - A stableTracker entry mustn't share its module with any entry or build file declaration that
# Dependabot also updates (e.g., in libs.versions.toml). Dependabot merges declarations of one
# module and bumps them all to one version. If they would collide, track a sibling artifact
# instead (e.g., `-jvm`).
#
# scripts/dependency-matrix.sh reads and writes these keys for CI and the updater jobs.

[versions]
# The oldest kotlinx.serialization version sentry-android-navigation3 supports, which it compiles and
# tests against. Before changing it, read the rules under "Version floor" in
# sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/internal/backstack/kotlinx/README.md.
kotlinxSerialization-floor = "1.7.3"
kotlinxSerialization-stable = "1.13.0"
# kotlinx.serialization publishes release candidates (-RC), but no alpha or beta releases.
kotlinxSerialization-preview = "1.12.0-RC"

[libraries]
# Applied with the floor version by the builds that use it.
kotlinxSerialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core" }
kotlinxSerialization-stableTracker = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinxSerialization-stable" }
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotl
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
buildconfig = { id = "com.github.gmazzo.buildconfig", version = "5.6.5" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
Expand Down
Loading
Loading