Skip to content

Commit 4ffdd6d

Browse files
committed
Run tests with every supported Spring Boot version
1 parent 764b722 commit 4ffdd6d

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
strategy:
1313
matrix:
1414
java: [ '17', '21' ]
15-
name: Test with Java ${{ matrix.Java }}
15+
spring-boot-version: ['3.0.13', '3.1.12', '3.2.12', '3.3.12', '3.4.6', '3.5.0']
16+
name: Test with Java ${{ matrix.Java }} / Spring Boot ${{ matrix.spring-boot-version }}
1617
steps:
1718
- name: Checkout code
1819
uses: actions/checkout@v4
@@ -30,19 +31,23 @@ jobs:
3031
with:
3132
gradle-version: 8.6
3233

34+
- name: Update Spring Boot version
35+
run: |
36+
./gradlew useSpringBootVersion -PspringBootVersion=${{ matrix.spring-boot-version }}
37+
3338
- name: Run tests and generate reports
3439
run: ./gradlew testAndReport
3540

3641
- name: Upload Artifact
3742
uses: actions/upload-artifact@v4
3843
if: always()
3944
with:
40-
name: report-java-${{ matrix.Java }}
45+
name: report-java-${{ matrix.java }}-${{ matrix.spring-boot-version }}
4146
path: build/reports/**
4247
retention-days: 5
4348

4449
- name: Run Sonar analysis
45-
if: matrix.Java == '17'
50+
if: matrix.java == '17' && matrix.spring-boot-version == '3.5.0'
4651
env:
4752
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4853
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
buildscript {
22
ext {
3-
springBootVersion = '3.4.5'
4-
springVersion = '6.2.6'
3+
springBootVersion = project.hasProperty('springBootVersion') ? project.springBootVersion : '3.5.0'
54
jacksonVersion = '2.19.0'
65
mockitoVersion = '5.2.+'
76
retrofitVersion = '2.11.0'
@@ -41,10 +40,10 @@ dependencies {
4140
compileOnly group: 'org.apache.tomcat', name: 'tomcat-catalina', version: '10.1.40'
4241

4342
// https://mvnrepository.com/artifact/org.springframework/spring-webmvc
44-
compileOnly group: 'org.springframework', name: 'spring-webmvc', version: "${springVersion}"
43+
compileOnly 'org.springframework:spring-webmvc'
4544

4645
// https://mvnrepository.com/artifact/org.springframework/spring-tx
47-
compileOnly group: 'org.springframework', name: 'spring-tx', version: "${springVersion}"
46+
compileOnly 'org.springframework:spring-tx'
4847

4948
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security
5049
compileOnly group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: "${springBootVersion}"
@@ -117,3 +116,9 @@ dependencies {
117116
configurations {
118117
testImplementation.extendsFrom compileOnly
119118
}
119+
120+
tasks.register('useSpringBootVersion') {
121+
doLast {
122+
println "Using Spring Boot version: ${springBootVersion}"
123+
}
124+
}

0 commit comments

Comments
 (0)