-
-
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.
* setup ci publish and signing * make signing optional based on signing key * use env variables during publish * setup publish and pom description * setup new workflows * gradle properties * add test dependency * enable jacoco and sonar * use hndrs templates
- Loading branch information
1 parent
114142c
commit 8574799
Showing
9 changed files
with
194 additions
and
30 deletions.
There are no files selected for viewing
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
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,44 @@ | ||
name: gradle | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: setup java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '11' | ||
|
||
- name: setup build cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: publish | ||
env: | ||
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
run: | | ||
./gradlew publish |
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,51 @@ | ||
name: gradle | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: [ main ] | ||
types: [ opened, synchronize, reopened ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
analyse: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: setup java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '11' | ||
|
||
- name: gradle cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: sonar cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
|
||
- name: analyse | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: ./gradlew check jacocoTestReport sonarqube --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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
object Versions { | ||
const val KOTLIN_VERSION = "1.4.30" | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
|
@@ -14,27 +10,40 @@ buildscript { | |
} | ||
} | ||
|
||
val springBootDependencies: String by extra | ||
val kotlinVersion: String by extra | ||
|
||
plugins { | ||
id("org.sonarqube").version("3.0") | ||
`maven-publish` | ||
id("io.spring.dependency-management") version "1.0.10.RELEASE" | ||
kotlin("jvm").version("1.4.30") | ||
kotlin("plugin.spring").version("1.4.30") | ||
kotlin("kapt").version("1.4.30") | ||
id("org.sonarqube").version("3.1.1") | ||
id("io.spring.dependency-management") | ||
kotlin("jvm") | ||
kotlin("plugin.spring") | ||
kotlin("kapt") | ||
id("java") | ||
id("maven-publish") | ||
id("idea") | ||
id("signing") | ||
id("io.hndrs.publishing-info").version("1.0.0") | ||
} | ||
|
||
group = "com.elvah.auth" | ||
group = "io.hndrs" | ||
version = rootProject.file("version.txt").readText().trim() | ||
java.sourceCompatibility = JavaVersion.VERSION_15 | ||
java.targetCompatibility = JavaVersion.VERSION_15 | ||
java.sourceCompatibility = JavaVersion.VERSION_11 | ||
java.targetCompatibility = JavaVersion.VERSION_11 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
sonarqube { | ||
properties { | ||
property("sonar.projectKey", "hndrs_jsonapi-spring-boot-starter") | ||
property("sonar.organization", "hndrs") | ||
property("sonar.host.url", "https://sonarcloud.io") | ||
property("sonar.exclusions", "**/sample/**") | ||
} | ||
} | ||
|
||
subprojects { | ||
|
||
apply(plugin = "kotlin") | ||
|
@@ -46,16 +55,32 @@ subprojects { | |
apply(plugin = "jacoco") | ||
apply(plugin = "propdeps") | ||
apply(plugin = "propdeps-idea") | ||
|
||
|
||
apply(plugin = "signing") | ||
apply(plugin = "io.hndrs.publishing-info") | ||
|
||
publishingInfo { | ||
url = "https://github.com/hndrs/jsonapi-spring-boot-starter" | ||
license = io.hndrs.gradle.plugin.License( | ||
"https://github.com/hndrs/jsonapi-spring-boot-starter/blob/main/LICENSE", | ||
"MIT License" | ||
) | ||
developers = listOf( | ||
io.hndrs.gradle.plugin.Developer("marvinschramm", "Marvin Schramm", "[email protected]") | ||
) | ||
organization = io.hndrs.gradle.plugin.Organization("hndrs", "https://oss.hndrs.io") | ||
scm = io.hndrs.gradle.plugin.Scm( | ||
"scm:git:git://github.com/hndrs/jsonapi-spring-boot-starter", | ||
"https://github.com/hndrs/jsonapi-spring-boot-starter" | ||
) | ||
} | ||
|
||
dependencyManagement { | ||
resolutionStrategy { | ||
cacheChangingModulesFor(0, "seconds") | ||
} | ||
imports { | ||
mavenBom("org.springframework.boot:spring-boot-dependencies:2.4.2") { | ||
bomProperty("kotlin.version", Versions.KOTLIN_VERSION) | ||
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootDependencies") { | ||
bomProperty("kotlin.version", kotlinVersion) | ||
} | ||
} | ||
} | ||
|
@@ -81,7 +106,7 @@ subprojects { | |
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs = listOf("-Xjsr305=strict") | ||
jvmTarget = "15" | ||
jvmTarget = "11" | ||
} | ||
} | ||
|
||
|
@@ -91,10 +116,19 @@ subprojects { | |
from(sourceSets["main"].allSource) | ||
} | ||
|
||
|
||
if (project.name != "sample") { | ||
|
||
publishing { | ||
repositories { | ||
|
||
maven { | ||
name = "release" | ||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") | ||
credentials { | ||
username = System.getenv("SONATYPE_USER") | ||
password = System.getenv("SONATYPE_PASSWORD") | ||
} | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>(project.name) { | ||
|
@@ -104,9 +138,19 @@ subprojects { | |
groupId = rootProject.group as? String | ||
artifactId = project.name | ||
version = "${rootProject.version}${project.findProperty("version.appendix") ?: ""}" | ||
pom { | ||
|
||
} | ||
} | ||
} | ||
val signingKey: String? = System.getenv("SIGNING_KEY") | ||
val signingPassword: String? = System.getenv("SIGNING_PASSWORD") | ||
if (signingKey != null && signingPassword != null) { | ||
signing { | ||
useInMemoryPgpKeys(groovy.json.StringEscapeUtils.unescapeJava(signingKey), signingPassword) | ||
sign(publications[project.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,3 @@ | ||
kotlinVersion=1.4.30 | ||
springDependencyManagement=1.0.11.RELEASE | ||
springBootDependencies=2.4.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
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,4 +1,10 @@ | ||
dependencies { | ||
api(project(":spring-json-api")) | ||
api(group = "org.springframework.boot", name = "spring-boot-autoconfigure") | ||
|
||
annotationProcessor(group = "org.springframework.boot", name = "spring-boot-configuration-processor") | ||
kapt(group = "org.springframework.boot", name = "spring-boot-configuration-processor") | ||
|
||
testImplementation(group = "org.springframework.boot", name = "spring-boot-starter-test") | ||
testImplementation(group = "org.springframework.boot", name = "spring-boot-starter-web") | ||
} |
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
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,3 +1,3 @@ | ||
dependencies { | ||
api(group = "org.springframework.boot", name = "spring-boot-starter-web") | ||
optional(group = "org.springframework.boot", name = "spring-boot-starter-web") | ||
} |