diff --git a/.github/workflows/code_quality_check.yml b/.github/workflows/code_quality_check.yml index 79a580d338e..782e0a618c8 100644 --- a/.github/workflows/code_quality_check.yml +++ b/.github/workflows/code_quality_check.yml @@ -1,4 +1,4 @@ -name: Code Convention Verification +name: Code Quality Check on: push: @@ -14,7 +14,18 @@ jobs: checkstyle-and-spotless: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout branch + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} # Checkout the branch of the pull request + fetch-depth: 0 + + - name: List Changed Files + run: | + echo "Current branch: ${{ github.head_ref }}" + echo "Changed files:" + git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} + - name: Setup Java & Gradle uses: actions/setup-java@v4 @@ -38,8 +49,8 @@ jobs: - name: Run Checkstyle run: | - ./gradlew clean rskj-core:checkstyleMain checkstyleTest + ./gradlew clean rskj-core:checkstyleMain checkstyleTest --info - name: Run Spotless Check run: | - ./gradlew clean rskj-core:spotlessCheck + ./gradlew clean rskj-core:spotlessCheck --info diff --git a/rskj-core/build.gradle b/rskj-core/build.gradle index 0398a56048b..a2bd7582177 100644 --- a/rskj-core/build.gradle +++ b/rskj-core/build.gradle @@ -71,6 +71,12 @@ def getFilteredFiles() { def uncommittedFiles = outputDiff.toString().trim().split('\n').toList().unique() def stagedFiles = outputStaged.toString().trim().split('\n').toList().unique() def allFiles = committedFiles + uncommittedFiles + stagedFiles + + println("Committed files: ${committedFiles}") + println("Uncommitted files: ${uncommittedFiles}") + println("Staged files: ${stagedFiles}") + + allFiles = allFiles.unique().findAll { file -> file } allFiles = allFiles.findAll { file -> @@ -85,10 +91,20 @@ def configureCheckstyleTask(Checkstyle task, File sourceDir) { def files = getFilteredFiles() def filteredFilesCheckstyle = files.findAll { file -> def filePath = file.toPath().normalize() - def isUnderSourceDir = filePath.startsWith(sourceDirPath) && !filePath.equals(sourceDirPath) + def relativePath = sourceDirPath.relativize(filePath).toString() + def isUnderSourceDir = relativePath.startsWith("") && !relativePath.equals("") + + println "Checking file: ${file.absolutePath}" + println "Relative path: ${relativePath}, Under source dir: ${isUnderSourceDir}" + isUnderSourceDir } + + println "Filtered Checkstyle files: ${filteredFilesCheckstyle.collect { it.absolutePath }}" + task.source = project.files(filteredFilesCheckstyle) + println "Task source set to: ${task.source.files.collect { it.absolutePath }}" + task.classpath = project.files( sourceSets.main.output.classesDirs, sourceSets.main.output.resourcesDir @@ -98,7 +114,9 @@ def configureCheckstyleTask(Checkstyle task, File sourceDir) { html.required.set(true) } task.onlyIf { - !filteredFilesCheckstyle.isEmpty() + def hasFiles = !filteredFilesCheckstyle.isEmpty() + println "Checkstyle task only if: $hasFiles" + hasFiles } } diff --git a/rskj-core/src/main/java/co/rsk/config/GarbageCollectorConfig.java b/rskj-core/src/main/java/co/rsk/config/GarbageCollectorConfig.java index 518ec63dd13..131244724d8 100644 --- a/rskj-core/src/main/java/co/rsk/config/GarbageCollectorConfig.java +++ b/rskj-core/src/main/java/co/rsk/config/GarbageCollectorConfig.java @@ -28,6 +28,9 @@ public class GarbageCollectorConfig { private final int blocksPerEpoch; private final int numberOfEpochs; + + //asdasdasdsdsd + public GarbageCollectorConfig(boolean enabled, int blocksPerEpoch, int numberOfEpochs) { this.enabled = enabled; this.blocksPerEpoch = blocksPerEpoch;