From 5f3ffd61da0860b6a3e9cbfe3d06274166305769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Muller?= Date: Sat, 2 Nov 2024 10:09:02 +0100 Subject: [PATCH] Add a workflow to validate the `snippets` project --- .github/workflows/validate-snippets.yml | 42 +++++++++++++++++++++++++ snippets/gradle/libs.versions.toml | 2 +- snippets/java/build.gradle | 13 ++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/validate-snippets.yml diff --git a/.github/workflows/validate-snippets.yml b/.github/workflows/validate-snippets.yml new file mode 100644 index 000000000..a1ec35665 --- /dev/null +++ b/.github/workflows/validate-snippets.yml @@ -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 diff --git a/snippets/gradle/libs.versions.toml b/snippets/gradle/libs.versions.toml index a16e9f972..1ddc0116f 100644 --- a/snippets/gradle/libs.versions.toml +++ b/snippets/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -android-gradle-plugin = "8.6.1" +android-gradle-plugin = "8.7.2" junit = "4.13.2" robolectric = "4.13" diff --git a/snippets/java/build.gradle b/snippets/java/build.gradle index 28389c9d6..ed18a803c 100644 --- a/snippets/java/build.gradle +++ b/snippets/java/build.gradle @@ -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" +}