diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f60db461..a5f1b9efa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,6 @@ jobs: detekt: runs-on: ubuntu-latest - if: github.actor != 'renovate[bot]' steps: - uses: actions/checkout@v3 @@ -48,7 +47,6 @@ jobs: ktlint: runs-on: ubuntu-latest - if: github.actor != 'renovate[bot]' steps: - name: check out with token (used by forks) @@ -168,10 +166,55 @@ jobs: arguments: apicheck cache-read-only: false + modulecheck: + + runs-on: ubuntu-latest + if: github.actor != 'renovate[bot]' + steps: + - name: check out with token (used by forks) + uses: actions/checkout@v3 + if: github.event.pull_request.head.repo.full_name != github.repository + + - name: check out with PAT (used by main repo) + uses: actions/checkout@v3 + if: github.event.pull_request.head.repo.full_name == github.repository + with: + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + fetch-depth: 0 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '11' + + - name: ModuleCheck with auto-correct (used by main repo) + if: github.event.pull_request.head.repo.full_name == github.repository + uses: gradle/gradle-build-action@v2 + with: + arguments: moduleCheckAuto + cache-read-only: false + + # If KtLint generated changes, commit and push those changes. + - name: commit changes (used by main repo) + if: github.event.pull_request.head.repo.full_name == github.repository + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Apply ModuleCheck fixes + commit_options: '--no-verify --signoff' + + - name: ModuleCheck check (used by forks) + if: github.event.pull_request.head.repo.full_name != github.repository + uses: gradle/gradle-build-action@v2 + with: + arguments: moduleCheck + cache-read-only: false + dependency-guard: runs-on: ubuntu-latest - if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' + if: github.actor != 'renovate[bot]' steps: - uses: actions/checkout@v3 diff --git a/build.gradle.kts b/build.gradle.kts index 085e177a7..a604713d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -86,9 +86,15 @@ detekt { dependencies { detekt(libs.detekt.cli) + detektPlugins(projects.dispatchDetekt) } +moduleCheck { + deleteUnused = true + checks.sortDependencies = true +} + tasks.withType { setSource(files(rootDir)) @@ -118,7 +124,7 @@ extensions.configure { /** Packages that are excluded from public API dumps even if they contain public API. */ ignoredPackages = mutableSetOf("sample", "samples") - /** Sub-projects that are excluded from API validation */ + /** Sub-projects that are excluded from API validation. */ ignoredProjects = mutableSetOf( "dispatch-internal-test", "dispatch-internal-test-android", diff --git a/dispatch-android-lifecycle-extensions/build.gradle.kts b/dispatch-android-lifecycle-extensions/build.gradle.kts index edbd490ed..4d00aa9ff 100644 --- a/dispatch-android-lifecycle-extensions/build.gradle.kts +++ b/dispatch-android-lifecycle-extensions/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Rick Busarow + * Copyright (C) 2022 Rick Busarow * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -47,6 +47,6 @@ dependencies { testImplementation(projects.dispatchAndroidEspresso) testImplementation(projects.dispatchInternalTest) testImplementation(projects.dispatchInternalTestAndroid) + testImplementation(projects.dispatchTest) testImplementation(projects.dispatchTestJunit4) - testImplementation(projects.dispatchTestJunit5) } diff --git a/dispatch-android-viewmodel/build.gradle.kts b/dispatch-android-viewmodel/build.gradle.kts index f09b3eef1..b526f29db 100644 --- a/dispatch-android-viewmodel/build.gradle.kts +++ b/dispatch-android-viewmodel/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Rick Busarow + * Copyright (C) 2022 Rick Busarow * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,5 +41,4 @@ dependencies { testImplementation(projects.dispatchAndroidViewmodel) testImplementation(projects.dispatchInternalTest) testImplementation(projects.dispatchTest) - testImplementation(projects.dispatchTestJunit5) } diff --git a/dispatch-sample/build.gradle.kts b/dispatch-sample/build.gradle.kts index 3baa2732e..6db8d1fb7 100644 --- a/dispatch-sample/build.gradle.kts +++ b/dispatch-sample/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Rick Busarow + * Copyright (C) 2022 Rick Busarow * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,7 +30,7 @@ dependencies { androidTestImplementation(libs.androidx.test.espresso.core) androidTestImplementation(libs.androidx.test.runner) - androidTestImplementation(projects.dispatchAndroidEspresso) + api(projects.dispatchCore) implementation(libs.androidx.activity.ktx) implementation(libs.androidx.appcompat) @@ -43,9 +43,6 @@ dependencies { implementation(libs.timber) implementation(projects.dispatchAndroidLifecycle) - implementation(projects.dispatchAndroidLifecycleExtensions) - implementation(projects.dispatchAndroidViewmodel) - implementation(projects.dispatchCore) testImplementation(libs.junit.junit4) testImplementation(libs.junit.jupiter) @@ -53,7 +50,4 @@ dependencies { testImplementation(libs.kotest.properties) testImplementation(libs.kotest.runner) testImplementation(libs.kotlinx.coroutines.test) - - testImplementation(projects.dispatchTestJunit4) - testImplementation(projects.dispatchTestJunit5) } diff --git a/dispatch-test-junit4/build.gradle.kts b/dispatch-test-junit4/build.gradle.kts index a235b4c87..9950ff559 100644 --- a/dispatch-test-junit4/build.gradle.kts +++ b/dispatch-test-junit4/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Rick Busarow + * Copyright (C) 2022 Rick Busarow * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,7 +25,6 @@ dependencies { api(libs.junit.junit4) api(libs.kotlinx.coroutines.test) - api(projects.dispatchCore) api(projects.dispatchTest) implementation(libs.kotlinx.coroutines.core) @@ -38,5 +37,6 @@ dependencies { testImplementation(libs.kotlin.test.core) testImplementation(libs.mockk) + testImplementation(projects.dispatchCore) testImplementation(projects.dispatchInternalTest) } diff --git a/dispatch-test-junit5/build.gradle.kts b/dispatch-test-junit5/build.gradle.kts index 9159994f6..02b3df85d 100644 --- a/dispatch-test-junit5/build.gradle.kts +++ b/dispatch-test-junit5/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Rick Busarow + * Copyright (C) 2022 Rick Busarow * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,8 +32,6 @@ dependencies { implementation(libs.kotlinx.coroutines.jvm) implementation(libs.kotlinx.coroutines.test) - implementation(projects.dispatchCore) - testImplementation(libs.kotest.assertions) testImplementation(libs.kotest.properties) testImplementation(libs.kotest.runner) @@ -41,5 +39,6 @@ dependencies { testImplementation(libs.kotlin.test.core) testImplementation(libs.mockk) + testImplementation(projects.dispatchCore) testImplementation(projects.dispatchInternalTest) }