Skip to content

Commit

Permalink
enable Paparazzi for the app module
Browse files Browse the repository at this point in the history
  • Loading branch information
frett committed Mar 8, 2024
1 parent 077825f commit d82aa9e
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
*.properties text
*.xml text
*.yml text

**/snapshots/**/*.png filter=lfs diff=lfs merge=lfs -text
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: 'true'
- name: Cache Maven
uses: actions/cache@v4
with:
Expand All @@ -101,7 +102,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run Unit Tests
run: ./gradlew test koverXmlReportDebug koverXmlReportProductionDebug --max-workers 1 --scan
run: ./gradlew test verifyPaparazzi koverXmlReportDebug koverXmlReportProductionDebug --max-workers 1 --scan
- name: Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/git-lfs-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Validate Git LFS"

on:
push:
branches: [develop, master, feature/*]
pull_request:
branches: [develop, master, feature/*]

jobs:
validate-lfs-pointers:
name: "Validate Git LFS pointers"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git lfs fsck --pointers
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ GodTools Android

[![codecov](https://codecov.io/gh/CruGlobal/godtools-android/branch/develop/graph/badge.svg)](https://codecov.io/gh/CruGlobal/godtools-android)

# Git LFS

We use [Git LFS](https://git-lfs.com/) for storing Paparazzi snapshots. You will need to setup [Git LFS](https://git-lfs.com/) on your local machine in order to store new paparazzi snapshots or validate existing paparazzi snapshots.

# OneSky

To enable OneSky translation downloads/uploads configure the following [gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties):
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.grgit)
alias(libs.plugins.hilt)
alias(libs.plugins.ksp)
alias(libs.plugins.paparazzi)
}

android {
Expand Down
3 changes: 3 additions & 0 deletions build-logic/src/main/kotlin/AndroidTestConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ internal fun TestedExtension.configureTestOptions(project: Project) {
}
}
}

// Paparazzi
project.fixGuavaDependencyForPaparazzi()
}
24 changes: 24 additions & 0 deletions build-logic/src/main/kotlin/PaparazziConfiguration.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import org.gradle.api.Project
import org.gradle.api.attributes.java.TargetJvmEnvironment

internal fun Project.fixGuavaDependencyForPaparazzi() {
plugins.withId("app.cash.paparazzi") {
// Defer until afterEvaluate so that testImplementation is created by Android plugin.
afterEvaluate {
dependencies.constraints {
add("testImplementation", "com.google.guava:guava") {
attributes {
attribute(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.STANDARD_JVM)
)
}
because(
"LayoutLib and sdk-common depend on Guava's -jre published variant. " +
"See https://github.com/cashapp/paparazzi/issues/906."
)
}
}
}
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,4 @@ grgit = { id = "org.ajoberstar.grgit", version = "5.2.2" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "dagger" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintGradle" }
paparazzi = { id = "app.cash.paparazzi", version = "1.3.3" }

0 comments on commit d82aa9e

Please sign in to comment.