Skip to content

Commit afea08f

Browse files
authored
chore: Add test dependencies and fix CI (#33)
1 parent 971b3d7 commit afea08f

2 files changed

Lines changed: 86 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,38 @@ jobs:
3939
- name: Debug Test Results (Unix)
4040
if: runner.os != 'Windows'
4141
run: |
42-
echo "Test Results:"
43-
find . -name "TEST-*.xml" -exec cat {} \;
44-
echo "JaCoCo Report Location:"
45-
ls -la api/target/site/jacoco/
42+
echo "=== Test Results ==="
43+
if [ -d "api/target/surefire-reports" ]; then
44+
find api/target/surefire-reports -name "TEST-*.xml" -type f -exec cat {} \;
45+
else
46+
echo "No test reports found"
47+
fi
48+
49+
echo "=== JaCoCo Report ==="
50+
if [ -d "api/target/site/jacoco" ]; then
51+
ls -la api/target/site/jacoco/
52+
else
53+
echo "No JaCoCo report found"
54+
fi
55+
4656
- name: Debug Test Results (Windows)
4757
if: runner.os == 'Windows'
4858
run: |
49-
echo "Test Results:"
50-
Get-ChildItem -Recurse -Filter "TEST-*.xml" | Get-Content
51-
echo "JaCoCo Report Location:"
52-
Get-ChildItem -Path "api\target\site\jacoco" -Force
59+
echo "=== Test Results === "
60+
$testReports = Get-ChildItem -Path "api\target\surefire-reports" -Filter "TEST-*.xml" -ErrorAction SilentlyContinue
61+
if ($testReports) {
62+
$testReports | Get-Content
63+
} else {
64+
echo "No test reports found"
65+
}
66+
67+
echo "=== JaCoCo Report ==="
68+
if (Test-Path "api\target\site\jacoco") {
69+
Get-ChildItem -Path "api\target\site\jacoco" -Force
70+
} else {
71+
echo "No JaCoCo report found"
72+
}
73+
5374
- name: Generate JaCoCo Report
5475
run: mvn -pl api jacoco:report
5576
- name: Upload coverage to Codecov

api/pom.xml

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
<retrofit.version>2.9.0</retrofit.version>
6868
<jackson.version>2.14.2</jackson.version>
6969
<jwt.version>0.11.5</jwt.version>
70+
<junit.version>5.10.2</junit.version>
71+
<okhttp.version>4.8.1</okhttp.version>
7072
</properties>
7173

7274
<dependencies>
@@ -98,7 +100,13 @@
98100
<dependency>
99101
<groupId>com.squareup.okhttp3</groupId>
100102
<artifactId>okhttp</artifactId>
101-
<version>4.9.3</version>
103+
<version>${okhttp.version}</version>
104+
</dependency>
105+
<dependency>
106+
<groupId>com.squareup.okhttp3</groupId>
107+
<artifactId>okhttp-tls</artifactId>
108+
<version>${okhttp.version}</version>
109+
<scope>test</scope>
102110
</dependency>
103111

104112
<!-- Jackson -->
@@ -146,9 +154,15 @@
146154

147155
<!-- Test Dependencies -->
148156
<dependency>
149-
<groupId>junit</groupId>
150-
<artifactId>junit</artifactId>
151-
<version>4.12</version>
157+
<groupId>org.junit.jupiter</groupId>
158+
<artifactId>junit-jupiter-api</artifactId>
159+
<version>${junit.version}</version>
160+
<scope>test</scope>
161+
</dependency>
162+
<dependency>
163+
<groupId>org.junit.jupiter</groupId>
164+
<artifactId>junit-jupiter-engine</artifactId>
165+
<version>${junit.version}</version>
152166
<scope>test</scope>
153167
</dependency>
154168
<dependency>
@@ -242,6 +256,45 @@
242256
</executions>
243257
</plugin>
244258

259+
<plugin>
260+
<groupId>org.jacoco</groupId>
261+
<artifactId>jacoco-maven-plugin</artifactId>
262+
<version>0.8.11</version>
263+
<executions>
264+
<execution>
265+
<id>prepare-agent</id>
266+
<goals>
267+
<goal>prepare-agent</goal>
268+
</goals>
269+
</execution>
270+
<execution>
271+
<id>report</id>
272+
<phase>test</phase>
273+
<goals>
274+
<goal>report</goal>
275+
</goals>
276+
</execution>
277+
</executions>
278+
</plugin>
279+
280+
<plugin>
281+
<groupId>org.apache.maven.plugins</groupId>
282+
<artifactId>maven-surefire-plugin</artifactId>
283+
<version>2.22.2</version>
284+
<configuration>
285+
<includes>
286+
<include>**/*Test.java</include>
287+
</includes>
288+
<useSystemClassLoader>false</useSystemClassLoader>
289+
<forkCount>1</forkCount>
290+
<reuseForks>true</reuseForks>
291+
<argLine>@{argLine} -Djava.security.egd=file:/dev/./urandom</argLine>
292+
<systemPropertyVariables>
293+
<okhttp.platform>jdk</okhttp.platform>
294+
</systemPropertyVariables>
295+
</configuration>
296+
</plugin>
297+
245298
</plugins>
246299
</build>
247300

0 commit comments

Comments
 (0)