Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Dependabot #159

Merged
merged 4 commits into from
May 11, 2023
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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
3 changes: 3 additions & 0 deletions .github/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories:
- 'bug'
- title: '🧰 Maintenance'
label: 'chore'
- title: '🤖 Dependencies'
labels:
- 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
run_tests:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,19 @@ jobs:
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

automerge:
needs: run_tests_and_build
permissions:
pull-requests: write
contents: write
runs-on:
- self-hosted
- kaas
timeout-minutes: 15
if: github.actor == 'dependabot[bot]'
steps:
- name: Automerge dependabot PR
uses: fastify/github-action-merge-dependabot@v3
with:
target: minor
skip-commit-verification: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 gradle:7.6-jdk17-alpine as builder
FROM --platform=linux/amd64 gradle:8.1.1-jdk17-alpine as builder

WORKDIR /builder
COPY . .
Expand Down
32 changes: 16 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
plugins {
id("org.springframework.boot") version "3.0.1"
id("com.github.ben-manes.versions") version "0.44.0"
kotlin("jvm") version "1.8.0"
kotlin("plugin.allopen") version "1.8.0"
kotlin("plugin.spring") version "1.8.0"
kotlin("plugin.jpa") version "1.8.0"
id("org.springframework.boot") version "3.0.6"
id("com.github.ben-manes.versions") version "0.46.0"
kotlin("jvm") version "1.8.21"
kotlin("plugin.allopen") version "1.8.21"
kotlin("plugin.spring") version "1.8.21"
kotlin("plugin.jpa") version "1.8.21"
}

val kotlinVersion = "1.8.0"
val jacksonVersion = "2.14.1"
val springBootVersion = "3.0.1"
val junitVersion = "5.9.2"
val kotlinVersion = "1.8.21"
val jacksonVersion = "2.15.0"
val springBootVersion = "3.0.6"
val junitVersion = "5.9.3"

val ktlint: Configuration by configurations.creating

Expand All @@ -33,20 +33,20 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
implementation("jakarta.persistence:jakarta.persistence-api:3.1.0")
implementation("org.flywaydb:flyway-core:9.11.0")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.4")
implementation("org.flywaydb:flyway-core:9.17.0")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
implementation("com.google.firebase:firebase-admin:9.1.1")

runtimeOnly("org.postgresql:postgresql:42.5.1")
runtimeOnly("org.postgresql:postgresql:42.6.0")

testImplementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion")
testImplementation("org.assertj:assertj-core:3.24.1")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("io.zonky.test:embedded-database-spring-test:2.2.0")

ktlint("com.pinterest:ktlint:0.48.1") {
ktlint("com.pinterest:ktlint:0.49.0") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
10 changes: 2 additions & 8 deletions src/main/kotlin/three/consulting/epoc/service/CustomerService.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package three.consulting.epoc.service

import mu.KotlinLogging
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
Expand Down Expand Up @@ -57,13 +56,8 @@ class CustomerService(private val customerRepository: CustomerRepository) {
}

fun deleteCustomer(customerId: Long) {
try {
logger.info { "Deleting customer with id: $customerId" }
customerRepository.deleteById(customerId)
} catch (e: EmptyResultDataAccessException) {
logger.error(e) { "Cannot delete customer" }
throw UnableToDeleteCustomerException(customerId)
}
logger.info { "Deleting customer with id: $customerId" }
customerRepository.deleteById(customerId)
}

fun findAllCustomers(): List<CustomerDTO> {
Expand Down
10 changes: 2 additions & 8 deletions src/main/kotlin/three/consulting/epoc/service/EmployeeService.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package three.consulting.epoc.service

import mu.KotlinLogging
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
Expand Down Expand Up @@ -60,13 +59,8 @@ class EmployeeService(
}

fun deleteEmployee(employeeId: Long) {
try {
logger.info { "Deleting employee with id: $employeeId" }
employeeRepository.deleteById(employeeId)
} catch (e: EmptyResultDataAccessException) {
logger.error(e) { "Cannot delete employee" }
throw UnableToDeleteEmployeeException(employeeId)
}
logger.info { "Deleting employee with id: $employeeId" }
employeeRepository.deleteById(employeeId)
}

fun findAllEmployees(): List<EmployeeDTO> {
Expand Down
10 changes: 2 additions & 8 deletions src/main/kotlin/three/consulting/epoc/service/ProjectService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package three.consulting.epoc.service

import mu.KotlinLogging
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
Expand Down Expand Up @@ -78,13 +77,8 @@ class ProjectService(private val projectRepository: ProjectRepository) {
}

fun deleteProject(projectId: Long) {
try {
logger.info { "Deleting project with id: $projectId" }
projectRepository.deleteById(projectId)
} catch (e: EmptyResultDataAccessException) {
logger.error(e) { "Cannot delete project" }
throw UnableToDeleteProjectException(projectId)
}
logger.info { "Deleting project with id: $projectId" }
projectRepository.deleteById(projectId)
}

fun findAllProjects(): List<ProjectDTO> {
Expand Down
10 changes: 2 additions & 8 deletions src/main/kotlin/three/consulting/epoc/service/TaskService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package three.consulting.epoc.service

import mu.KotlinLogging
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
Expand Down Expand Up @@ -65,13 +64,8 @@ class TaskService(private val taskRepository: TaskRepository) {
}

fun deleteTask(taskId: Long) {
try {
logger.info { "Deleting task with id: $taskId" }
taskRepository.deleteById(taskId)
} catch (e: EmptyResultDataAccessException) {
logger.error(e) { "Cannot delete task" }
throw UnableToDeleteTaskException(taskId)
}
logger.info { "Deleting task with id: $taskId" }
taskRepository.deleteById(taskId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package three.consulting.epoc.service

import mu.KotlinLogging
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
Expand Down Expand Up @@ -96,13 +95,8 @@ class TimesheetEntryService(private val timesheetEntryRepository: TimesheetEntry
}

fun deleteTimesheetEntry(timesheetEntryId: Long) {
try {
logger.info { "Deleting timesheetEntry with id: $timesheetEntryId" }
timesheetEntryRepository.deleteById(timesheetEntryId)
} catch (e: EmptyResultDataAccessException) {
logger.error(e) { "Cannot delete timesheetEntry" }
throw UnableToDeleteTimesheetEntryException(timesheetEntryId)
}
logger.info { "Deleting timesheetEntry with id: $timesheetEntryId" }
timesheetEntryRepository.deleteById(timesheetEntryId)
}

fun hasValidEmails(timesheetEntries: List<TimesheetEntryDTO>, email: String): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package three.consulting.epoc.service

import mu.KotlinLogging
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
Expand Down Expand Up @@ -71,13 +70,8 @@ class TimesheetService(private val timesheetRepository: TimesheetRepository) {
}

fun deleteTimesheet(timesheetId: Long) {
try {
logger.info { "Deleting timesheet with id: $timesheetId" }
timesheetRepository.deleteById(timesheetId)
} catch (e: EmptyResultDataAccessException) {
logger.error(e) { "Cannot delete timesheet" }
throw UnableToDeleteTimesheetException(timesheetId)
}
logger.info { "Deleting timesheet with id: $timesheetId" }
timesheetRepository.deleteById(timesheetId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ class CustomerServiceIntegrationTest : IntegrationTest() {
assertThat(customerRepository.findByIdOrNull(3L)).isNull()
}

@Test
fun `delete customer with non-existing id raises error`() {
assertThatThrownBy { customerService.deleteCustomer(1000L) }
.isInstanceOf(UnableToDeleteCustomerException::class.java)
.hasMessage("Cannot delete customer, no customer found for the given id: 1000")
}

@Test
fun `get all customers`() {
val customers = customerService.findAllCustomers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ class EmployeeServiceIntegrationTest : IntegrationTest() {
assertThat(employeeRepository.findByIdOrNull(4L)).isNull()
}

@Test
fun `delete employee with non-existing id raise error`() {
assertThatThrownBy { employeeService.deleteEmployee(1000L) }
.isInstanceOf(UnableToDeleteEmployeeException::class.java)
.hasMessage("Cannot delete employee, no employee found for given id: 1000")
}

@Test
fun `get all employees`() {
val employees = employeeService.findAllEmployees()
Expand Down
Loading