Skip to content

Commit

Permalink
Add a workflow to validate the snippets project
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Nov 2, 2024
1 parent 989868a commit 5f3ffd6
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/validate-snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Validate snippets"

on:
merge_group:
pull_request:
push:
branches: [ master ]

jobs:
validate_snippets:
name: "Validate snippets"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
snippets
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17

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

- name: Check codestyle
uses: axel-op/googlejavaformat-action@v3
with:
args: "--replace"
files: snippets/**/*.java
skip-commit: true

- name: Print codestyle issues
run: git --no-pager diff --exit-code

- name: Build
run: |
cd snippets
./gradlew check
2 changes: 1 addition & 1 deletion snippets/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
android-gradle-plugin = "8.6.1"
android-gradle-plugin = "8.7.2"
junit = "4.13.2"
robolectric = "4.13"

Expand Down
13 changes: 13 additions & 0 deletions snippets/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,26 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
resValues = false
shaders = false
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

testOptions {
unitTests.includeAndroidResources = true
}
}

dependencies {
testImplementation(libs.junit)
testImplementation(libs.robolectric)
}

tasks.withType(Test).configureEach {
it.testLogging.exceptionFormat = "full"
}

0 comments on commit 5f3ffd6

Please sign in to comment.