Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Test Detekt and Danger integration #126

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading