Skip to content
Open
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[*.{kt,kts}]
ktlint_experimental = disabled
ktlint_code_style = intellij_idea
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_class-signature = disabled
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] Your title about the bug"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Media**
If applicable, add screenshots or a video to help explain your problem.

**Additional context**
Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Suggestion] Your title here"
labels: suggestion
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

**Media**
Media to further explain this suggestion
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/other-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Other issue
about: Other issue not related to Bug report or Feature request
title: "[Other] Your title here"
labels: help wanted
assignees: ''

---

**Other issue? Please describe.**
A clear and concise description of what the problem is.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Media**
Media to further explain this issue.
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- Change #issue with the issue it is related, if it applies -->
Solves #issue1, #issue2, #issuen.

## 📋 Changelist Summary
Small description of this PR.

## 💬 Description
A longer description of this PR.

<!-- If this PR is not solving a bug, then remove this section -->
<!-- These steps are important in order to verify it has been solved -->
## 🐞 Steps to reproduce bug
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

## 📷 Media
Add media if applies.

<!-- Uncomment this table if you want to compare Before and After
| Before | After |
|------------------------------|-----------------------------------|
| <img width="500px" src="" /> | <img width="500px" src="" /> |
-->


## ℹ️ Extra info
Extra information of this PR, if any.
28 changes: 28 additions & 0 deletions .github/workflows/ktlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ktlint

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on: [pull_request]
jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest

permissions:
checks: write
contents: read
pull-requests: write

steps:
- name: Clone repo
uses: actions/checkout@master
with:
fetch-depth: 1
- name: ktlint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: true
46 changes: 46 additions & 0 deletions .github/workflows/sonarcloud-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY }}
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}

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: 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
52 changes: 49 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
plugins {
application
kotlin("jvm") version "2.1.20"
id("io.ktor.plugin") version "3.1.1"
alias(libs.plugins.kotlin.jvm)
jacoco
alias(libs.plugins.sonarqube)
alias(libs.plugins.plugin.serialization)
alias(libs.plugins.ktor.plugin)
}

group = "es.wokis"
Expand Down Expand Up @@ -69,4 +72,47 @@ ktor {
fatJar {
archiveFileName.set("${rootProject.name}-${rootProject.version}.jar")
}
}
}

tasks.shadowJar {
dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources", "distTar", "distZip"))
}

tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}

jacoco {
toolVersion = libs.versions.jacoco.get()
reportsDirectory = layout.buildDirectory.dir("customJacocoReportDir")
}

tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required = true
xml.outputLocation.set(file("build/reports/jacoco/test-results/jacocoTestReport.xml"))
csv.required = false
html.outputLocation = layout.buildDirectory.dir("jacocoHtml")
}
}

sonar {
properties {
val projectKey = System.getenv("SONAR_PROJECT_KEY")
val organization = System.getenv("SONAR_ORGANIZATION")
val exclusions = listOf(
"**/*BO.kt",
"**/*DTO.kt",
"**/*Exception.kt",
"src/main/kotlin/es/wokis/Application.kt",
"*.kts",
"**/di/*.kt",
)
property("sonar.projectKey", projectKey)
property("sonar.organization", organization)
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.coverage.exclusions", exclusions)
}
}
8 changes: 8 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ javamail-api = "2.1.3"
javamail = "2.0.1"
bcrypt = "0.4"
slf4j = "2.0.17"
sonarqube = "6.0.1.5171"
jacoco = "0.8.12"

[libraries]
# Ktor dependencies
Expand Down Expand Up @@ -60,3 +62,9 @@ kotlin-onetimepassword = { module = "dev.turingcomplete:kotlin-onetimepassword",

# Commons Codec
commons-codec = { module = "commons-codec:commons-codec", version.ref = "commons-codec" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
ktor-plugin = { id = "io.ktor.plugin", version.ref = "ktor" }
Empty file modified gradlew
100644 → 100755
Empty file.