Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 60 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ on:
branches:
- main
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.txt'
- '.all-contributorsrc'

- ".gitignore"
- "CODEOWNERS"
- "LICENSE"
- "*.txt"
- ".all-contributorsrc"

env:
JAVA_MIN: "17"
JAVA_MAX: "25"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -26,7 +30,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "17"
java-version: ${{ env.JAVA_MIN }}
cache: "maven"

- name: Check License and Code Formatting
Expand All @@ -43,6 +47,7 @@ jobs:
needs: verify-license-and-format
runs-on: ubuntu-latest
strategy:
# Keep this list aligned with JAVA_MIN/JAVA_MAX above.
matrix:
java: [17, 21, 25]
steps:
Expand All @@ -58,6 +63,47 @@ jobs:
- name: Run tests
run: ./mvnw verify -B -ntp

native-tests-core:
needs: verify-license-and-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Setup GraalVM
uses: actions/setup-java@v5
with:
distribution: graalvm
java-version: ${{ env.JAVA_MAX }}
cache: maven

- name: Install parent POM
run: ./mvnw install -N -B -ntp

- name: Run native image tests (watsonx-ai-core)
run: ./mvnw -Pnative clean test -pl modules/watsonx-ai-core -B -ntp

native-tests-ai:
needs: verify-license-and-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Setup GraalVM
uses: actions/setup-java@v5
with:
distribution: graalvm
java-version: ${{ env.JAVA_MAX }}
cache: maven

- name: Install parent POM
run: ./mvnw install -N -B -ntp

- name: Install watsonx-ai-core
run: ./mvnw install -pl modules/watsonx-ai-core -B -ntp -DskipTests -Dmaven.test.skip=true

- name: Run native image tests (watsonx-ai)
run: ./mvnw -Pnative clean test -pl modules/watsonx-ai -B -ntp

detect-release:
runs-on: ubuntu-latest
needs: verify-license-and-format
Expand All @@ -66,7 +112,7 @@ jobs:
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-depth: 0

- name: Detect version change
id: detect
Expand All @@ -79,7 +125,7 @@ jobs:

build-samples:
runs-on: ubuntu-latest
needs:
needs:
- verify-license-and-format
- detect-release

Expand All @@ -93,7 +139,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "17"
java-version: ${{ env.JAVA_MIN }}
cache: "maven"

- name: Extract next version from project.yml
Expand All @@ -112,7 +158,7 @@ jobs:

run-integration-tests:
runs-on: ubuntu-latest
needs:
needs:
- junit-test
- build-samples
- detect-release
Expand All @@ -122,12 +168,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup JDK 17

- name: Setup JDK ${{ env.JAVA_MIN }}
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
java-version: ${{ env.JAVA_MIN }}
cache: maven

- name: Run Integration Tests
Expand Down
16 changes: 16 additions & 0 deletions modules/watsonx-ai-core/native-agent-filter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"rules": [
{"includeClasses": "**"},
{"excludeClasses": "org.mockito.**"},
{"excludeClasses": "net.bytebuddy.**"},
{"excludeClasses": "org.jboss.weld.**"},
{"excludeClasses": "com.github.tomakehurst.wiremock.**"},
{"excludeClasses": "org.eclipse.jetty.**"},
{"excludeClasses": "org.apache.maven.surefire.**"},
{"excludeClasses": "org.junit.**"}
],
"regexRules": [
{"excludeClasses": "^com\\.ibm\\.watsonx\\..*Test(\\$.*)?$"},
{"excludeClasses": ".*/0x[0-9a-fA-F]+$"}
]
}
75 changes: 75 additions & 0 deletions modules/watsonx-ai-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,79 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Exclude tests that require reflection-heavy mocking frameworks -->
<testExcludes>
<testExclude>**/AsyncHttpClientTest.java</testExclude>
<testExclude>**/AuthenticationInterceptorTest.java</testExclude>
<testExclude>**/CP4DAuthenticationTest.java</testExclude>
<testExclude>**/HttpClientFactoryTest.java</testExclude>
<testExclude>**/HttpUtilsTest.java</testExclude>
<testExclude>**/IBMCloudAuthenticatorTest.java</testExclude>
<testExclude>**/LoggerInterceptorTest.java</testExclude>
<testExclude>**/MultipartBodyTest.java</testExclude>
<testExclude>**/RetryInterceptorTest.java</testExclude>
<testExclude>**/SseEventLoggerTest.java</testExclude>
<testExclude>**/SyncHttpClientTest.java</testExclude>
<testExclude>**/BaseHttpClientTest.java</testExclude>
<testExclude>**/CustomHttpClientTest.java</testExclude>
<testExclude>**/HttpClientProviderTest.java</testExclude>
<testExclude>**/RetryConfigTest.java</testExclude>
<testExclude>**/ExecutorProviderTest.java</testExclude>
</testExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>native-agent</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<testExcludes>
</testExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<agent>
<enabled>true</enabled>
<options>
<callerFilterFiles>
<filterFile>${project.basedir}/native-agent-filter.json</filterFile>
</callerFilterFiles>
<accessFilterFiles>
<filterFile>${project.basedir}/native-agent-filter.json</filterFile>
</accessFilterFiles>
</options>
<metadataCopy>
<merge>false</merge>
<outputDirectory>${project.basedir}/src/main/resources/META-INF/native-image/com.ibm.watsonx/${project.artifactId}</outputDirectory>
<disabledStages>
<stage>main</stage>
</disabledStages>
</metadataCopy>
</agent>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Args = --initialize-at-build-time=com.ibm.watsonx.ai.core.exception.model.WatsonxError$Code \
--initialize-at-run-time=com.ibm.watsonx.ai.core.Json \
--initialize-at-run-time=com.ibm.watsonx.ai.core.provider.ExecutorProvider
Loading