Skip to content

Commit 7659925

Browse files
authored
Merge branch 'main' into move-android-instrumented-test
2 parents 8d89a89 + 3cf6f64 commit 7659925

File tree

274 files changed

+5658
-1071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+5658
-1071
lines changed

.github/pull_request_template.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
Thanks for submitting a pull request. Please include the following information.
1+
**DO NOT CREATE A PULL REQUEST WITHOUT READING THESE INSTRUCTIONS**
22

3-
**What I have done and why**
4-
Include a summary of what your pull request contains, and why you have made these changes.
3+
## Instructions
4+
Thanks for submitting a pull request. To accept your pull request we need you do a few things:
5+
6+
**If this is your first pull request**
7+
8+
- [Sign the contributors license agreement](https://cla.developers.google.com/)
9+
10+
**Ensure tests pass and code is formatted correctly**
511

6-
Fixes #<issue_number_goes_here>
12+
- Run local tests on the `DemoDebug` variant by running `./gradlew testDemoDebug`
13+
- Fix code formatting: `./gradlew --init-script gradle/init.gradle.kts spotlessApply`
714

8-
**Do tests pass?**
9-
- [ ] Run local tests on `DemoDebug` variant: `./gradlew testDemoDebug`
10-
- [ ] Check formatting: `./gradlew --init-script gradle/init.gradle.kts spotlessApply`
15+
**Add a description**
1116

12-
**Is this your first pull request?**
13-
- [ ] [Sign the CLA](https://cla.developers.google.com/)
14-
- [ ] Run `./tools/setup.sh`
15-
- [ ] Import the code formatting style as explained in [the setup script](/tools/setup.sh#L40).
17+
We need to know what you've done and why you've done it. Include a summary of what your pull request contains, and why you have made these changes. Include links to any relevant issues which it fixes.
1618

19+
[Here's an example](https://github.com/android/nowinandroid/pull/1257).
20+
21+
**NOW DELETE THIS LINE AND EVERYTHING ABOVE IT**
22+
23+
**What I have done and why**
1724

25+
\<add your PR description here\>

.github/workflows/Build.yaml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
permissions:
1919
contents: write
20+
pull-requests: write
2021

2122
timeout-minutes: 60
2223

@@ -25,7 +26,7 @@ jobs:
2526
uses: actions/checkout@v4
2627

2728
- name: Validate Gradle Wrapper
28-
uses: gradle/wrapper-validation-action@v1
29+
uses: gradle/wrapper-validation-action@v3
2930

3031
- name: Copy CI gradle.properties
3132
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
@@ -37,7 +38,7 @@ jobs:
3738
java-version: 17
3839

3940
- name: Setup Gradle
40-
uses: gradle/gradle-build-action@v2
41+
uses: gradle/gradle-build-action@v3
4142

4243
- name: Check build-logic
4344
run: ./gradlew check -p build-logic
@@ -100,12 +101,13 @@ jobs:
100101
commit_message: "🤖 Updates screenshots"
101102

102103
# Run local tests after screenshot tests to avoid wrong UP-TO-DATE. TODO: Ignore screenshots.
103-
- name: Run local tests
104+
- name: Run local tests and create report
104105
if: always()
105106
run: ./gradlew testDemoDebug :lint:test
106107
# Replace task exclusions with `-Pandroidx.baselineprofile.skipgeneration` when
107108
# https://android-review.googlesource.com/c/platform/frameworks/support/+/2602790 landed in a
108109
# release build
110+
109111
- name: Build all build type and flavor permutations
110112
run: ./gradlew :app:assemble :benchmarks:assemble
111113
-x pixel6Api33ProdNonMinifiedReleaseAndroidTest
@@ -119,13 +121,20 @@ jobs:
119121
name: APKs
120122
path: '**/build/outputs/apk/**/*.apk'
121123

122-
- name: Upload test results (XML)
124+
- name: Upload JVM local results (XML)
123125
if: always()
124126
uses: actions/upload-artifact@v4
125127
with:
126-
name: test-results
128+
name: local-test-results
127129
path: '**/build/test-results/test*UnitTest/**.xml'
128130

131+
- name: Upload screenshot results (PNG)
132+
if: always()
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: screenshot-test-results
136+
path: '**/build/outputs/roborazzi/*_compare.png'
137+
129138
- name: Check lint
130139
run: ./gradlew :app:lintProdRelease :app-nia-catalog:lintRelease :lint:lint
131140

@@ -178,12 +187,9 @@ jobs:
178187
java-version: 17
179188

180189
- name: Setup Gradle
181-
uses: gradle/gradle-build-action@v2
182-
183-
- name: Build projects before running emulator
184-
run: ./gradlew packageDemoDebug packageDemoDebugAndroidTest
190+
uses: gradle/gradle-build-action@v3
185191

186-
- name: Run instrumentation tests
192+
- name: Build projects and run instrumentation tests
187193
uses: reactivecircus/android-emulator-runner@v2
188194
with:
189195
api-level: ${{ matrix.api-level }}
@@ -193,9 +199,41 @@ jobs:
193199
heap-size: 600M
194200
script: ./gradlew connectedDemoDebugAndroidTest --daemon
195201

202+
- name: Run local tests (including Roborazzi) for the combined coverage report (only API 30)
203+
if: matrix.api-level == 30
204+
# There is no need to verify Roborazzi tests to generate coverage.
205+
run: ./gradlew testDemoDebugUnitTest -Proborazzi.test.verify=false # Add Prod if we ever add JVM tests for prod
206+
207+
# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod
208+
- name: Generate coverage reports for Debug variants (only API 30)
209+
if: matrix.api-level == 30
210+
run: ./gradlew createDemoDebugCombinedCoverageReport
211+
196212
- name: Upload test reports
197213
if: always()
198214
uses: actions/upload-artifact@v4
199215
with:
200216
name: test-reports-${{ matrix.api-level }}
201217
path: '**/build/reports/androidTests'
218+
219+
- name: Display local test coverage (only API 30)
220+
if: matrix.api-level == 30
221+
id: jacoco
222+
uses: madrapps/[email protected]
223+
with:
224+
title: Combined test coverage report
225+
min-coverage-overall: 40
226+
min-coverage-changed-files: 60
227+
paths: |
228+
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml
229+
token: ${{ secrets.GITHUB_TOKEN }}
230+
231+
- name: Upload local coverage reports (XML + HTML) (only API 30)
232+
if: matrix.api-level == 30
233+
uses: actions/upload-artifact@v4
234+
with:
235+
name: coverage-reports
236+
if-no-files-found: error
237+
compression-level: 1
238+
overwrite: false
239+
path: '**/build/reports/jacoco/'

.github/workflows/Release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/checkout@v4
2323

2424
- name: Validate Gradle Wrapper
25-
uses: gradle/wrapper-validation-action@v1
25+
uses: gradle/wrapper-validation-action@v3
2626

2727
- name: Copy CI gradle.properties
2828
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ tests against _all_ build variants which is both unecessary and will result in f
122122
A screenshot test takes a screenshot of a screen or a UI component within the app, and compares it
123123
with a previously recorded screenshot which is known to be rendered correctly.
124124

125-
For example, Now in Android has [screenshot tests](https://github.com/android/nowinandroid/blob/main/app/src/testDemoDebug/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppScreenSizesScreenshotTests.kt)
125+
For example, Now in Android has [screenshot tests](https://github.com/android/nowinandroid/blob/main/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppScreenSizesScreenshotTests.kt)
126126
to verify that the navigation is displayed correctly on different screen sizes
127-
([known correct screenshots](https://github.com/android/nowinandroid/tree/main/app/src/testDemoDebug/screenshots)).
127+
([known correct screenshots](https://github.com/android/nowinandroid/tree/main/app/src/testDemo/screenshots)).
128128

129129
Now In Android uses [Roborazzi](https://github.com/takahirom/roborazzi) to run screenshot tests
130130
of certain screens and UI components. When working with screenshot tests the following gradle tasks are useful:

app-nia-catalog/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# :app-nia-catalog module
2-
3-
![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.png)
2+
## Dependency graph
3+
![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.svg)

app-nia-catalog/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ android {
5959
// To publish on the Play store a private signing key is required, but to allow anyone
6060
// who clones the code to sign and run the release variant, use the debug signing key.
6161
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
62-
signingConfig = signingConfigs.getByName("debug")
62+
signingConfig = signingConfigs.named("debug").get()
6363
}
6464
}
6565
}

app-nia-catalog/dependencies/releaseRuntimeClasspath.txt

Lines changed: 72 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,72 @@
1-
androidx.activity:activity-compose:1.8.0
2-
androidx.activity:activity-ktx:1.8.0
3-
androidx.activity:activity:1.8.0
4-
androidx.annotation:annotation-experimental:1.3.1
5-
androidx.annotation:annotation-jvm:1.7.0
6-
androidx.annotation:annotation:1.7.0
1+
androidx.activity:activity-compose:1.8.2
2+
androidx.activity:activity-ktx:1.8.2
3+
androidx.activity:activity:1.8.2
4+
androidx.annotation:annotation-experimental:1.4.0
5+
androidx.annotation:annotation-jvm:1.7.1
6+
androidx.annotation:annotation:1.7.1
77
androidx.appcompat:appcompat-resources:1.6.1
88
androidx.arch.core:core-common:2.2.0
99
androidx.arch.core:core-runtime:2.2.0
1010
androidx.autofill:autofill:1.0.0
11-
androidx.browser:browser:1.6.0
12-
androidx.collection:collection-jvm:1.3.0
13-
androidx.collection:collection:1.3.0
14-
androidx.compose.animation:animation-android:1.5.4
15-
androidx.compose.animation:animation-core-android:1.5.4
16-
androidx.compose.animation:animation-core:1.5.4
17-
androidx.compose.animation:animation:1.5.4
18-
androidx.compose.foundation:foundation-android:1.5.4
19-
androidx.compose.foundation:foundation-layout-android:1.5.4
20-
androidx.compose.foundation:foundation-layout:1.5.4
21-
androidx.compose.foundation:foundation:1.5.4
22-
androidx.compose.material3:material3:1.1.2
23-
androidx.compose.material:material-icons-core-android:1.5.4
24-
androidx.compose.material:material-icons-core:1.5.4
25-
androidx.compose.material:material-icons-extended-android:1.5.4
26-
androidx.compose.material:material-icons-extended:1.5.4
27-
androidx.compose.material:material-ripple-android:1.5.4
28-
androidx.compose.material:material-ripple:1.5.4
29-
androidx.compose.runtime:runtime-android:1.5.4
30-
androidx.compose.runtime:runtime-saveable-android:1.5.4
31-
androidx.compose.runtime:runtime-saveable:1.5.4
32-
androidx.compose.runtime:runtime:1.5.4
33-
androidx.compose.ui:ui-android:1.5.4
34-
androidx.compose.ui:ui-geometry-android:1.5.4
35-
androidx.compose.ui:ui-geometry:1.5.4
36-
androidx.compose.ui:ui-graphics-android:1.5.4
37-
androidx.compose.ui:ui-graphics:1.5.4
38-
androidx.compose.ui:ui-text-android:1.5.4
39-
androidx.compose.ui:ui-text:1.5.4
40-
androidx.compose.ui:ui-tooling-preview-android:1.5.4
41-
androidx.compose.ui:ui-tooling-preview:1.5.4
42-
androidx.compose.ui:ui-unit-android:1.5.4
43-
androidx.compose.ui:ui-unit:1.5.4
44-
androidx.compose.ui:ui-util-android:1.5.4
45-
androidx.compose.ui:ui-util:1.5.4
46-
androidx.compose.ui:ui:1.5.4
47-
androidx.compose:compose-bom:2023.10.01
11+
androidx.browser:browser:1.8.0
12+
androidx.collection:collection-jvm:1.4.0
13+
androidx.collection:collection-ktx:1.4.0
14+
androidx.collection:collection:1.4.0
15+
androidx.compose.animation:animation-android:1.6.3
16+
androidx.compose.animation:animation-core-android:1.6.3
17+
androidx.compose.animation:animation-core:1.6.3
18+
androidx.compose.animation:animation:1.6.3
19+
androidx.compose.foundation:foundation-android:1.6.3
20+
androidx.compose.foundation:foundation-layout-android:1.6.3
21+
androidx.compose.foundation:foundation-layout:1.6.3
22+
androidx.compose.foundation:foundation:1.6.3
23+
androidx.compose.material3:material3-android:1.2.1
24+
androidx.compose.material3:material3:1.2.1
25+
androidx.compose.material:material-icons-core-android:1.6.3
26+
androidx.compose.material:material-icons-core:1.6.3
27+
androidx.compose.material:material-icons-extended-android:1.6.3
28+
androidx.compose.material:material-icons-extended:1.6.3
29+
androidx.compose.material:material-ripple-android:1.6.3
30+
androidx.compose.material:material-ripple:1.6.3
31+
androidx.compose.runtime:runtime-android:1.6.3
32+
androidx.compose.runtime:runtime-saveable-android:1.6.3
33+
androidx.compose.runtime:runtime-saveable:1.6.3
34+
androidx.compose.runtime:runtime:1.6.3
35+
androidx.compose.ui:ui-android:1.6.3
36+
androidx.compose.ui:ui-geometry-android:1.6.3
37+
androidx.compose.ui:ui-geometry:1.6.3
38+
androidx.compose.ui:ui-graphics-android:1.6.3
39+
androidx.compose.ui:ui-graphics:1.6.3
40+
androidx.compose.ui:ui-text-android:1.6.3
41+
androidx.compose.ui:ui-text:1.6.3
42+
androidx.compose.ui:ui-tooling-preview-android:1.6.3
43+
androidx.compose.ui:ui-tooling-preview:1.6.3
44+
androidx.compose.ui:ui-unit-android:1.6.3
45+
androidx.compose.ui:ui-unit:1.6.3
46+
androidx.compose.ui:ui-util-android:1.6.3
47+
androidx.compose.ui:ui-util:1.6.3
48+
androidx.compose.ui:ui:1.6.3
49+
androidx.compose:compose-bom:2024.02.02
4850
androidx.concurrent:concurrent-futures:1.1.0
4951
androidx.core:core-ktx:1.12.0
5052
androidx.core:core:1.12.0
5153
androidx.customview:customview-poolingcontainer:1.0.0
5254
androidx.customview:customview:1.0.0
53-
androidx.emoji2:emoji2:1.4.0
54-
androidx.exifinterface:exifinterface:1.3.6
55+
androidx.emoji2:emoji2:1.3.0
56+
androidx.exifinterface:exifinterface:1.3.7
5557
androidx.fragment:fragment:1.5.1
5658
androidx.interpolator:interpolator:1.0.0
57-
androidx.lifecycle:lifecycle-common-java8:2.6.2
58-
androidx.lifecycle:lifecycle-common:2.6.2
59-
androidx.lifecycle:lifecycle-livedata-core:2.6.2
60-
androidx.lifecycle:lifecycle-livedata:2.6.2
61-
androidx.lifecycle:lifecycle-process:2.6.2
62-
androidx.lifecycle:lifecycle-runtime-ktx:2.6.2
63-
androidx.lifecycle:lifecycle-runtime:2.6.2
64-
androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2
65-
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.2
66-
androidx.lifecycle:lifecycle-viewmodel:2.6.2
59+
androidx.lifecycle:lifecycle-common-java8:2.7.0
60+
androidx.lifecycle:lifecycle-common:2.7.0
61+
androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0
62+
androidx.lifecycle:lifecycle-livedata-core:2.7.0
63+
androidx.lifecycle:lifecycle-livedata:2.7.0
64+
androidx.lifecycle:lifecycle-process:2.7.0
65+
androidx.lifecycle:lifecycle-runtime-ktx:2.7.0
66+
androidx.lifecycle:lifecycle-runtime:2.7.0
67+
androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0
68+
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0
69+
androidx.lifecycle:lifecycle-viewmodel:2.7.0
6770
androidx.loader:loader:1.0.0
6871
androidx.metrics:metrics-performance:1.0.0-alpha04
6972
androidx.profileinstaller:profileinstaller:1.3.1
@@ -78,23 +81,23 @@ androidx.versionedparcelable:versionedparcelable:1.1.1
7881
androidx.viewpager:viewpager:1.0.0
7982
com.google.accompanist:accompanist-drawablepainter:0.32.0
8083
com.google.code.findbugs:jsr305:3.0.2
81-
com.google.dagger:dagger-lint-aar:2.50
82-
com.google.dagger:dagger:2.50
83-
com.google.dagger:hilt-android:2.50
84-
com.google.dagger:hilt-core:2.50
84+
com.google.dagger:dagger-lint-aar:2.51
85+
com.google.dagger:dagger:2.51
86+
com.google.dagger:hilt-android:2.51
87+
com.google.dagger:hilt-core:2.51
8588
com.google.guava:listenablefuture:1.0
8689
com.squareup.okhttp3:okhttp:4.12.0
87-
com.squareup.okio:okio-jvm:3.6.0
88-
com.squareup.okio:okio:3.6.0
89-
io.coil-kt:coil-base:2.5.0
90-
io.coil-kt:coil-compose-base:2.5.0
91-
io.coil-kt:coil-compose:2.5.0
92-
io.coil-kt:coil:2.5.0
90+
com.squareup.okio:okio-jvm:3.8.0
91+
com.squareup.okio:okio:3.8.0
92+
io.coil-kt:coil-base:2.6.0
93+
io.coil-kt:coil-compose-base:2.6.0
94+
io.coil-kt:coil-compose:2.6.0
95+
io.coil-kt:coil:2.6.0
9396
javax.inject:javax.inject:1
94-
org.jetbrains.kotlin:kotlin-stdlib-common:1.9.21
95-
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10
96-
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10
97-
org.jetbrains.kotlin:kotlin-stdlib:1.9.21
97+
org.jetbrains.kotlin:kotlin-stdlib-common:1.9.22
98+
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0
99+
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0
100+
org.jetbrains.kotlin:kotlin-stdlib:1.9.22
98101
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3
99102
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.3
100103
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3

app/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# :app module
2-
3-
![Dependency graph](../docs/images/graphs/dep_graph_app.png)
2+
## Dependency graph
3+
![Dependency graph](../docs/images/graphs/dep_graph_app.svg)

0 commit comments

Comments
 (0)