-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#494] Replace danger-ruby with danger-kotlin
- Loading branch information
1 parent
c6cc06d
commit 2025322
Showing
2 changed files
with
61 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,30 +69,7 @@ jobs: | |
working-directory: ./template-compose | ||
run: ./gradlew koverMergedXmlReport | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.7' | ||
|
||
- name: Cache gems | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems- | ||
- name: Install Bundle and check environment versions | ||
run: | | ||
echo 'Install Bundle' | ||
bundle config path vendor/bundle | ||
bundle install | ||
echo 'Check environment setup versions' | ||
ruby --version | ||
gem --version | ||
bundler --version | ||
- name: Run Danger | ||
uses: danger/[email protected] | ||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: bundle exec danger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import systems.danger.kotlin.* | ||
|
||
// Make it more obvious that a PR is a work in progress and shouldn't be merged yet | ||
if (github.pr.title.contains("WIP")) { | ||
warn("PR is classed as Work in Progress") | ||
} | ||
|
||
// Warn when there is a big PR | ||
if (git.linesOfCode() > 500) { | ||
warn("Big PR") | ||
} | ||
|
||
// Warn to encourage a PR description | ||
if (github.pr.body.isEmpty()) { | ||
warn("Please provide a summary in the PR description to make it easier to review") | ||
} | ||
|
||
// Warn to encourage that labels should have been used on the PR | ||
if (github.pr.labels.isEmpty()) { | ||
warn("Please add labels to this PR") | ||
} | ||
|
||
// Check commits lint and warn on all checks (instead of failing) | ||
commitLint { | ||
warn = CommitLint.Warnings.ALL | ||
disable = listOf("subject_length") | ||
} | ||
|
||
// Detekt output check | ||
val detektDir = "**/build/reports/detekt/detekt-result.xml" | ||
val detektFiles = glob(detektDir) | ||
detektFiles.forEach { fileName -> | ||
kotlinDetekt { | ||
skipGradleTask = true | ||
reportFile = fileName | ||
detekt(inlineMode = true) | ||
} | ||
} | ||
|
||
// Android Lint output check | ||
val lintDir = "**/**/build/reports/lint/lint-result.xml" | ||
val lintFiles = glob(lintDir) | ||
lintFiles.forEach { fileName -> | ||
androidLint { | ||
skipGradleTask = true | ||
reportFile = fileName | ||
lint(inlineMode = true) | ||
} | ||
} | ||
|
||
// Show Danger test coverage report from Kover for templates | ||
// Report coverage of modified files, warn if total project coverage is under 80% | ||
// or if any modified file's coverage is under 90% | ||
val koverFileTemplateXml = "template-xml/build/reports/kover/merged/xml/report.xml" | ||
markdown("## Kover report for template-xml:") | ||
shroud.reportKover("Template - XML Unit Tests", koverFileTemplateXml, 80, 95, false) | ||
|
||
val koverFileTemplateCompose = "template-compose/build/reports/kover/merged/xml/report.xml" | ||
markdown("## Kover report for template-compose:") | ||
shroud.reportKover("Template - Compose Unit Tests", koverFileTemplateCompose, 80, 95, false) |