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

Update dependencies and build #36

Merged
merged 6 commits into from
Aug 3, 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
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[*.{kt,kts}]
indent_size=2
insert_final_newline=true
max_line_length=100
disabled_rules=no-consecutive-blank-lines,no-blank-line-before-rbrace
max_line_length=120
kotlin_code_style=ktlint_official
ktlint_standard_no-consecutive-blank-lines=disabled
ktlint_standard_no-empty-first-line-in-class-body=disabled
ktlint_standard_no-blank-line-before-rbrace=disabled
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: adopt
java-version: '21'
distribution: temurin

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build & Test
uses: burrunan/gradle-cache-action@v1
run: ./gradlew check sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
job-id: jdk11-build-test
arguments: check sonar

- name: Report Tests
uses: dorny/test-reporter@v1
Expand Down
53 changes: 24 additions & 29 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: adopt
java-version: '21'
distribution: temurin

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build Artifacts & Documentation
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk11-build-test
arguments: build dokkaHtmlMultiModule -x test
properties: |
releaseVersion=${{ github.ref_name }}
run: >-
./gradlew
-PreleaseVersion=${{ github.ref_name }}
build dokkaHtmlMultiModule
-x test

- name: Publish Maven Release
uses: burrunan/gradle-cache-action@v1
run: >-
./gradlew
-PreleaseVersion=${{ github.ref_name }}
-PsonatypeUsername=${{ secrets.OSSRH_USER }} -PsonatypePassword=${{ secrets.OSSRH_PASS }}
publishToSonatype closeAndReleaseSonatypeStagingRepository
-x test
env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
with:
job-id: jdk11-build-test
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository -x test
properties: |
releaseVersion=${{ github.ref_name }}
sonatypeUsername=${{ secrets.OSSRH_USER }}
sonatypePassword=${{ secrets.OSSRH_PASS }}

- name: Publish Documentation
uses: JamesIves/github-pages-deploy-action@v4
Expand All @@ -54,14 +54,9 @@ jobs:
folder: build/dokka

- name: Publish GitHub Release
uses: burrunan/gradle-cache-action@v1
env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
with:
job-id: jdk11-build-test
arguments: githubRelease -x test
properties: |
releaseVersion=${{ github.ref_name }}
github.token=${{ secrets.GITHUB_TOKEN }}
run: >-
./gradlew
-PreleaseVersion=${{ github.ref_name }}
-Pgithub.token=${{ secrets.GITHUB_TOKEN }}
githubRelease
-x test
28 changes: 13 additions & 15 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: adopt
java-version: '21'
distribution: temurin

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build Artifacts & Documentation
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk11-build-test
arguments: build dokkaHtmlMultiModule -x test
run: ./gradlew build dokkaHtmlMultiModule -x test

- name: Publish Maven Artifacts (Snapshot)
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk11-build-test
arguments: publishToSonatype
properties: |
sonatypeUsername=${{ secrets.OSSRH_USER }}
sonatypePassword=${{ secrets.OSSRH_PASS }}
run: >-
./gradlew
-PsonatypeUsername=${{ secrets.OSSRH_USER }}
-PsonatypePassword=${{ secrets.OSSRH_PASS }}
publishToSonatype

- name: Publish Documentation
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
66 changes: 30 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.cadixdev.gradle.licenser.LicenseExtension
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension

plugins {

id("org.jetbrains.dokka")
id("com.github.breadmoirai.github-release")
id("org.sonarqube")
id("io.github.gradle-nexus.publish-plugin")

id("org.jetbrains.kotlinx.kover")

kotlin("jvm") apply (false)
id("org.cadixdev.licenser") apply (false)
Expand Down Expand Up @@ -46,11 +47,11 @@ allprojects {
configure(moduleNames.map { project(":sunday-$it") }) {

apply(plugin = "java-library")
apply(plugin = "jacoco")
apply(plugin = "maven-publish")
apply(plugin = "signing")

apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.cadixdev.licenser")
apply(plugin = "org.jmailen.kotlinter")
Expand Down Expand Up @@ -88,13 +89,14 @@ configure(moduleNames.map { project(":sunday-$it") }) {
withJavadocJar()
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
kotlinOptions {
languageVersion = kotlinVersion
apiVersion = kotlinVersion
}
jvmTarget = javaVersion
configure<KotlinJvmProjectExtension> {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
compilerOptions {
jvmTarget.set(JvmTarget.valueOf("JVM_$javaVersion"))
javaParameters.set(true)
freeCompilerArgs.add("-Xjvm-default=all")
}
}

Expand All @@ -103,10 +105,6 @@ configure(moduleNames.map { project(":sunday-$it") }) {
// TEST
//

configure<JacocoPluginExtension> {
toolVersion = "0.8.7"
}

tasks.named<Test>("test").configure {

useJUnitPlatform()
Expand All @@ -118,8 +116,6 @@ configure(moduleNames.map { project(":sunday-$it") }) {
}

reports.junitXml.required.set(true)

finalizedBy("jacocoTestReport")
}


Expand All @@ -133,9 +129,9 @@ configure(moduleNames.map { project(":sunday-$it") }) {
}

configure<DetektExtension> {
source = files("src/main/kotlin")
source.from("src/main/kotlin")

config = files("${rootProject.layout.projectDirectory}/src/main/detekt/detekt.yml")
config.from("${rootProject.layout.projectDirectory}/src/main/detekt/detekt.yml")
buildUponDefaultConfig = true
baseline = file("src/main/detekt/detekt-baseline.xml")
}
Expand All @@ -152,7 +148,7 @@ configure(moduleNames.map { project(":sunday-$it") }) {
tasks.named<DokkaTask>("dokkaHtml") {
failOnWarning.set(true)
suppressObviousFunctions.set(false)
outputDirectory.set(file("$buildDir/dokka/${project.version}"))
outputDirectory.set(file("${layout.buildDirectory.get()}/dokka/${project.version}"))
}

tasks.named<DokkaTask>("dokkaJavadoc") {
Expand Down Expand Up @@ -271,7 +267,7 @@ configure(moduleNames.map { project(":sunday-$it") }) {
// ANALYSIS
//

sonarqube {
sonar {
properties {
property("sonar.sources", "src/main")
property("sonar.tests", "src/test")
Expand All @@ -282,7 +278,7 @@ configure(moduleNames.map { project(":sunday-$it") }) {
property("sonar.jacoco.reportPaths", "")
property(
"sonar.coverage.jacoco.xmlReportPaths",
"$rootDir/code-coverage/build/reports/jacoco/testCoverageReport/testCoverageReport.xml",
"$rootDir/code-coverage/build/reports/kover/report.xml",
)
}
}
Expand All @@ -294,7 +290,7 @@ configure(moduleNames.map { project(":sunday-$it") }) {
// ANALYSIS
//

sonarqube {
sonar {
properties {
property("sonar.projectName", "sunday-kt")
property("sonar.projectKey", "outfoxx_sunday-kt")
Expand All @@ -309,7 +305,7 @@ sonarqube {
//

tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(buildDir.resolve("dokka/${releaseVersion}"))
outputDirectory.set(layout.buildDirectory.dir("dokka/${releaseVersion}"))
}


Expand All @@ -318,25 +314,23 @@ tasks.dokkaHtmlMultiModule.configure {
//

githubRelease {
owner("outfoxx")
repo("sunday-kt")
tagName(releaseVersion)
targetCommitish("main")
releaseName("🚀 v${releaseVersion}")
generateReleaseNotes(true)
draft(false)
prerelease(!releaseVersion.matches("""^\d+\.\d+\.\d+$""".toRegex()))
releaseAssets(
owner = "outfoxx"
repo = "sunday-kt"
tagName = releaseVersion
targetCommitish = "main"
releaseName = "🚀 v${releaseVersion}"
generateReleaseNotes = true
draft = false
prerelease = !releaseVersion.matches("""^\d+\.\d+\.\d+$""".toRegex())
releaseAssets.from(
moduleNames.flatMap { moduleName ->
listOf("", "-javadoc", "-sources").map { suffix ->
file("$rootDir/$moduleName/build/libs/sunday-$moduleName-$releaseVersion$suffix.jar")
}
}
)
overwrite(true)
authorization(
"Token " + (project.findProperty("github.token") as String? ?: System.getenv("GITHUB_TOKEN"))
)
overwrite = true
authorization = "Token " + (project.findProperty("github.token") as String? ?: System.getenv("GITHUB_TOKEN"))
}

nexusPublishing {
Expand Down
21 changes: 5 additions & 16 deletions code-coverage/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@

plugins {
base
id("jacoco-report-aggregation")
id("org.jetbrains.kotlinx.kover")
}

repositories {
mavenCentral()
}

dependencies {
jacocoAggregation(project(":sunday-core"))
jacocoAggregation(project(":sunday-jdk"))
jacocoAggregation(project(":sunday-okhttp"))
}

reporting {
reports {
create<JacocoCoverageReport>("testCoverageReport") {
testType.set(TestSuiteType.UNIT_TEST)
reportTask {
reports.xml.required.set(true)
}
}
}
kover(project(":sunday-core"))
kover(project(":sunday-jdk"))
kover(project(":sunday-okhttp"))
}

tasks {

check {
finalizedBy(named<JacocoReport>("testCoverageReport"))
finalizedBy(named("koverXmlReport"), named("koverHtmlReport"))
}

}
Loading