Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/GitHub actions #1

Merged
merged 4 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/gradle-build-branches.yml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
44 changes: 35 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -22,15 +22,15 @@ 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'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
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'
}

Expand All @@ -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"
}
}
}
Expand All @@ -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'
}
}
}
}


2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.0.24-SNAPSHOT
version=1.0.24
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down