diff --git a/.github/workflows/gradle-build-branches.yml b/.github/workflows/gradle-build-branches.yml new file mode 100644 index 00000000..83500239 --- /dev/null +++ b/.github/workflows/gradle-build-branches.yml @@ -0,0 +1,23 @@ +name: Build + +on: + push: + branches-ignore: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Set up JDK 21 for x64 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + architecture: x64 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml new file mode 100644 index 00000000..927d258b --- /dev/null +++ b/.github/workflows/gradle-build.yml @@ -0,0 +1,34 @@ +name: Build branch + +on: + push: + branches: + - main + +permissions: + packages: write + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Set up JDK 21 for x64 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + architecture: x64 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Setup git config + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" + - name: Build with Gradle + env: + GH_TOKEN: '${{secrets.GITHUB_TOKEN}}' + GH_BRANCH: '${{github.ref.name}}' + run: ./gradlew release -Prelease.useAutomaticVersion=true --stacktrace \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43122cd3..264b051a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,6 @@ +# deprecated +# In 2022 getmydeck was built and developed on gitlab + include: - template: Security/SAST.gitlab-ci.yml - template: Security/Dependency-Scanning.gitlab-ci.yml diff --git a/README.md b/README.md index f40d9011..23763f95 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # GetMyDeck +![Build](https://github.com/chrisingenhaag/actions/workflows/gradle-build.yml/badge.svg?branch=main) + Spring-Boot based api backend for [getmydeck.ingenhaag.dev](https://getmydeck.ingenhaag.dev) diff --git a/build.gradle b/build.gradle index ae2f3e59..5c2fcda5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { - id 'org.springframework.boot' version '3.2.3' + id 'org.springframework.boot' version '3.2.4' id 'io.spring.dependency-management' version '1.1.4' id 'java' id 'net.researchgate.release' version '3.0.2' - //id 'org.graalvm.buildtools.native' version '0.9.28' + id 'jacoco' } group = 'de.ingenhaag' @@ -22,7 +22,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.3.0' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.4.0' runtimeOnly 'io.micrometer:micrometer-registry-prometheus' @@ -30,7 +30,7 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-testcontainers' testImplementation 'org.testcontainers:junit-jupiter' testImplementation 'org.testcontainers:mongodb' - testImplementation 'de.cronn:validation-file-assertions:0.6.0' + testImplementation 'de.cronn:validation-file-assertions:0.7.0' testImplementation 'org.wiremock:wiremock-standalone:3.4.2' } @@ -39,14 +39,13 @@ tasks.named('test') { } bootBuildImage { - imageName = "registry.gitlab.com/cin/${project.name}:${project.version}" - tags = ["registry.gitlab.com/cin/${project.name}:${System.getenv("CI_COMMIT_BRANCH")}"] + imageName = "ghcr.io/chrisingenhaag/${project.name}:${project.version}" + tags = ["ghcr.io/chrisingenhaag/${project.name}:${System.getenv("GH_BRANCH")}"] publish = !project.version.contains("-SNAPSHOT") docker { publishRegistry { - url = System.getenv("CI_REGISTRY") ?: "n/a" - username = System.getenv("CI_REGISTRY_USER") ?: "n/a" - password = System.getenv("CI_REGISTRY_PASSWORD") ?: "n/a" + url = "https://ghcr.io" + token = System.getenv("GH_TOKEN") ?: "n/a" } } } @@ -56,5 +55,32 @@ release { git { requireBranch.set('main') pushOptions.add("-o ci.skip") + preCommitText = "[ci skip]" } } + +test { + finalizedBy jacocoTestReport, jacocoTestCoverageVerification +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.required = true + } +} + +jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = 0.80 + counter = 'LINE' + } + } + } +} + + diff --git a/gradle.properties b/gradle.properties index 86ce50b3..54267fe8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=1.0.24-SNAPSHOT +version=1.0.24 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c..d64cd491 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e093..a80b22ce 100644 --- 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.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME