Skip to content

Commit

Permalink
Project upgrade (#5)
Browse files Browse the repository at this point in the history
* chore: configure github workflow

* chore: bump gradle version

* chore: bump project dependencies

* chore: bump wiremock dependency

* chore: fix ci

* chore: remove unused build variable
  • Loading branch information
rapatao authored Jun 2, 2024
1 parent de3d252 commit c391a47
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 46 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
60 changes: 60 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: install gpg
run: |
if [ ! `command -v gpg` ]; then
apt update
apt install -y gpg
fi
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: publish
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
./gradlew --no-daemon \
-Psigning.gnupg.executable=gpg \
-Psigning.gnupg.useLegacyGpg=true \
-Psigning.gnupg.keyName=${{ secrets.GPG_SIGN_KEY }} \
-Pversion=${GITHUB_REF_NAME} \
publishToSonatype
- name: close staging
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
./gradlew --no-daemon \
-Pversion=${GITHUB_REF_NAME} \
findSonatypeStagingRepository closeSonatypeStagingRepository
- name: release version
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
./gradlew --no-daemon \
-Pversion=${GITHUB_REF_NAME} \
findSonatypeStagingRepository releaseSonatypeStagingRepository
21 changes: 21 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Tests

on:
push:
branches:
- '**/**'

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: run project tests
run: ./gradlew test --no-daemon
61 changes: 26 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
plugins {
id "signing"
id 'maven-publish'
id "com.github.ben-manes.versions" version "${benManesVersionsVersion}"
id "io.github.gradle-nexus.publish-plugin" version "${publishPluginVersion}"
id "io.gitlab.arturbosch.detekt" version "${detektPluginVersion}"
id "io.micronaut.minimal.library" version "${micronautPluginVersion}"
id "org.jetbrains.dokka" version "${kotlinVersion}"
id "org.jetbrains.dokka" version "${dokkaVersion}"
id "org.jetbrains.kotlin.jvm" version "${kotlinVersion}"
id "org.jetbrains.kotlin.kapt" version "${kotlinVersion}"
id "org.jetbrains.kotlin.plugin.allopen" version "${kotlinVersion}"
id "org.jetbrains.kotlinx.kover" version "${koverPluginVersion}"
id "signing"
id 'maven-publish'
}

group = 'com.rapatao.micronaut'
version = '1.1.1-SNAPSHOT'

repositories {
mavenCentral()
}

micronaut {
version "3.7.1"
version "${micronautVersion}"
testRuntime "junit5"
processing {
incremental true
Expand All @@ -27,13 +28,14 @@ micronaut {
}

dependencies {
implementation("com.github.tomakehurst:wiremock-jre8:${wiremockVersion}")
api("org.wiremock:wiremock:${wiremockVersion}")

implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")

compileOnly("org.junit.jupiter:junit-jupiter-api")

testImplementation("io.micronaut.serde:micronaut-serde-jackson")
testImplementation("io.micronaut:micronaut-http-client")
}

Expand All @@ -50,20 +52,15 @@ compileTestKotlin {
kotlinOptions.jvmTarget = "${javaVersion}"
}

kover {
xmlReport {
onCheck = true
}

htmlReport {
onCheck = true
}
test {
useJUnitPlatform()
}

verify {
rule {
name = "Minimal line coverage rate in percents"
bound {
minValue = 90
kover {
reports {
verify {
rule {
minBound(90)
}
}
}
Expand All @@ -82,10 +79,19 @@ detekt {
}

signing {
sign configurations.archives
useGpgCmd()
sign publishing.publications
}

nexusPublishing {
repositories {
sonatype {
username = System.getenv('OSSRH_USERNAME')
password = System.getenv('OSSRH_PASSWORD')
}
}
}

publishing {
publications {
maven(MavenPublication) {
Expand Down Expand Up @@ -117,19 +123,4 @@ publishing {
}
}
}
repositories {
maven {
url = uri("${buildDir}/publishing-repository")
}
maven {
def releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
def snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
16 changes: 10 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
detektPluginVersion=1.21.0
javaVersion=1.8
kotlinVersion=1.7.20
koverPluginVersion=0.6.1
micronautPluginVersion=3.6.2
wiremockVersion=2.34.0
benManesVersionsVersion=0.51.0
detektPluginVersion=1.23.6
dokkaVersion=1.9.20
javaVersion=17
kotlinVersion=1.9.22
koverPluginVersion=0.8.0
micronautPluginVersion=4.4.0
micronautVersion=4.4.3
publishPluginVersion=2.0.0
wiremockVersion=3.6.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.github.tomakehurst.wiremock.WireMockServer
import com.github.tomakehurst.wiremock.client.WireMock
import com.github.tomakehurst.wiremock.core.Options
import com.github.tomakehurst.wiremock.core.WireMockConfiguration
import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer
import io.micronaut.context.annotation.Bean
import io.micronaut.context.annotation.Context
import io.micronaut.context.annotation.Factory
Expand All @@ -24,7 +23,6 @@ internal class WireMockFactory {
WireMockConfiguration.wireMockConfig()
.port(configuration.port)
.bindAddress(configuration.host)
.extensions(ResponseTemplateTransformer(true))

@Context
@Bean(preDestroy = "stop")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import io.micronaut.test.extensions.junit5.annotation.MicronautTest
import jakarta.inject.Inject
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test

@MicronautTest(environments = ["random"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import io.micronaut.test.extensions.junit5.annotation.MicronautTest
import jakarta.inject.Inject
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test

@MicronautTest(environments = ["random"])
Expand Down

0 comments on commit c391a47

Please sign in to comment.