Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Commit 4b7b1b5

Browse files
committed
Project boilerplate
1 parent ca551ae commit 4b7b1b5

18 files changed

+665
-1
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
5+
indent_style = space
6+
indent_size = 3
7+
max_line_length = 120
8+
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.gradle.kts]
13+
indent_size = 3

.github/config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
todo:
2+
keyword: "// todo"

.github/stale.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 60
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
# Label to use when marking an issue as stale
10+
staleLabel: wontfix
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: >
13+
This issue has been automatically marked as stale because it has not had
14+
recent activity. It will be closed if no further activity occurs. Thank you
15+
for your contributions.
16+
# Comment to post when closing a stale issue. Set to `false` to disable
17+
closeComment: false

.github/workflows/PR.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PR-Test
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- '*.md'
7+
- '*.yml'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout the repo
15+
uses: actions/checkout@v3
16+
17+
- name: Setup JDK
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '8'
21+
distribution: 'zulu'
22+
23+
- name: Run tests
24+
run: ./gradlew check
25+
26+
- name: Bundle the build report
27+
if: failure()
28+
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip
29+
30+
- name: Upload the build report
31+
if: failure()
32+
uses: actions/upload-artifact@master
33+
with:
34+
name: error-report
35+
path: build-reports.zip
36+
37+
env:
38+
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

.github/workflows/master.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: master
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '*.md'
7+
- '*.yml'
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout the repo
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup JDK
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '8'
24+
distribution: 'zulu'
25+
26+
- name: Run tests
27+
run: ./gradlew check
28+
29+
- name: publish snapshots
30+
run: ./gradlew publish
31+
env:
32+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
33+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
34+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
35+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
36+
37+
- name: Bundle the build report
38+
if: failure()
39+
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip
40+
41+
- name: Upload the build report
42+
if: failure()
43+
uses: actions/upload-artifact@master
44+
with:
45+
name: error-report
46+
path: build-reports.zip
47+
48+
49+
env:
50+
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

.github/workflows/release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "The release version"
8+
required: true
9+
branch:
10+
description: "The branch to release from"
11+
required: true
12+
default: 'master'
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout the repo
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
ref: ${{ github.event.inputs.branch }}
24+
25+
- name: Setup JDK
26+
uses: actions/setup-java@v3
27+
with:
28+
java-version: '8'
29+
distribution: 'zulu'
30+
31+
- name: deploy to sonatype
32+
run: ./gradlew publish
33+
env:
34+
RELEASE_VERSION: ${{ github.event.inputs.version }}
35+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
36+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
37+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
38+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
39+
40+
env:
41+
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.class
2+
*.log
3+
.idea
4+
*.iml
5+
.kotlintest
6+
.gradle
7+
8+
target/
9+
build/
10+
/build/
11+
out/
12+
lib_managed/
13+
src_managed/
14+
project/boot/
15+
project/plugins/project/
16+
credentials.sbt
17+
/.idea/

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# kotest-extensions-ktor-swagger
1+
# kotest-extensions-ktor-openapi
2+
23
A ktor plugin for generating API docs based on executed tests

build.gradle.kts

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
4+
plugins {
5+
`java-library`
6+
signing
7+
`maven-publish`
8+
kotlin("jvm") version "1.6.21"
9+
}
10+
11+
group = "io.kotest.extensions"
12+
version = Ci.version
13+
14+
repositories {
15+
mavenCentral()
16+
maven {
17+
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
18+
}
19+
}
20+
21+
dependencies {
22+
api("io.ktor:ktor-server-core:2.1.2")
23+
testImplementation("io.ktor:ktor-client-apache:2.1.2")
24+
}
25+
26+
tasks.test {
27+
useJUnitPlatform()
28+
testLogging {
29+
showExceptions = true
30+
showStandardStreams = true
31+
exceptionFormat = TestExceptionFormat.FULL
32+
}
33+
}
34+
35+
tasks.withType<KotlinCompile> {
36+
kotlinOptions.jvmTarget = "11"
37+
}
38+
39+
val signingKey: String? by project
40+
val signingPassword: String? by project
41+
42+
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications
43+
44+
signing {
45+
useGpgCmd()
46+
if (signingKey != null && signingPassword != null) {
47+
@Suppress("UnstableApiUsage")
48+
useInMemoryPgpKeys(signingKey, signingPassword)
49+
}
50+
if (Ci.isRelease) {
51+
sign(publications)
52+
}
53+
}
54+
55+
java {
56+
withJavadocJar()
57+
withSourcesJar()
58+
}
59+
60+
publishing {
61+
repositories {
62+
maven {
63+
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
64+
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
65+
name = "deploy"
66+
url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl
67+
credentials {
68+
username = System.getenv("OSSRH_USERNAME") ?: ""
69+
password = System.getenv("OSSRH_PASSWORD") ?: ""
70+
}
71+
}
72+
}
73+
74+
publications {
75+
register("mavenJava", MavenPublication::class) {
76+
from(components["java"])
77+
pom {
78+
name.set("kotest-extensions-ktor-openapi")
79+
description.set("Kotest extension for generating open-API docs")
80+
url.set("https://www.github.com/kotest/kotest-extensions-ktor-openapi")
81+
82+
scm {
83+
connection.set("scm:git:http://www.github.com/kotest/kotest-extensions-ktor-openapi")
84+
developerConnection.set("scm:git:http://github.com/sksamuel")
85+
url.set("https://www.github.com/kotest/kotest-extensions-ktor-openapi")
86+
}
87+
88+
licenses {
89+
license {
90+
name.set("The Apache 2.0 License")
91+
url.set("https://opensource.org/licenses/Apache-2.0")
92+
}
93+
}
94+
95+
developers {
96+
developer {
97+
id.set("sksamuel")
98+
name.set("Stephen Samuel")
99+
email.set("[email protected]")
100+
}
101+
}
102+
}
103+
}
104+
}
105+
}

buildSrc/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
gradlePluginPortal()
7+
}

buildSrc/src/main/kotlin/Ci.kt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
object Ci {
2+
3+
// this is the version used for building snapshots
4+
// .GITHUB_RUN_NUMBER-snapshot will be appended
5+
private const val snapshotBase = "1.0.0"
6+
7+
private val githubRunNumber = System.getenv("GITHUB_RUN_NUMBER")
8+
9+
private val snapshotVersion = when (githubRunNumber) {
10+
null -> "$snapshotBase-LOCAL"
11+
else -> "$snapshotBase.$githubRunNumber-SNAPSHOT"
12+
}
13+
14+
private val releaseVersion = System.getenv("RELEASE_VERSION")
15+
16+
val isRelease = releaseVersion != null
17+
val version = releaseVersion ?: snapshotVersion
18+
}

gradle.properties

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#https://github.com/gradle/gradle/issues/11308
2+
org.gradle.internal.publish.checksums.insecure=true
3+
systemProp.org.gradle.internal.publish.checksums.insecure=true
4+
org.gradle.parallel=true

gradle/libs.versions.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[versions]
2+
wiremock = "2.34.0"
3+
kotest = "5.5.1"
4+
5+
[libraries]
6+
kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
7+
kotest-api = { module = "io.kotest:kotest-framework-api", version.ref = "kotest" }
8+
kotest-runner = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
9+
10+
wiremock = { module = "com.github.tomakehurst:wiremock-jre8-standalone", version.ref = "wiremock" }

gradle/wrapper/gradle-wrapper.jar

59.3 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)