mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
BIT-755: Add Kover and Danger for code coverage (#103)
This commit is contained in:
parent
e167d7635c
commit
84d10d7634
8 changed files with 160 additions and 1 deletions
14
.github/workflows/run-check.yml
vendored
14
.github/workflows/run-check.yml
vendored
|
@ -7,6 +7,7 @@ on:
|
|||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
JAVA_VERSION: 17
|
||||
RUBY_VERSION: 3.2.2
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
@ -21,6 +22,12 @@ jobs:
|
|||
# https://github.community/t/push-from-action-even-with-pat-does-not-trigger-action/17622
|
||||
persist-credentials: false
|
||||
|
||||
- name: Configure Ruby
|
||||
uses: ruby/setup-ruby@52b8784594ec115fd17094752708121dc5dabb47 # v1.154.0
|
||||
with:
|
||||
bundler-cache: true
|
||||
ruby-version: ${{ env.RUBY_VERSION }}
|
||||
|
||||
- name: Configure JDK
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
|
||||
with:
|
||||
|
@ -30,4 +37,9 @@ jobs:
|
|||
- name: Build and Run Check
|
||||
# Run checks while excluding release-build tests, which are not configured to work properly
|
||||
# with the Compose testing library.
|
||||
run: ./gradlew check -x testRelease
|
||||
run: ./gradlew check -x testRelease koverXmlReportDebug
|
||||
|
||||
- name: Danger
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: bundle exec danger
|
||||
|
|
1
Dangerfile
Normal file
1
Dangerfile
Normal file
|
@ -0,0 +1 @@
|
|||
shroud.reportKover 'App', 'app/build/reports/kover/reportDebug.xml', 80, 80, false
|
6
Gemfile
Normal file
6
Gemfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
ruby '3.2.2'
|
||||
|
||||
gem 'danger'
|
||||
gem 'danger-shroud'
|
80
Gemfile.lock
Normal file
80
Gemfile.lock
Normal file
|
@ -0,0 +1,80 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.5)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
base64 (0.1.1)
|
||||
claide (1.1.0)
|
||||
claide-plugins (0.9.2)
|
||||
cork
|
||||
nap
|
||||
open4 (~> 1.3)
|
||||
colored2 (3.1.2)
|
||||
cork (0.3.0)
|
||||
colored2 (~> 3.1)
|
||||
danger (9.3.2)
|
||||
claide (~> 1.0)
|
||||
claide-plugins (>= 0.9.2)
|
||||
colored2 (~> 3.1)
|
||||
cork (~> 0.1)
|
||||
faraday (>= 0.9.0, < 3.0)
|
||||
faraday-http-cache (~> 2.0)
|
||||
git (~> 1.13)
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
no_proxy_fix
|
||||
octokit (~> 6.0)
|
||||
terminal-table (>= 1, < 4)
|
||||
danger-plugin-api (1.0.0)
|
||||
danger (> 2.0)
|
||||
danger-shroud (0.0.6)
|
||||
danger-plugin-api (~> 1.0)
|
||||
nokogiri
|
||||
faraday (2.7.11)
|
||||
base64
|
||||
faraday-net_http (>= 2.0, < 3.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-http-cache (2.5.0)
|
||||
faraday (>= 0.8)
|
||||
faraday-net_http (3.0.2)
|
||||
git (1.18.0)
|
||||
addressable (~> 2.8)
|
||||
rchardet (~> 1.8)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
mini_portile2 (2.8.4)
|
||||
nap (1.1.0)
|
||||
no_proxy_fix (0.1.2)
|
||||
nokogiri (1.15.4)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
octokit (6.1.1)
|
||||
faraday (>= 1, < 3)
|
||||
sawyer (~> 0.9)
|
||||
open4 (1.3.4)
|
||||
public_suffix (5.0.3)
|
||||
racc (1.7.1)
|
||||
rchardet (1.8.0)
|
||||
rexml (3.2.6)
|
||||
ruby2_keywords (0.0.5)
|
||||
sawyer (0.9.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (>= 0.17.3, < 3)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
unicode-display_width (2.5.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
danger
|
||||
danger-shroud
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.2.2p53
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
19
README.md
19
README.md
|
@ -165,3 +165,22 @@ The following is a list of additional third-party dependencies used as part of t
|
|||
- https://github.com/cashapp/turbine
|
||||
- Purpose: A small testing library for kotlinx.coroutine's Flow.
|
||||
- License: Apache 2.0
|
||||
|
||||
### CI/CD Dependencies
|
||||
|
||||
The following is a list of additional third-party dependencies used as part of the CI/CD workflows. These are not present in the final packaged application.
|
||||
|
||||
- **Danger**
|
||||
- https://github.com/danger/danger
|
||||
- Purpose: Provides a system for enforcing common Pull Request rules.
|
||||
- License: MIT
|
||||
|
||||
- **Danger Shroud**
|
||||
- https://github.com/livefront/danger-shroud
|
||||
- Purpose: A Danger plugin for enforcing code coverage via Kover / Jacoco.
|
||||
- License: Apache 2.0
|
||||
|
||||
- **Kover**
|
||||
- https://github.com/Kotlin/kotlinx-kover
|
||||
- Purpose: Kotlin code coverage toolset.
|
||||
- License: Apache 2.0
|
||||
|
|
|
@ -5,6 +5,7 @@ plugins {
|
|||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.kotlin.parcelize)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
alias(libs.plugins.kotlinx.kover)
|
||||
alias(libs.plugins.ksp)
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
@ -132,6 +133,43 @@ detekt {
|
|||
config.from(files("$rootDir/detekt-config.yml"))
|
||||
}
|
||||
|
||||
kover {
|
||||
excludeJavaCode()
|
||||
}
|
||||
|
||||
koverReport {
|
||||
filters {
|
||||
excludes {
|
||||
annotatedBy(
|
||||
// Compose previews
|
||||
"androidx.compose.ui.tooling.preview.Preview"
|
||||
)
|
||||
classes(
|
||||
// Navigation helpers
|
||||
"*.*NavigationKt*",
|
||||
// Composable singletons
|
||||
"*.*ComposableSingletons*",
|
||||
|
||||
// OS-level components
|
||||
"com.x8bit.bitwarden.BitwardenApplication",
|
||||
"com.x8bit.bitwarden.MainActivity*",
|
||||
// Empty Composables
|
||||
"com.x8bit.bitwarden.ui.platform.feature.splash.SplashScreenKt",
|
||||
)
|
||||
packages(
|
||||
// Dependency injection
|
||||
"*.di",
|
||||
// Models
|
||||
"*.model",
|
||||
// Custom UI components
|
||||
"com.x8bit.bitwarden.ui.platform.components",
|
||||
// Theme-related code
|
||||
"com.x8bit.bitwarden.ui.platform.theme",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
getByName("check") {
|
||||
// Add detekt with type resolution to check
|
||||
|
|
|
@ -3,5 +3,6 @@ plugins {
|
|||
alias(libs.plugins.hilt) apply false
|
||||
alias(libs.plugins.kotlin.android) apply false
|
||||
alias(libs.plugins.kotlin.parcelize) apply false
|
||||
alias(libs.plugins.kotlinx.kover) apply false
|
||||
alias(libs.plugins.ksp) apply false
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ kotlin = "1.9.0"
|
|||
kotlinCompilerExtensionVersion = "1.5.1"
|
||||
kotlinxCoroutines = "1.7.3"
|
||||
kotlinxSerialization = "1.5.1"
|
||||
kotlinxKover = "0.7.3"
|
||||
ksp = "1.9.0-1.0.11"
|
||||
mockk = "1.13.5"
|
||||
okhttp = "4.11.0"
|
||||
|
@ -100,4 +101,5 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
|||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlinxKover" }
|
||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
|
|
Loading…
Reference in a new issue