Skip to content

Migration to new package in Maven Central #6156

Migration to new package in Maven Central

Migration to new package in Maven Central #6156

Workflow file for this run

name: Run diKTat (snapshot)
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
diktat_snapshot_check:
name: 'Check the project using diktat snapshot plugin'
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
steps:
- uses: actions/checkout@v4
with:
# Fetch Git tags, so that semantic version can be calculated.
# Alternatively, run `git fetch --prune --unshallow --tags` as the
# next step, see
# https://github.com/actions/checkout/issues/206#issuecomment-607496604.
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
- name: 'Cache ~/.konan'
id: cache-konan
uses: actions/cache@v3
with:
path: |
~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-build-java${{ matrix.java-version }}
restore-keys: |
${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-
${{ runner.os }}-konan-
- name: 'Publish a snapshot version to local repo'
id: generateLibsForDiktatSnapshot
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: |
:diktat-api:publishToMavenLocal
:diktat-common:publishToMavenLocal
:diktat-ktlint-engine:publishToMavenLocal
:diktat-rules:publishToMavenLocal
:diktat-gradle-plugin:publishToMavenLocal
:generateLibsForDiktatSnapshot
-x detekt
-x test
# FixMe: return after 2.0.0
# -x diktatCheck
- name: 'Copy files and set flags'
run: |
echo "DIKTAT_SNAPSHOT=1" >> $GITHUB_ENV
mv gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.txt gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/diktat-convention-configuration.gradle.kts
- name: 'Override <gradle/libs.versions.toml>'
run: |
mv gradle/libs.versions.toml gradle/libs.versions.toml_current
mv build/diktat-snapshot/libs.versions.toml_snapshot gradle/libs.versions.toml
# FixMe: remove after 2.0.0
- name: 'Small hack to inject implementation and to run diktat properly from snapshot'
run: |
#!/bin/bash
file_path=gradle/plugins/build.gradle.kts
string_to_insert='
dependencies {
implementation(libs.diktat.gradle.plugin) {
exclude("io.github.detekt.sarif4k", "sarif4k")
}
}'
echo $string_to_insert >> $file_path
# copied from .github/workflows/diktat.yml
- uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: |
diktatCheck
mergeDiktatReports
-Pdiktat.githubActions=true
-Pdetekt.multiplatform.disabled=true
--continue
--build-cache
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF report to Github
uses: github/codeql-action/upload-sarif@v2
if: ${{ always() }}
with:
sarif_file: build/reports/diktat/diktat-merged.sarif
# override category to have a different with release version
category: diktat (snapshot)
- name: Upload SARIF artifacts
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: sarif-reports
path: "**/build/reports/diktat"
retention-days: 1