diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..56a3f88 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: DWH Exporter Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + paths-ignore: + - 'README.md' + workflow_call: + +env: + NVD_API_TOKEN: ${{ secrets.NVD_API_KEY }} # Token to access NVD API for dependency-check + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + container: openjdk:17-jdk-slim + steps: + - uses: actions/checkout@v3 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: test + run: ./gradlew test + + dependency-scan: + name: Dependency Scan + runs-on: ubuntu-latest + container: openjdk:17-jdk-slim + steps: + - uses: actions/checkout@v3 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Scan dependencies + run: ./gradlew dependencyCheckAnalyze diff --git a/build.gradle b/build.gradle index 97d0e53..035b1ee 100644 --- a/build.gradle +++ b/build.gradle @@ -4,15 +4,15 @@ plugins { id 'org.springframework.boot' version "${springBootVersion}" id 'java' id 'idea' - id "org.cyclonedx.bom" version "1.7.4" - id "org.owasp.dependencycheck" version "8.4.0" - id "com.github.ben-manes.versions" version "0.49.0" + id "org.cyclonedx.bom" version "1.10.0" + id "org.owasp.dependencycheck" version "11.1.0" + id "com.github.ben-manes.versions" version "0.51.0" } apply plugin: 'io.spring.dependency-management' group = 'de.novatec' -version = '2.2' +version = '2.3' java { sourceCompatibility = '17' @@ -22,35 +22,30 @@ repositories { mavenCentral() } +test { + useJUnitPlatform() +} // We only use snakeyaml transitively, but we want to force the // current version due to existing CVEs. // According to https://github.com/spring-projects/spring-boot/issues/34405 // this is a safe -ext['snakeyaml.version'] = '2.0' +ext['snakeyaml.version'] = '2.3' dependencies { - annotationProcessor( - "org.projectlombok:lombok" - ) - - compileOnly( - "org.projectlombok:lombok" - ) + annotationProcessor("org.projectlombok:lombok:${lombokVersion}") + compileOnly("org.projectlombok:lombok:${lombokVersion}") implementation( 'org.springframework.boot:spring-boot-starter-web', 'org.springframework.boot:spring-boot-starter-actuator', 'org.springframework.boot:spring-boot-starter-validation', - 'org.apache.commons:commons-text:1.10.0', - // If indluxdb-java is updated, check new version of the transitive dependency okio-jvm - // If there is a higher new version, remove the dependency override of okio-jvm + "org.apache.commons:commons-text:${commonsTextVersion}", "org.influxdb:influxdb-java:${influxdbJavaVersion}", - // Override transitive dependency with newer version, due to security concerns - "com.squareup.okio:okio-jvm:${okioJvmVersion}", - ) + + testImplementation("org.springframework.boot:spring-boot-starter-test") } dependencyCheck { @@ -61,6 +56,10 @@ dependencyCheck { enabled = true } } + nvd { + apiKey = System.getenv("NVD_API_TOKEN") + delay = 10000 + } } def isNonStable = { String candidate -> diff --git a/gradle.properties b/gradle.properties index 46670f4..4a5917d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,8 @@ # Spring Boot -springBootVersion=3.1.4 +springBootVersion=3.3.5 -# If indluxdb-java is updated, check new version of the transitive dependency okio-jvm -# If there is a higher new version, remove the dependency override of okio-jvm -influxdbJavaVersion=2.23 -okioJvmVersion=3.5.0 +influxdbJavaVersion=2.24 + +commonsTextVersion=1.12.0 + +lombokVersion=1.18.36 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 744c64d..21d5e09 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/test/java/de/novatec/dwhexport/ApplicationTest.java b/src/test/java/de/novatec/dwhexport/ApplicationTest.java new file mode 100644 index 0000000..1b189a5 --- /dev/null +++ b/src/test/java/de/novatec/dwhexport/ApplicationTest.java @@ -0,0 +1,13 @@ +package de.novatec.dwhexport; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class ApplicationTest { + + @Test + void contextLoads() { + System.out.println("Spring context loads"); + } +}