Skip to content
Merged
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
38 changes: 35 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,43 @@ jobs:
if: always()
run: release/signing-cleanup.sh

test:
screenshot-test:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

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

- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build tests & Create screenshots
run: ./gradlew verifyRoborazziDebug --stacktrace

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshot-test-results
path: |
**/build/reports/*
**/build/outputs/roborazzi

instrumented-test:
needs: [build, screenshot-test]
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
# Disable 21-23 for now as the devices seem to be flakey on CI
Expand Down Expand Up @@ -128,7 +160,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.api-level }}
name: instrumented-test-results-${{ matrix.api-level }}
path: |
**/build/reports/*
**/build/outputs/*/connected/*
Expand All @@ -137,7 +169,7 @@ jobs:
if: github.event_name == 'push' # only deploy for pushed commits (not PRs)

runs-on: ubuntu-latest
needs: [ build, test ]
needs: [ build, screenshot-test, instrumented-test ]
timeout-minutes: 30
env:
TERM: dumb
Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
./gradlew lintDebug
```

- roborazzi
```bash
./gradlew verifyRoborazziDebug
```
```bash
./gradlew compareRoborazziDebug
```

## Update baselines

- dependencyGuard
Expand All @@ -46,3 +54,8 @@
```bash
./gradlew metalavaGenerateSignatureRelease
```

- roborazzi
```bash
./gradlew recordRoborazziDebug
```
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.roborazzi) apply false
alias(libs.plugins.metalava) apply false
alias(libs.plugins.maven.publish) apply false
alias(libs.plugins.dependency.guard) apply false
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ android.nonTransitiveRClass=true
org.gradle.parallel=true
org.gradle.caching=true

# roborazzi
roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory

# publish
SONATYPE_HOST=CENTRAL_PORTAL
RELEASE_SIGNING_ENABLED=true

Expand Down
11 changes: 11 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ androidxtest-junit = "1.1.3"
espresso = "3.3.0"
junit = "4.13"

# Roborazzi for screenshot testing
roborazzi = "1.36.0"
robolectric = "4.14.1"

[libraries]

kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
Expand Down Expand Up @@ -52,6 +56,12 @@ androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core",

junit = { module = "junit:junit", version.ref = "junit" }

# Roborazzi dependencies
roborazzi = { module = "io.github.takahirom.roborazzi:roborazzi", version.ref = "roborazzi" }
roborazzi-compose = { module = "io.github.takahirom.roborazzi:roborazzi-compose", version.ref = "roborazzi" }
roborazzi-junit-rule = { module = "io.github.takahirom.roborazzi:roborazzi-junit-rule", version.ref = "roborazzi" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }

# Dependencies of the included build-logic
android-pluginGradle = { module = "com.android.tools.build:gradle", version.ref = "agp" }
kotlin-pluginGradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
Expand All @@ -62,6 +72,7 @@ android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }
jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
metalava = { id = "me.tylerbwong.gradle.metalava", version.ref = "metalava" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
Expand Down
14 changes: 10 additions & 4 deletions pre_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,33 @@ echo "Starting pre-check validations..."
echo ""

# Verify dependency changes
echo "🔍 [1/4] Checking dependency guard..."
echo "🔍 [1/5] Checking dependency guard..."
./gradlew dependencyGuard
echo "✓ Dependency guard check passed"
echo ""

# Verify code formatting
echo "🔍 [2/4] Checking code formatting..."
echo "🔍 [2/5] Checking code formatting..."
./gradlew spotlessCheck --init-script gradle/init.gradle.kts
echo "✓ Code formatting check passed"
echo ""

# Verify API compatibility
echo "🔍 [3/4] Checking API compatibility..."
echo "🔍 [3/5] Checking API compatibility..."
./gradlew metalavaCheckCompatibilityRelease
echo "✓ API compatibility check passed"
echo ""

# Static analysis and lint checks
echo "🔍 [4/4] Running lint checks..."
echo "🔍 [4/5] Running lint checks..."
./gradlew lintDebug
echo "✓ Lint check passed"
echo ""

# Verify screenshots
echo "🔍 [5/5] Checking screenshots..."
./gradlew verifyRoborazziDebug
echo "✓ Screenshots check passed"
echo ""

echo "✅ All pre-checks passed successfully!"
22 changes: 22 additions & 0 deletions readmore-foundation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("readmore.android.library")
id("readmore.android.compose")
alias(libs.plugins.roborazzi)
alias(libs.plugins.maven.publish)
alias(libs.plugins.jetbrains.dokka)
alias(libs.plugins.metalava)
Expand All @@ -16,6 +17,14 @@ android {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
testOptions {
unitTests {
includeAndroidResources = true
all {
it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"
}
}
}
}

metalava {
Expand All @@ -24,6 +33,10 @@ metalava {
reportLintsAsErrors.set(true)
}

roborazzi {
outputDir.set(file("screenshots"))
}

dependencies {
implementation libs.compose.foundation.foundation
implementation libs.compose.ui.util
Expand All @@ -32,6 +45,15 @@ dependencies {
// Test dependencies
// ======================

// Roborazzi for screenshot testing
testImplementation libs.roborazzi
testImplementation libs.roborazzi.compose
testImplementation libs.roborazzi.junit.rule
testImplementation libs.robolectric
testImplementation libs.junit
testImplementation libs.compose.ui.test.junit4
testImplementation libs.androidx.test.ext.junit

androidTestImplementation libs.junit
androidTestImplementation libs.androidx.test.core
androidTestImplementation libs.androidx.test.runner
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading