Skip to content

Commit 66940ab

Browse files
committed
Run tests with every supported Spring Boot version
1 parent d35695b commit 66940ab

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
@@ -25,19 +26,23 @@ jobs:
2526
distribution: temurin
2627
java-version: ${{ matrix.java }}
2728

29+
- name: Update Spring Boot version
30+
run: |
31+
./gradlew useSpringBootVersion -PspringBootVersion=${{ matrix.spring-boot-version }}
32+
2833
- name: Run tests and generate reports
2934
run: ./gradlew testAndReport
3035

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

3944
- name: Run Sonar analysis
40-
if: matrix.Java == '17'
45+
if: matrix.java == '17' && matrix.spring-boot-version == '3.5.0'
4146
env:
4247
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4348
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.5.0'
4-
springVersion = '6.2.7'
3+
springBootVersion = project.hasProperty('springBootVersion') ? project.springBootVersion : '3.5.0'
54
jacksonVersion = '2.19.0'
65
retrofitVersion = '2.11.0'
76
}
@@ -40,10 +39,10 @@ dependencies {
4039
compileOnly group: 'org.apache.tomcat', name: 'tomcat-catalina', version: '10.1.41'
4140

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

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

4847
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security
4948
compileOnly group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: "${springBootVersion}"
@@ -112,3 +111,9 @@ dependencies {
112111
configurations {
113112
testImplementation.extendsFrom compileOnly
114113
}
114+
115+
tasks.register('useSpringBootVersion') {
116+
doLast {
117+
println "Using Spring Boot version: ${springBootVersion}"
118+
}
119+
}

0 commit comments

Comments
 (0)