Skip to content

Commit 77ebf8b

Browse files
committed
Update dependencies, migrate to toml and dependabot (#103)
1 parent 4aa9835 commit 77ebf8b

File tree

18 files changed

+281
-191
lines changed

18 files changed

+281
-191
lines changed

Diff for: .github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
assignees:
8+
- "gavlyukovskiy"
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
assignees:
14+
- "gavlyukovskiy"
15+

Diff for: .github/workflows/main.yml

+83-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
name: CI
1+
name: Build
22

3-
on: [ push, pull_request ]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags-ignore:
8+
- '*'
9+
pull_request:
10+
branches:
11+
- master
12+
workflow_dispatch:
413

5-
jobs:
6-
7-
java-17:
14+
concurrency:
15+
# On master, we don't want any jobs cancelled so the sha is used to name the group
16+
# On PR branches, we cancel the job if new commits are pushed
17+
# More info: https://stackoverflow.com/a/68422069/253468
18+
group: ${{ (github.ref == 'refs/heads/master') && format('{0}-{1}', github.workflow_ref, github.sha) || format('{0}-{1}', github.workflow_ref, github.head_ref) }}
19+
cancel-in-progress: true
820

9-
name: Java 17
21+
jobs:
22+
build:
1023
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
checks: write # for publishing test results and annotations
1127
steps:
1228
- uses: actions/checkout@v4
13-
14-
- run: git fetch --prune --unshallow --tags
29+
with:
30+
fetch-depth: 0
1531

1632
- name: Set up JDK 17
1733
uses: actions/setup-java@v4
@@ -20,5 +36,62 @@ jobs:
2036
java-version: '17'
2137
cache: 'gradle'
2238

23-
- name: Test
24-
run: ./gradlew build
39+
- id: get-snapshot-version
40+
name: Generate snapshot version
41+
shell: bash
42+
run: |
43+
# expects git tag to be in format 'v0.1.0' or 'v0.1.0-rc1'
44+
version=$(git describe --tag --abbrev=0 | cut -c 2-)
45+
regex="^([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+)?$"
46+
if [[ $version =~ $regex ]]; then
47+
major="${BASH_REMATCH[1]}"
48+
minor="${BASH_REMATCH[2]}"
49+
patch="${BASH_REMATCH[3]}"
50+
pre_release="${BASH_REMATCH[4]:-}"
51+
52+
# increment patch version of the latest release to create new snapshot version
53+
# when pre-release - continue snapshots of the same version
54+
# v0.1.0 -> 0.1.0-SNAPSHOT
55+
# v0.1.0-rc -> 0.1.0-SNAPSHOT
56+
if [[ -z $pre_release ]]; then
57+
patch=$(($patch + 1))
58+
fi
59+
60+
snapshot_version="${major}.${minor}.${patch}"
61+
62+
if ! [[ $snapshot_version =~ $regex ]]; then
63+
echo "SNAPSHOT version $snapshot_version is not a valid SemVer"
64+
exit 1
65+
fi
66+
67+
echo "${snapshot_version}-SNAPSHOT"
68+
echo "snapshot-version=${snapshot_version}-SNAPSHOT" >> $GITHUB_OUTPUT
69+
else
70+
echo "Version $version is not a valid SemVer"
71+
exit 1
72+
fi
73+
74+
- name: Build
75+
run: |
76+
./gradlew \
77+
-Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} \
78+
build
79+
80+
- name: Publish Test Report
81+
uses: mikepenz/action-junit-report@v4
82+
if: ${{ !cancelled() }} # always run even if the previous step fails
83+
with:
84+
report_paths: '**/build/test-results/test/TEST-*.xml'
85+
86+
- name: Upload SNAPSHOT artifacts to Sonatype
87+
id: upload_snapshot_artifacts
88+
if: ${{ github.ref == 'refs/heads/master' }}
89+
env:
90+
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
91+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
92+
GPG_KEY: ${{ secrets.GPG_KEY }}
93+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
94+
run: |
95+
./gradlew \
96+
-Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} \
97+
publishToSonatype closeAndReleaseSonatypeStagingRepository

Diff for: .github/workflows/release.yml renamed to .github/workflows/on-release-tag.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
name: Tag & Release Workflow
2+
23
on:
34
push:
45
tags:
56
- 'v[0-9]+\.[0-9]+\.[0-9]+'
67

78
jobs:
8-
99
release:
10-
1110
if: github.repository == 'gavlyukovskiy/spring-boot-data-source-decorator'
1211
runs-on: ubuntu-latest
1312
steps:

Diff for: .github/workflows/snapshot.yml

-65
This file was deleted.

Diff for: .github/workflows/update-gradle-wrapper.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Update Gradle Wrapper
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * Mon"
6+
7+
jobs:
8+
update-gradle-wrapper:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Update Gradle Wrapper
15+
uses: gradle-update/update-gradle-wrapper-action@v1

Diff for: build.gradle.kts

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
java
33
`maven-publish`
44
signing
5-
id("io.github.gradle-nexus.publish-plugin").version("1.3.0")
5+
alias(libs.plugins.nexus.publish)
66
}
77

88
group = "com.github.gavlyukovskiy"
@@ -29,11 +29,6 @@ nexusPublishing {
2929
subprojects {
3030
apply(plugin = "java")
3131

32-
extra["springBootVersion"] = "3.0.2"
33-
extra["p6SpyVersion"] = "3.9.0"
34-
extra["datasourceProxyVersion"] = "1.9"
35-
extra["flexyPoolVersion"] = "2.2.3"
36-
3732
extra["release"] = listOf(
3833
"datasource-decorator-spring-boot-autoconfigure",
3934
"datasource-proxy-spring-boot-starter",
@@ -117,7 +112,7 @@ subprojects {
117112
}
118113

119114
if (project.name.contains("sample")) {
120-
tasks.compileJava {
115+
tasks.withType<JavaCompile> {
121116
dependsOn(":datasource-decorator-spring-boot-autoconfigure:publishToMavenLocal")
122117
dependsOn(":datasource-proxy-spring-boot-starter:publishToMavenLocal")
123118
dependsOn(":flexy-pool-spring-boot-starter:publishToMavenLocal")
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,54 @@
11
plugins {
22
`java-library`
3+
alias(libs.plugins.test.logger)
34
}
45

56
dependencies {
6-
implementation("org.springframework.boot:spring-boot:${project.extra["springBootVersion"]}")
7-
implementation("org.springframework.boot:spring-boot-autoconfigure:${project.extra["springBootVersion"]}")
8-
implementation("org.springframework.boot:spring-boot-starter-jdbc:${project.extra["springBootVersion"]}")
7+
implementation(platform(libs.spring.boot.dependencies))
8+
annotationProcessor(platform(libs.spring.boot.dependencies))
9+
compileOnly(platform(libs.spring.boot.dependencies))
10+
testImplementation(platform(libs.spring.boot.dependencies))
911

10-
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:${project.extra["springBootVersion"]}")
12+
implementation(libs.spring.boot)
13+
implementation(libs.spring.boot.autoconfigure)
14+
implementation(libs.spring.boot.starter.jdbc)
1115

12-
compileOnly("org.apache.commons:commons-dbcp2:2.9.0")
13-
compileOnly("org.apache.tomcat:tomcat-jdbc:10.1.5")
14-
compileOnly("com.zaxxer:HikariCP:5.0.1")
16+
annotationProcessor(libs.spring.boot.configuration.processor)
1517

16-
compileOnly("p6spy:p6spy:${project.extra["p6SpyVersion"]}")
17-
compileOnly("net.ttddyy:datasource-proxy:${project.extra["datasourceProxyVersion"]}")
18-
compileOnly("com.vladmihalcea.flexy-pool:flexy-pool-core:${project.extra["flexyPoolVersion"]}")
19-
compileOnly("com.vladmihalcea.flexy-pool:flexy-dbcp2:${project.extra["flexyPoolVersion"]}")
20-
compileOnly("com.vladmihalcea.flexy-pool:flexy-hikaricp:${project.extra["flexyPoolVersion"]}")
21-
compileOnly("com.vladmihalcea.flexy-pool:flexy-tomcatcp:${project.extra["flexyPoolVersion"]}")
22-
compileOnly("com.vladmihalcea.flexy-pool:flexy-micrometer-metrics:${project.extra["flexyPoolVersion"]}")
18+
compileOnly(libs.commons.dbcp2)
19+
compileOnly(libs.tomcat.jdbc)
20+
compileOnly(libs.hikari.cp)
2321

24-
compileOnly("org.springframework.boot:spring-boot-starter-actuator:${project.extra["springBootVersion"]}")
22+
compileOnly(libs.p6spy)
23+
compileOnly(libs.datasource.proxy)
24+
compileOnly(libs.flexy.pool.core)
25+
compileOnly(libs.flexy.pool.dbcp2)
26+
compileOnly(libs.flexy.pool.hikaricp)
27+
compileOnly(libs.flexy.pool.tomcatcp)
28+
compileOnly(libs.flexy.pool.micrometer.metrics)
29+
30+
compileOnly(libs.spring.boot.starter.actuator)
2531

2632
// optional (compileOnly) dependencies for SQL formatting
27-
compileOnly("org.hibernate:hibernate-core:6.1.6.Final") // should match the version managed by spring-boot
28-
compileOnly("com.github.vertical-blank:sql-formatter:2.0.4")
33+
compileOnly(libs.hibernate.core)
34+
compileOnly(libs.sql.formatter)
2935

30-
testImplementation("com.h2database:h2:2.1.214")
31-
testImplementation("org.springframework.boot:spring-boot-starter-test:${project.extra["springBootVersion"]}")
36+
testImplementation(libs.h2)
37+
testImplementation(libs.spring.boot.starter.test)
3238

33-
testImplementation("p6spy:p6spy:${project.extra["p6SpyVersion"]}")
34-
testImplementation("net.ttddyy:datasource-proxy:${project.extra["datasourceProxyVersion"]}")
35-
testImplementation("com.vladmihalcea.flexy-pool:flexy-pool-core:${project.extra["flexyPoolVersion"]}")
36-
testImplementation("com.vladmihalcea.flexy-pool:flexy-dbcp2:${project.extra["flexyPoolVersion"]}")
37-
testImplementation("com.vladmihalcea.flexy-pool:flexy-hikaricp:${project.extra["flexyPoolVersion"]}")
38-
testImplementation("com.vladmihalcea.flexy-pool:flexy-tomcatcp:${project.extra["flexyPoolVersion"]}")
39-
testImplementation("com.vladmihalcea.flexy-pool:flexy-micrometer-metrics:${project.extra["flexyPoolVersion"]}")
39+
testImplementation(libs.p6spy)
40+
testImplementation(libs.datasource.proxy)
41+
testImplementation(libs.flexy.pool.core)
42+
testImplementation(libs.flexy.pool.dbcp2)
43+
testImplementation(libs.flexy.pool.hikaricp)
44+
testImplementation(libs.flexy.pool.tomcatcp)
45+
testImplementation(libs.flexy.pool.micrometer.metrics)
4046

41-
testImplementation("commons-dbcp:commons-dbcp:1.4")
42-
testImplementation("org.apache.commons:commons-dbcp2:2.9.0")
43-
testImplementation("org.apache.tomcat:tomcat-jdbc:10.1.5")
44-
testImplementation("com.zaxxer:HikariCP:5.0.1")
45-
testImplementation("org.flywaydb:flyway-core:9.5.1")
47+
testImplementation(libs.commons.dbcp)
48+
testImplementation(libs.commons.dbcp2)
49+
testImplementation(libs.tomcat.jdbc)
50+
testImplementation(libs.hikari.cp)
51+
testImplementation(libs.flyway.core)
4652
}
4753

4854
tasks {
@@ -53,13 +59,16 @@ tasks {
5359
withType<JavaCompile> {
5460
options.compilerArgs.add("-Xlint:unchecked")
5561
options.compilerArgs.add("-Xlint:deprecation")
62+
options.encoding = "UTF-8"
63+
}
64+
65+
javadoc {
66+
val options = options as StandardJavadocDocletOptions
67+
options.addBooleanOption("html5", true)
68+
options.addStringOption("Xdoclint:all,-missing", "-quiet")
5669
}
5770

5871
test {
5972
useJUnitPlatform()
60-
testLogging {
61-
events("passed", "skipped", "failed")
62-
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
63-
}
6473
}
6574
}

Diff for: datasource-proxy-spring-boot-starter/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ plugins {
44

55
dependencies {
66
api(project(":datasource-decorator-spring-boot-autoconfigure"))
7-
api("net.ttddyy:datasource-proxy:${project.extra["datasourceProxyVersion"]}")
7+
api(libs.datasource.proxy)
88
}

Diff for: flexy-pool-spring-boot-starter/build.gradle.kts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.exclude
2+
13
plugins {
24
`java-library`
35
}
46

57
dependencies {
68
api(project(":datasource-decorator-spring-boot-autoconfigure"))
7-
api("com.vladmihalcea.flexy-pool:flexy-pool-core:${project.extra["flexyPoolVersion"]}")
8-
api("com.vladmihalcea.flexy-pool:flexy-hikaricp:${project.extra["flexyPoolVersion"]}") {
9+
api(libs.flexy.pool.core)
10+
api(libs.flexy.pool.hikaricp) {
911
exclude(group = "com.vladmihalcea.flexy-pool", module = "flexy-dropwizard-metrics")
1012
}
11-
api("com.vladmihalcea.flexy-pool:flexy-micrometer-metrics:${project.extra["flexyPoolVersion"]}")
13+
api(libs.flexy.pool.micrometer.metrics)
1214
}

0 commit comments

Comments
 (0)