Skip to content

Commit

Permalink
Scafold
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarcpozas committed Apr 16, 2023
0 parents commit 0c8c647
Show file tree
Hide file tree
Showing 42 changed files with 998 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pull-request-max-lines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pull request max line checker

on: [pull_request]

concurrency :
group: pull-request-max-lines_${{ github.head_ref }}
cancel-in-progress : true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_max_size: '10'
s_max_size: '100'
m_max_size: '500'
l_max_size: '1000'
fail_if_xl: 'false'
26 changes: 26 additions & 0 deletions .github/workflows/pull-request-styler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pull request style checker

on: [pull_request]

concurrency :
group: pull-request-styler_${{ github.head_ref }}
cancel-in-progress : true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'corretto'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Check code format
run: ./gradlew ktlintCheck
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Utilizo un fichero TOML para la organización de las dependencias del proyecto,

He creado un @UseCase para extender la semantica del inyector de depencendias de Spring, así además de las ya conocidas como @Repository @Service etc, sigo añadiendo nuevos tipos para poder tener más granularidad
tratando así de evitar usar el @Component que es algo más generico

Utilizo OpenFeign como client HTTP, que esta inspirado en Retrofit (https://github.com/OpenFeign/feign)

Estamos usando Swagger con este repo https://springdoc.org/
60 changes: 60 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.springframework.boot") version "3.0.5"
id("io.spring.dependency-management") version "1.1.0"
id("org.jlleitschuh.gradle.ktlint") version "11.3.1"
kotlin("jvm") version "1.8.20"
kotlin("plugin.spring") version "1.8.20"
}

group = "oscar.c.pozas"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_17

repositories {
mavenCentral()
}

dependencies {
// Spring boot dependencies
implementation(libs.springboot.web)
implementation(libs.springboot.actuator)
implementation(libs.springboot.cache)
implementation(libs.springboot.data.redis)

// Spring cloud dependencies
implementation(libs.springcloud.openFeign)

// Spring doc Open API Spec
implementation(libs.springdoc.openapi)

// Jackson parser
implementation(libs.jackson.kotlin)

// Postgres SQL Driver
implementation(libs.postgresql)

// Exposed Kotlin SQL DSL
implementation(libs.exposed.core)
implementation(libs.exposed.dao)
implementation(libs.exposed.jdbc)

// Shedlock scheduler
implementation(libs.shedlock.spring)
implementation(libs.shedlock.redis)

// Test dependencies
testImplementation(libs.springboot.test)
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}

tasks.withType<Test> {
useJUnitPlatform()
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("externalLibs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.9"
services:

redis:
image: redis
container_name: redis-svc-kotlin-playground
ports:
- "6379:6379"

database:
image: postgres
container_name: postgres-svc-kotlin-playground
environment:
POSTGRES_USER: root
POSTGRES_DB: pokemon
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- ./docker/postgres:/docker-entrypoint-initdb.d
ports:
- "15432:5432"
5 changes: 5 additions & 0 deletions docker/postgres/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
create table if not exists pokemon(
id serial primary key,
pokedex integer not null,
name varchar(50) not null
);
28 changes: 28 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[versions]
kotlin = "1.8.20"
shedlock = "5.2.0"
exposed = "0.41.1"

[libraries]
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }

springboot-web = { module = "org.springframework.boot:spring-boot-starter-web" }
springboot-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator" }
springboot-test = { module = "org.springframework.boot:spring-boot-starter-test" }
springboot-cache = { module = "org.springframework.boot:spring-boot-starter-cache" }
springboot-data-redis = { module = "org.springframework.boot:spring-boot-starter-data-redis" }

springcloud-openFeign = { module = "org.springframework.cloud:spring-cloud-starter-openfeign", version = "4.0.2" }

springdoc-openapi = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version = "2.1.0" }

jackson-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin" }

shedlock-spring = { module = "net.javacrumbs.shedlock:shedlock-spring", version.ref = "shedlock" }
shedlock-redis = { module = "net.javacrumbs.shedlock:shedlock-provider-redis-spring", version.ref = "shedlock" }

exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" }
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }

postgresql = { module = "org.postgresql:postgresql", version = "42.2.27" }
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0c8c647

Please sign in to comment.