Skip to content

Commit 6e1e251

Browse files
committed
fix: build codeflash-runtime JAR in CI instead of skipping tests
- Add pom.xml for codeflash-java-runtime with proper dependencies (Gson, SQLite JDBC) - Add CI step to build and install JAR before running tests - Remove @requires_jar skip logic - tests should run, not be skipped - All 348 Java tests now pass with proper JAR integration
1 parent ab008c9 commit 6e1e251

File tree

4 files changed

+114
-15
lines changed

4 files changed

+114
-15
lines changed

.github/workflows/java-e2e-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ jobs:
5151
java -version
5252
mvn --version
5353
54+
- name: Build codeflash-runtime JAR
55+
run: |
56+
cd codeflash-java-runtime
57+
mvn clean package -q -DskipTests
58+
mvn install -q -DskipTests
59+
5460
- name: Build Java sample project
5561
run: |
5662
cd code_to_optimize/java

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ cython_debug/
168168
!tests/test_languages/fixtures/**/pom.xml
169169
# Allow pom.xml in Java sample project
170170
!code_to_optimize/java/pom.xml
171+
# Allow pom.xml in codeflash-java-runtime
172+
!codeflash-java-runtime/pom.xml
171173
*.pem
172174

173175
# Ruff cache

codeflash-java-runtime/pom.xml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<groupId>com.codeflash</groupId>
9+
<artifactId>codeflash-runtime</artifactId>
10+
<version>1.0.0</version>
11+
<packaging>jar</packaging>
12+
13+
<name>CodeFlash Java Runtime</name>
14+
<description>Runtime library for CodeFlash Java instrumentation and comparison</description>
15+
16+
<properties>
17+
<maven.compiler.source>11</maven.compiler.source>
18+
<maven.compiler.target>11</maven.compiler.target>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
</properties>
21+
22+
<dependencies>
23+
<!-- Gson for JSON serialization -->
24+
<dependency>
25+
<groupId>com.google.code.gson</groupId>
26+
<artifactId>gson</artifactId>
27+
<version>2.10.1</version>
28+
</dependency>
29+
30+
<!-- SQLite JDBC driver -->
31+
<dependency>
32+
<groupId>org.xerial</groupId>
33+
<artifactId>sqlite-jdbc</artifactId>
34+
<version>3.45.0.0</version>
35+
</dependency>
36+
37+
<!-- JUnit 5 for testing -->
38+
<dependency>
39+
<groupId>org.junit.jupiter</groupId>
40+
<artifactId>junit-jupiter</artifactId>
41+
<version>5.10.1</version>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
45+
46+
<build>
47+
<plugins>
48+
<!-- Compiler plugin -->
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-compiler-plugin</artifactId>
52+
<version>3.11.0</version>
53+
<configuration>
54+
<source>11</source>
55+
<target>11</target>
56+
</configuration>
57+
</plugin>
58+
59+
<!-- Surefire plugin for tests -->
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-surefire-plugin</artifactId>
63+
<version>3.0.0</version>
64+
</plugin>
65+
66+
<!-- Create JAR with dependencies -->
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-shade-plugin</artifactId>
70+
<version>3.5.1</version>
71+
<executions>
72+
<execution>
73+
<phase>package</phase>
74+
<goals>
75+
<goal>shade</goal>
76+
</goals>
77+
<configuration>
78+
<transformers>
79+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
80+
<mainClass>com.codeflash.Comparator</mainClass>
81+
</transformer>
82+
</transformers>
83+
<filters>
84+
<filter>
85+
<artifact>*:*</artifact>
86+
<excludes>
87+
<exclude>META-INF/*.SF</exclude>
88+
<exclude>META-INF/*.DSA</exclude>
89+
<exclude>META-INF/*.RSA</exclude>
90+
</excludes>
91+
</filter>
92+
</filters>
93+
</configuration>
94+
</execution>
95+
</executions>
96+
</plugin>
97+
98+
<!-- Install to local Maven repository -->
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-install-plugin</artifactId>
102+
<version>3.1.1</version>
103+
</plugin>
104+
</plugins>
105+
</build>
106+
</project>

tests/test_languages/test_java/test_comparator.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@
2121
)
2222

2323

24-
def _jar_available() -> bool:
25-
"""Check if codeflash-runtime JAR is available."""
26-
from codeflash.languages.java.comparator import _find_comparator_jar
27-
28-
return _find_comparator_jar() is not None
29-
30-
31-
# Skip tests that require the codeflash-runtime JAR
32-
requires_jar = pytest.mark.skipif(
33-
not _jar_available(),
34-
reason="codeflash-runtime JAR not found - skipping Comparator JAR tests",
35-
)
36-
37-
3824
class TestDirectComparison:
3925
"""Tests for direct Python-based comparison."""
4026

@@ -332,7 +318,6 @@ def test_deeply_nested_objects(self):
332318

333319

334320
@requires_java
335-
@requires_jar
336321
class TestTestResultsTableSchema:
337322
"""Tests for Java Comparator reading from test_results table schema.
338323

0 commit comments

Comments
 (0)