@@ -20,12 +20,15 @@ defaults:
2020 shell : bash
2121
2222jobs :
23- # Build the project, no native tests.
24- build-and-test-jvm :
25- name : Main Build
23+ # Quick build (no test, Java 17)
24+ # Artifacts will be reused in the other jobs
25+ quick-build :
26+ name : Quick Build
2627 runs-on : ubuntu-latest
2728 outputs :
28- matrix : ${{ steps.set-matrix.outputs.matrix }}
29+ all_modules : ${{ steps.matrices.outputs.all_modules }}
30+ it_modules : ${{ steps.matrices.outputs.it_modules }}
31+ in_process_embedding_modules : ${{ steps.matrices.outputs.in_process_embedding_modules }}
2932
3033 steps :
3134 - uses : actions/checkout@v4
@@ -38,44 +41,62 @@ jobs:
3841 cache : ' maven'
3942
4043 - name : Build with Maven
41- run : ./mvnw -B clean install -Dno-format -ntp
44+ run : ./mvnw -B clean install -DskipTests - Dno-format -ntp
4245
4346 - name : Zip the Maven repo
4447 run : |
4548 tar -czf ${{ runner.temp }}/maven-repo.tgz -C ~ .m2/repository
4649 # Avoid caching our own artifacts
4750 rm -Rf ~/.m2/repository/io/quarkiverse/langchain4j
51+
4852 - name : Persist the Maven repo
4953 uses : actions/upload-artifact@v4
5054 with :
5155 name : maven-repo
5256 path : ${{ runner.temp }}/maven-repo.tgz
5357 retention-days : 5
5458
55- - name : Output the matrix
56- id : set-matrix
59+ - name : Compute matrices
60+ id : matrices
5761 run : |
62+ # Compute the JVM tests
63+ ALL_MODULES=$(find . -mindepth 2 -maxdepth 2 -type f -name 'pom.xml' -exec dirname {} \; \
64+ | sed 's|^\./||' \
65+ | sort -u \
66+ | jq -R -s -c 'split("\n")[:-1]')
67+
68+ # Integration tests (without the in-process embedding models)
69+ # Remove JLama from the list
5870 cd integration-tests
59- # skip RAG module as it doesn't have any native-compatible tests now
60- MATRIX='{"testModule":'$( \
71+ IT_MODULES=$( \
6172 find . -mindepth 2 -maxdepth 2 -type f -name 'pom.xml' -exec dirname {} \; \
6273 | sed 's|^\./||' \
6374 | sort -u \
64- | grep -v rag \
6575 | grep -v jlama \
66- | jq -R -s -c 'split("\n")[:-1]' \
67- )'}'
68- echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
69-
70- # Test the project with different JDKs.
71- test-jvm-alt :
76+ | grep -v in-process-embedding-models \
77+ | jq -R -s -c 'split("\n")[:-1]')
78+
79+ # We extract in process embedding models as there are many modules and we want parallelism
80+ cd in-process-embedding-models
81+ IN_PROCESS_EMBEDDING_MODULES=$( \
82+ find . -mindepth 2 -maxdepth 2 -type f -name 'pom.xml' -exec dirname {} \; \
83+ | sed 's|^\./||' \
84+ | sort -u \
85+ | jq -R -s -c 'split("\n")[:-1]')
86+
87+ echo "all_modules=${ALL_MODULES}" >> $GITHUB_OUTPUT
88+ echo "it_modules=${IT_MODULES}" >> $GITHUB_OUTPUT
89+ echo "in_process_embedding_modules=${IN_PROCESS_EMBEDDING_MODULES}" >> $GITHUB_OUTPUT
90+
91+ test-jvm :
92+ needs : quick-build
7293 strategy :
7394 fail-fast : false
7495 matrix :
75- os : [ubuntu-latest ]
76- java : [21, 22, 23]
77- name : Test on ${{ matrix.os }} - ${{ matrix.java }}
78- runs-on : ${{ matrix.os }}
96+ java : [ 17, 21, 23 ]
97+ module : ${{fromJson(needs.quick-build.outputs.all_modules)}}
98+ name : Build and Test ${{ matrix.module }} on Java ${{ matrix.java }}
99+ runs-on : ubuntu-latest
79100 steps :
80101 - uses : actions/checkout@v4
81102
@@ -84,23 +105,68 @@ jobs:
84105 with :
85106 distribution : temurin
86107 java-version : ${{ matrix.java }}
87- cache : ' maven'
88108
89- - name : Build with Maven
90- run : ./mvnw -B clean install -Dno-format -ntp
109+ - name : Download the Maven repo
110+ uses : actions/download-artifact@v4
111+ with :
112+ name : maven-repo
113+ path : ..
114+ - name : Unzip the Maven Repo
115+ shell : bash
116+ run : |
117+ tar -xzf ../maven-repo.tgz -C ~
91118
92- - name : Avoid caching our own artifacts
119+ # Build Jlama if JDK >= 21
120+ # It's not build by default as it requires Java 21+
121+ - name : Build JLama extension
122+ if : ${{ matrix.java >= 21 }}
93123 run : |
94- rm -Rf ~/.m2/repository/io/quarkiverse/langchain4j
124+ ./mvnw -B clean install -DskipTests -Dno-format -ntp -f model-providers/jlama/pom.xml
125+
126+ - name : Run tests of ${{ matrix.module }} with JDK ${{ matrix.java }}
127+ run : |
128+ cd ${{ matrix.module }} && ../mvnw -B verify -Dci=true -Dno-format -ntp
129+
95130
96131 native-tests :
97- needs : build-and-test-jvm
98- name : ${{matrix.testModule}} native tests
132+ needs : quick-build
133+ name : Native tests ${{matrix.module}}
99134 strategy :
100135 fail-fast : false
101- matrix : ${{ fromJson(needs.build-and-test-jvm.outputs.matrix) }}
136+ matrix :
137+ module : ${{fromJson(needs.quick-build.outputs.it_modules)}}
102138 runs-on : ubuntu-latest
139+ steps :
140+ - uses : actions/checkout@v4
141+
142+ - name : Set up JDK 17
143+ uses : actions/setup-java@v4
144+ with :
145+ distribution : temurin
146+ java-version : 17
147+
148+ - name : Download the Maven repo
149+ uses : actions/download-artifact@v4
150+ with :
151+ name : maven-repo
152+ path : ..
153+ - name : Unzip the Maven Repo
154+ shell : bash
155+ run : |
156+ tar -xzf ../maven-repo.tgz -C ~
103157
158+ - name : Run integration tests ${{matrix.module}}
159+ run : |
160+ cd integration-tests/${{matrix.module}} && ../../mvnw -B verify -Dnative -Dci=true -Dquarkus.native.container-build -Dnative.surefire.skip -Dno-format -ntp
161+
162+ in-process-embedding-model-tests :
163+ needs : quick-build
164+ name : Native tests ${{matrix.module}}
165+ strategy :
166+ fail-fast : false
167+ matrix :
168+ module : ${{fromJson(needs.quick-build.outputs.in_process_embedding_modules)}}
169+ runs-on : ubuntu-latest
104170 steps :
105171 - uses : actions/checkout@v4
106172
@@ -120,6 +186,7 @@ jobs:
120186 run : |
121187 tar -xzf ../maven-repo.tgz -C ~
122188
123- - name : Run integration test ${{matrix.testModule }}
189+ - name : Run integration tests ${{matrix.module }}
124190 run : |
125- cd integration-tests/${{matrix.testModule}} && ../../mvnw -B verify -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip -Dno-format -ntp
191+ cd integration-tests/in-process-embedding-models/${{matrix.module}}
192+ ../../../mvnw -B verify -Dnative -Dquarkus.native.container-build -Dci=true -Dnative.surefire.skip -Dno-format -ntp
0 commit comments