From ac958dbcfb6f49c5f477d7fa4f3b4cc9d18c031f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Santos?= Date: Wed, 24 Jul 2024 17:02:53 +0100 Subject: [PATCH] Setup Android lint --- .github/actions/setup/action.yml | 13 +++++ .github/workflows/validate.yml | 48 +++++++++++++++++++ composeApp/build.gradle.kts | 11 +++++ .../ic_launcher_foreground.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher.xml | 1 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 1 + iosApp/Podfile | 2 +- iosApp/Podfile.lock | 2 +- 8 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/validate.yml rename composeApp/src/androidMain/res/{drawable-v24 => drawable}/ic_launcher_foreground.xml (100%) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..664c03dc --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,13 @@ +name: 'Setup' +description: 'Setup Java, checkout and setup gradle' +runs: + using: "composite" + steps: + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Gradle cache + uses: gradle/actions/setup-gradle@v3 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000..f26496d4 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,48 @@ +name: Validate +on: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Build + runs-on: macos-latest + + strategy: + matrix: + type: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build Android + run: ./gradlew assemble${{ matrix.type }} + + - name: Build iOS + run: ./gradlew link${{ matrix.type }}FrameworkIosSimulatorArm64 + + android-lint: + name: Android Lint + runs-on: macos-latest + needs: [ build ] + + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run lint + run: ./gradlew lint + + - name: Uploads test reports + uses: actions/upload-artifact@v4 + if: failure() + with: + name: android-lint-report + path: composeApp/build/reports/ diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 7df336d5..e78648a3 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -32,6 +32,7 @@ kotlin { framework { baseName = "composeApp" isStatic = true + binaryOption("bundleId", "composeApp") } podfile = project.file("../iosApp/Podfile") @@ -53,6 +54,10 @@ kotlin { implementation(compose.components.uiToolingPreview) implementation(libs.kotlin.serialization) } + + all { + languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") + } } @OptIn(ExperimentalKotlinGradlePluginApi::class) @@ -96,4 +101,10 @@ android { dependencies { debugImplementation(libs.compose.ui.tooling) } + android { + lint { + warningsAsErrors = true + disable += "AndroidGradlePluginVersion" + } + } } diff --git a/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/composeApp/src/androidMain/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml rename to composeApp/src/androidMain/res/drawable/ic_launcher_foreground.xml diff --git a/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cfe..6f3b755b 100644 --- a/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -2,4 +2,5 @@ + \ No newline at end of file diff --git a/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cfe..6f3b755b 100644 --- a/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -2,4 +2,5 @@ + \ No newline at end of file diff --git a/iosApp/Podfile b/iosApp/Podfile index f3cd2a5a..c38ddd2b 100644 --- a/iosApp/Podfile +++ b/iosApp/Podfile @@ -1,4 +1,4 @@ -platform :ios, '9.0' +platform :ios, '12.0' use_frameworks! target 'iosApp' do diff --git a/iosApp/Podfile.lock b/iosApp/Podfile.lock index 2c88a8c9..b16758ea 100644 --- a/iosApp/Podfile.lock +++ b/iosApp/Podfile.lock @@ -41,6 +41,6 @@ SPEC CHECKSUMS: libz: 83658eb2a0db785623ffdf9ce13407e6b8b5c8f9 oonimkall: 9768ce9dad18265d45d2ea972c84fb0bd5237cc3 -PODFILE CHECKSUM: 9f3463701e9fb15f3dded022f7afabede102208e +PODFILE CHECKSUM: 04b498ba1984c25e9816234b0551222184c25492 COCOAPODS: 1.15.2