diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/review.yaml similarity index 58% rename from .github/workflows/build_and_test.yaml rename to .github/workflows/review.yaml index 415e3fb1..5574145f 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/review.yaml @@ -24,3 +24,21 @@ jobs: - name: Run JVM tests and Debug Unit Tests run: ./gradlew allTests + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2.2 + + - name: Install Bundle + run: | + gem install bundler + bundle install + + - name: Run Lint + run: ./gradlew ktlintCheck + + - name: Run Danger + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: bundle exec danger diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 00000000..9d8f6191 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,15 @@ +github.dismiss_out_of_range_messages + +# assign pr author to assignee +if github.pr_json['assignee'] == nil + github.api.add_assignees( + github.pr_json['base']['repo']['full_name'], + github.pr_json['number'], + [github.pr_author] + ) +end + +checkstyle_format.base_path = Dir.pwd +Dir.glob("build/reports/**/*.xml") do |file| + checkstyle_format.report file +end diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..d67a2b8b --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem "danger" +gem "danger-checkstyle_format" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..76f1f749 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,76 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + base64 (0.2.0) + 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.4.3) + 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 (>= 4.0) + terminal-table (>= 1, < 4) + danger-checkstyle_format (0.1.1) + danger-plugin-api (~> 1.0) + ox (~> 2.0) + danger-plugin-api (1.0.0) + danger (> 2.0) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-http-cache (2.5.1) + faraday (>= 0.8) + faraday-net_http (3.1.0) + net-http + git (1.19.1) + addressable (~> 2.8) + rchardet (~> 1.8) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + nap (1.1.0) + net-http (0.4.1) + uri + no_proxy_fix (0.1.2) + octokit (8.1.0) + base64 + faraday (>= 1, < 3) + sawyer (~> 0.9) + open4 (1.3.4) + ox (2.14.18) + public_suffix (5.0.5) + rchardet (1.8.0) + rexml (3.2.6) + 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) + uri (0.13.0) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + danger + danger-checkstyle_format + +BUNDLED WITH + 2.5.7 diff --git a/build-logic/convention/src/main/kotlin/com/github/kitakkun/backintime/convention/LintConventionPlugin.kt b/build-logic/convention/src/main/kotlin/com/github/kitakkun/backintime/convention/LintConventionPlugin.kt index 3b818185..85a82f46 100644 --- a/build-logic/convention/src/main/kotlin/com/github/kitakkun/backintime/convention/LintConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/com/github/kitakkun/backintime/convention/LintConventionPlugin.kt @@ -5,6 +5,7 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.configure import org.jlleitschuh.gradle.ktlint.KtlintExtension +import org.jlleitschuh.gradle.ktlint.reporter.ReporterType class LintConventionPlugin : Plugin { override fun apply(target: Project) { @@ -16,6 +17,9 @@ class LintConventionPlugin : Plugin { configure { version.set(libs.findVersion("ktlint").get().requiredVersion) ignoreFailures.set(true) + reporters { + reporter(ReporterType.CHECKSTYLE) + } } } }