-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up project and configurations (#1)
* Set up project * New SonarCloud integration New Changelog file * New Checkstyle integration New JaCoCo integration New Logback New Dockerfile Update Readme * Update build github-action pipeline New github codeowners file
- Loading branch information
1 parent
9f7d271
commit fbdb0eb
Showing
20 changed files
with
1,075 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
* @in2workspace/kizunaops @ocanades@outlook.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: SonarCloud | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build: | ||
name: Build and analyze | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'zulu' # Alternative distribution options are available | ||
|
||
- name: Make Gradlew Executable | ||
run: chmod +x ./gradlew | ||
|
||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: Build and analyze | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: ./gradlew build sonar --info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
### Added | ||
- Changelog file | ||
- SonarCloud integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# temp build | ||
FROM docker.io/gradle:8.5.0 AS TEMP_BUILD | ||
ARG SKIP_TESTS=false | ||
COPY build.gradle settings.gradle /home/gradle/src/ | ||
COPY src /home/gradle/src/src | ||
COPY gradle /home/gradle/src/gradle | ||
WORKDIR /home/gradle/src | ||
RUN if [ "$SKIP_TESTS" = "true" ]; then \ | ||
gradle build --no-daemon -x test; \ | ||
else \ | ||
gradle build --no-daemon; \ | ||
fi | ||
|
||
# build image | ||
FROM openjdk:17-alpine | ||
RUN addgroup -S nonroot \ | ||
&& adduser -S nonroot -G nonroot | ||
USER nonroot | ||
WORKDIR /app | ||
COPY --from=TEMP_BUILD /home/gradle/src/build/libs/*.jar /app/wallet-api.jar | ||
ENTRYPOINT ["java", "-jar", "/app/wallet-api.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
# Wallet API | ||
|
||
## Resources | ||
* [Google Java Style](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
plugins { | ||
id "java" | ||
id "org.springframework.boot" version "3.2.1" | ||
id "io.spring.dependency-management" version "1.1.4" | ||
id "org.sonarqube" version "4.4.1.3373" | ||
id "jacoco" | ||
id "checkstyle" | ||
id "org.owasp.dependencycheck" version "8.4.0" | ||
} | ||
|
||
group = "es.in2.wallet" | ||
version = "0.1.0" | ||
|
||
java { | ||
sourceCompatibility = "17" | ||
} | ||
|
||
jacoco { | ||
toolVersion = "0.8.9" | ||
} | ||
|
||
checkstyle { | ||
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml") | ||
} | ||
|
||
checkstyleMain { | ||
source ='src/main/java' | ||
} | ||
|
||
checkstyleTest { | ||
source ='src/test/java' | ||
} | ||
|
||
sonar { | ||
properties { | ||
property "sonar.projectKey", "in2workspace_wallet-server" | ||
property "sonar.organization", "in2workspace" | ||
property "sonar.host.url", "https://sonarcloud.io" | ||
property "sonar.coverage.exclusions", | ||
"src/main/java/es/in2/wallet/api/Application.java, " | ||
} | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
ext { | ||
set("springCloudVersion", "2023.0.0") | ||
} | ||
|
||
dependencies { | ||
// Spring | ||
implementation "org.springframework.boot:spring-boot-starter-webflux" | ||
implementation "org.springframework.boot:spring-boot-starter-security" | ||
implementation "org.springframework.boot:spring-boot-starter-validation" | ||
|
||
// JSON | ||
implementation "com.fasterxml.jackson.core:jackson-databind" | ||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" | ||
|
||
// Resilience | ||
implementation "org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j" | ||
|
||
// Key Vault | ||
implementation "org.springframework.cloud:spring-cloud-starter-vault-config" | ||
|
||
// Lombok | ||
compileOnly "org.projectlombok:lombok" | ||
annotationProcessor "org.projectlombok:lombok" | ||
|
||
// Docker | ||
developmentOnly "org.springframework.boot:spring-boot-docker-compose" | ||
|
||
// Documentation | ||
implementation "org.springdoc:springdoc-openapi-starter-webflux-ui:2.2.0" | ||
|
||
// Logging | ||
implementation "net.logstash.logback:logstash-logback-encoder:7.4" | ||
|
||
// Metrics | ||
implementation "org.springframework.boot:spring-boot-starter-actuator" | ||
implementation "io.micrometer:micrometer-tracing-bridge-brave" | ||
runtimeOnly "io.micrometer:micrometer-registry-prometheus" | ||
|
||
// Test | ||
testImplementation "org.springframework.boot:spring-boot-starter-test" | ||
testImplementation "org.springframework.boot:spring-boot-testcontainers" | ||
testImplementation "io.projectreactor:reactor-test" | ||
testImplementation "org.springframework.security:spring-security-test" | ||
testImplementation "org.testcontainers:junit-jupiter" | ||
testImplementation "org.testcontainers:vault" | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" | ||
} | ||
} | ||
|
||
tasks.named('compileJava') { | ||
inputs.files(tasks.named('processResources')) | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
finalizedBy(tasks.jacocoTestReport) | ||
} | ||
|
||
tasks.jacocoTestReport { | ||
dependsOn(tasks.test) | ||
reports { | ||
xml.required.set(true) | ||
csv.required.set(false) | ||
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml")) | ||
} | ||
afterEvaluate { | ||
classDirectories.setFrom(files(classDirectories.files.collect { | ||
fileTree(dir: it, exclude: [ | ||
"src/main/java/es/in2/wallet/api/Application.java" | ||
]) | ||
})) | ||
} | ||
} | ||
|
||
tasks.register('printVersion') { | ||
doLast { | ||
println version | ||
} | ||
} | ||
|
||
tasks.register('printProjectName') { | ||
doLast { | ||
println rootProject.name | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> | ||
|
||
<module name="Checker"> | ||
<property name="charset" value="UTF-8" /> | ||
<property name="severity" value="warning" /> | ||
<property name="fileExtensions" value="java, properties, xml" /> | ||
<!-- Excludes all 'module-info.java' files --> | ||
<!-- See https://checkstyle.org/config_filefilters.html --> | ||
<module name="BeforeExecutionExclusionFileFilter"> | ||
<property name="fileNamePattern" value="module\-info\.java$" /> | ||
</module> | ||
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter --> | ||
<module name="SuppressionFilter"> | ||
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}" default="checkstyle-suppressions.xml" /> | ||
<property name="optional" value="true" /> | ||
</module> | ||
<!-- Checks for whitespace --> | ||
<!-- See http://checkstyle.org/config_whitespace.html --> | ||
<module name="FileTabCharacter"> | ||
<property name="eachLine" value="true" /> | ||
</module> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE suppressions PUBLIC | ||
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" | ||
"https://checkstyle.org/dtds/suppressions_1_2.dtd"> | ||
<suppressions> | ||
<!-- Suppresses the 'FileTabCharacter' check for all files --> | ||
<!-- See https://checkstyle.org/config_filters.html#SuppressionFilter --> | ||
<suppress files=".*" checks="FileTabCharacter" /> | ||
</suppressions> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.