From 521878abf8bf51d44b33fa309e0f9895b3e18cfc Mon Sep 17 00:00:00 2001 From: Andrey Kuleshov Date: Sat, 19 Feb 2022 21:27:18 +0300 Subject: [PATCH] Updating diktat version and corresponding action, adding the integration with github ### What's done: - diktat action update --- .github/workflows/diktat.yml | 31 ++++++++++++++++++++++--------- buildSrc/build.gradle.kts | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/diktat.yml b/.github/workflows/diktat.yml index a3b1015d..b64a70f6 100644 --- a/.github/workflows/diktat.yml +++ b/.github/workflows/diktat.yml @@ -2,7 +2,7 @@ name: Run diKTat on: push: - branches: [ main ] + branches: [ master ] pull_request: jobs: @@ -12,18 +12,31 @@ jobs: GRADLE_OPTS: -Dorg.gradle.daemon=false steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v2.4.0 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: - java-version: 1.11 - - name: Gradle build with remote cache - uses: burrunan/gradle-cache-action@v1 + java-version: 11 + distribution: zulu + - uses: burrunan/gradle-cache-action@v1 with: - arguments: diktatCheckAll - properties: | - org.gradle.caching=true gradle-version: wrapper # additional files to calculate key for dependency cache gradle-dependencies-cache-key: | buildSrc/**/Versions.kt + arguments: | + diktatCheckAll + properties: | + diktat.githubActions=true + - name: Copy SARIF reports into a single directory + if: ${{ always() }} + # `find` cmd is a workaround for https://github.com/analysis-dev/diktat/issues/1213 + run: | + mkdir -p build/diktat-sarif-reports + i=0 + find . -regex '.*\(/[^/]*\)\1' | while read -r f; do echo "$f -> diktat-$i.sarif" && cp $f build/diktat-sarif-reports/diktat-$i.sarif || echo Cannot copy && echo Copied && i=$((i+1)); done + - name: Upload SARIF report to Github + uses: github/codeql-action/upload-sarif@v1 + if: ${{ always() }} + with: + sarif_file: build/diktat-sarif-reports diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5ac877d5..45e63f22 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { // this hack prevents the following bug: https://github.com/gradle/gradle/issues/9770 implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10") - implementation("org.cqfn.diktat:diktat-gradle-plugin:1.0.2") + implementation("org.cqfn.diktat:diktat-gradle-plugin:1.0.3") implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0") implementation("io.github.gradle-nexus:publish-plugin:1.1.0") implementation("org.ajoberstar.reckon:reckon-gradle:0.13.0")