Skip to content

Commit

Permalink
feat(ci): add danger-detekt integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacxe committed Jun 25, 2024
1 parent 8998b45 commit b683d60
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .danger/pr_detekt.df.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@file:DependsOn("io.github.vacxe.danger.kotlin:detekt:1.1.0")

import systems.danger.kotlin.*
import systems.danger.kotlin.models.github.*
import io.github.vacxe.danger.kotlin.detekt.*
import java.io.File

val detektPlugin = DetektPlugin { it.removePrefix("/home/runner/work/Kakao/Kakao/") }
register.plugin(detektPlugin)

danger(args) {
detektReport()
}

fun detektReport() {
val detektReportFile = File("build/reports/detekt/detekt.xml")
if (!detektReportFile.exists()) {
warn(
"Detekt report not exist",
)
} else {
detektPlugin.parseAndReport(detektReportFile)
}
}
17 changes: 17 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,24 @@ jobs:
with:
distribution: "temurin"
java-version: 17
cache: gradle
- name: detekt
run: |
./gradlew clean detekt
- name: Upload Detekt Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: detektArtifacts
path: build/reports/detekt
- name: Danger
uses: danger/[email protected]
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
dangerfile: ".danger/pr_detekt.df.kts"
args: "--failOnErrors --no-publish-check"

assemble-debug-apk:
needs: [ detekt ]
Expand All @@ -26,6 +41,7 @@ jobs:
with:
distribution: "temurin"
java-version: 17
cache: gradle
- name: Assemble Debug APK
run: bash ./gradlew sample:assembleDebug
- name: Upload app APK
Expand All @@ -45,6 +61,7 @@ jobs:
with:
distribution: "temurin"
java-version: 17
cache: gradle
- name: Assemble Instrumental APK
run: bash ./gradlew sample:assembleDebugAndroidTest
- name: Upload app APK
Expand Down
1 change: 0 additions & 1 deletion detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<ID>EmptyClassBlock:ToolbarViewActions.kt$ToolbarViewActions${ }</ID>
<ID>EmptyDefaultConstructor:SelectedChipMatcher.kt$SelectedChipMatcher$()</ID>
<ID>EmptyFunctionBlock:TestActivity.kt$TestActivity.&lt;no name provided>${}</ID>
<ID>MagicNumber:PickersActivity.kt$PickersActivity$10</ID>
<ID>MagicNumber:PickersActivity.kt$PickersActivity$1985</ID>
<ID>MagicNumber:PickersActivity.kt$PickersActivity$21</ID>
<ID>MagicNumber:PickersActivity.kt$PickersActivity$23</ID>
Expand Down

0 comments on commit b683d60

Please sign in to comment.