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 6abd4dd commit 09ad3c1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
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/kotlin@1.3.1
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

0 comments on commit 09ad3c1

Please sign in to comment.