Skip to content

Commit 38b9776

Browse files
committed
Add profile to test against okhttp4 as well to verify backwards compatibility
1 parent f1f761e commit 38b9776

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
matrix:
1515
java: [ "11", "17", "21" ]
1616
distribution: [ "zulu", "adopt" ]
17+
okhttp: [ "okhttp5", "okhttp4" ]
18+
include:
19+
- okhttp: "okhttp5"
20+
maven_profiles: ""
21+
- okhttp: "okhttp4"
22+
maven_profiles: "-P test-okhttp4"
1723

1824
steps:
1925
- name: Checkout repository
@@ -31,8 +37,8 @@ jobs:
3137
uses: actions/cache@v4
3238
with:
3339
path: ~/.m2
34-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
40+
key: ${{ runner.os }}-m2-${{ matrix.okhttp }}-${{ hashFiles('**/pom.xml') }}
3541
restore-keys: ${{ runner.os }}-m2
3642

37-
- name: Build with Maven
38-
run: mvn clean install
43+
- name: Build with Maven (OkHttp ${{ matrix.okhttp }})
44+
run: mvn clean install ${{ matrix.maven_profiles }}

pom.xml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@
4848
<slf4j.version>1.7.30</slf4j.version>
4949
<maven.checkstyle.version>3.4.0</maven.checkstyle.version>
5050
<junit.jupiter.version>5.14.0</junit.jupiter.version>
51+
<!-- OkHttp dependency coordinates — overridden by the test-okhttp4 profile -->
52+
<okhttp.artifactId>okhttp-jvm</okhttp.artifactId>
53+
<okhttp.version>5.0.0</okhttp.version>
54+
<okhttp.mockwebserver.version>5.0.0</okhttp.mockwebserver.version>
5155
</properties>
5256

5357
<dependencies>
5458
<dependency>
5559
<groupId>com.squareup.okhttp3</groupId>
56-
<artifactId>okhttp-jvm</artifactId>
57-
<version>5.0.0</version>
60+
<artifactId>${okhttp.artifactId}</artifactId>
61+
<version>${okhttp.version}</version>
5862
</dependency>
5963
<dependency>
6064
<groupId>com.jayway.jsonpath</groupId>
@@ -157,7 +161,7 @@
157161
<dependency>
158162
<groupId>com.squareup.okhttp3</groupId>
159163
<artifactId>mockwebserver</artifactId>
160-
<version>5.0.0</version>
164+
<version>${okhttp.mockwebserver.version}</version>
161165
<scope>test</scope>
162166
</dependency>
163167
<dependency>
@@ -368,5 +372,17 @@
368372
</plugins>
369373
</build>
370374
</profile>
375+
<profile>
376+
<!--
377+
Run the test suite against OkHttp 4.x to verify backward compatibility.
378+
Activate with: mvn test -P test-okhttp4
379+
-->
380+
<id>test-okhttp4</id>
381+
<properties>
382+
<okhttp.artifactId>okhttp</okhttp.artifactId>
383+
<okhttp.version>4.12.0</okhttp.version>
384+
<okhttp.mockwebserver.version>4.12.0</okhttp.mockwebserver.version>
385+
</properties>
386+
</profile>
371387
</profiles>
372388
</project>

0 commit comments

Comments
 (0)