diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..67d3422 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,38 @@ +stages: + - lint + - build + +# Reusable definitions +.gradle-cache: &gradle-cache + cache: + key: '$CI_PROJECT_ID-gradle' + paths: + - .gradle/ + - ~/.gradle/caches/ + +# Jobs +checkstyle: + <<: *gradle-cache + stage: lint + image: gradle:9.3.1-jdk25 + script: + - gradle checkstyleMain checkstyleTest + artifacts: + when: always + paths: + - build/reports/checkstyle/main.html + - build/reports/checkstyle/test.html + expose_as: 'Checkstyle Report' + expire_in: 1 week + rules: + - when: manual + +compile-check: + <<: *gradle-cache + stage: build + image: gradle:9.3.1-jdk25 + script: + - gradle compileTestJava + needs: [] + rules: + - when: manual diff --git a/build.gradle b/build.gradle index 9fd8b42..dbcd602 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,8 @@ plugins { id 'application' id 'java' id 'org.openjfx.javafxplugin' version '0.1.0' + id 'checkstyle' + id 'com.diffplug.spotless' version '7.0.2' } group = 'ch.unibas.dmi.dbis' @@ -43,6 +45,22 @@ test { useJUnitPlatform() } +checkstyle { + toolVersion = '10.21.0' + configFile = file('config/checkstyle/checkstyle.xml') + configProperties = [ + 'suppressionFile': file('config/checkstyle/suppressions.xml').absolutePath + ] +} + +spotless { + java { + googleJavaFormat() + importOrder() + removeUnusedImports() + } +} + tasks.named('jar', Jar) { manifest { attributes('Main-Class': application.mainClass.get()) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..746bba4 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 0000000..d532e42 --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + +