Skip to content

Commit

Permalink
apply ModuleCheck fixes and add it to CI (#569)
Browse files Browse the repository at this point in the history
PR-URL: #569
  • Loading branch information
RBusarow committed Aug 23, 2022
1 parent 1538cce commit d4fb689
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 21 deletions.
49 changes: 46 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -24,7 +24,6 @@ jobs:
detekt:

runs-on: ubuntu-latest
if: github.actor != 'renovate[bot]'

steps:
- uses: actions/checkout@v3
Expand All @@ -48,7 +47,6 @@ jobs:
ktlint:

runs-on: ubuntu-latest
if: github.actor != 'renovate[bot]'

steps:
- name: check out with token (used by forks)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion build.gradle.kts
Expand Up @@ -86,9 +86,15 @@ detekt {
dependencies {

detekt(libs.detekt.cli)

detektPlugins(projects.dispatchDetekt)
}

moduleCheck {
deleteUnused = true
checks.sortDependencies = true
}

tasks.withType<DetektCreateBaselineTask> {

setSource(files(rootDir))
Expand Down Expand Up @@ -118,7 +124,7 @@ extensions.configure<ApiValidationExtension> {
/** 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",
Expand Down
4 changes: 2 additions & 2 deletions 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
Expand Down Expand Up @@ -47,6 +47,6 @@ dependencies {
testImplementation(projects.dispatchAndroidEspresso)
testImplementation(projects.dispatchInternalTest)
testImplementation(projects.dispatchInternalTestAndroid)
testImplementation(projects.dispatchTest)
testImplementation(projects.dispatchTestJunit4)
testImplementation(projects.dispatchTestJunit5)
}
3 changes: 1 addition & 2 deletions 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
Expand Down Expand Up @@ -41,5 +41,4 @@ dependencies {
testImplementation(projects.dispatchAndroidViewmodel)
testImplementation(projects.dispatchInternalTest)
testImplementation(projects.dispatchTest)
testImplementation(projects.dispatchTestJunit5)
}
10 changes: 2 additions & 8 deletions 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
Expand Down Expand Up @@ -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)
Expand All @@ -43,17 +43,11 @@ dependencies {
implementation(libs.timber)

implementation(projects.dispatchAndroidLifecycle)
implementation(projects.dispatchAndroidLifecycleExtensions)
implementation(projects.dispatchAndroidViewmodel)
implementation(projects.dispatchCore)

testImplementation(libs.junit.junit4)
testImplementation(libs.junit.jupiter)
testImplementation(libs.kotest.assertions)
testImplementation(libs.kotest.properties)
testImplementation(libs.kotest.runner)
testImplementation(libs.kotlinx.coroutines.test)

testImplementation(projects.dispatchTestJunit4)
testImplementation(projects.dispatchTestJunit5)
}
4 changes: 2 additions & 2 deletions 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
Expand All @@ -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)
Expand All @@ -38,5 +37,6 @@ dependencies {
testImplementation(libs.kotlin.test.core)
testImplementation(libs.mockk)

testImplementation(projects.dispatchCore)
testImplementation(projects.dispatchInternalTest)
}
5 changes: 2 additions & 3 deletions 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
Expand Down Expand Up @@ -32,14 +32,13 @@ 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)
testImplementation(libs.kotlin.test.common)
testImplementation(libs.kotlin.test.core)
testImplementation(libs.mockk)

testImplementation(projects.dispatchCore)
testImplementation(projects.dispatchInternalTest)
}

0 comments on commit d4fb689

Please sign in to comment.