@@ -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,63 @@ 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+
88+ echo "all_modules=${ALL_MODULES}" >> $GITHUB_OUTPUT
89+ echo "it_modules=${IT_MODULES}" >> $GITHUB_OUTPUT
90+ echo "in_process_embedding_modules=${IN_PROCESS_EMBEDDING_MODULES}" >> $GITHUB_OUTPUT
91+
92+ test-jvm :
93+ needs : quick-build
7294 strategy :
7395 fail-fast : false
7496 matrix :
75- os : [ubuntu-latest ]
76- java : [21, 22, 23]
77- name : Test on ${{ matrix.os }} - ${{ matrix.java }}
78- runs-on : ${{ matrix.os }}
97+ java : [ 17, 21, 23 ]
98+ module : ${{fromJson(needs.quick-build.outputs.all_modules)}}
99+ name : Build and Test ${{ matrix.module }} on Java ${{ matrix.java }}
100+ runs-on : ubuntu-latest
79101 steps :
80102 - uses : actions/checkout@v4
81103
@@ -84,23 +106,68 @@ jobs:
84106 with :
85107 distribution : temurin
86108 java-version : ${{ matrix.java }}
87- cache : ' maven'
88109
89- - name : Build with Maven
90- run : ./mvnw -B clean install -Dno-format -ntp
110+ - name : Download the Maven repo
111+ uses : actions/download-artifact@v4
112+ with :
113+ name : maven-repo
114+ path : ..
115+ - name : Unzip the Maven Repo
116+ shell : bash
117+ run : |
118+ tar -xzf ../maven-repo.tgz -C ~
91119
92- - name : Avoid caching our own artifacts
120+ # Build Jlama if JDK >= 21
121+ # It's not build by default as it requires Java 21+
122+ - name : Build JLama extension
123+ if : ${{ matrix.java >= 21 }}
93124 run : |
94- rm -Rf ~/.m2/repository/io/quarkiverse/langchain4j
125+ ./mvnw -B clean install -DskipTests -Dno-format -ntp -f model-providers/jlama/pom.xml
126+
127+ - name : Run tests of ${{ matrix.module }} with JDK ${{ matrix.java }}
128+ run : |
129+ cd ${{ matrix.module }} && ../mvnw -B verify -Dno-format -ntp
130+
95131
96132 native-tests :
97- needs : build-and-test-jvm
98- name : ${{matrix.testModule}} native tests
133+ needs : quick-build
134+ name : Native tests ${{matrix.module}}
99135 strategy :
100136 fail-fast : false
101- matrix : ${{ fromJson(needs.build-and-test-jvm.outputs.matrix) }}
137+ matrix :
138+ module : ${{fromJson(needs.quick-build.outputs.it_modules)}}
102139 runs-on : ubuntu-latest
140+ steps :
141+ - uses : actions/checkout@v4
142+
143+ - name : Set up JDK 17
144+ uses : actions/setup-java@v4
145+ with :
146+ distribution : temurin
147+ java-version : 17
148+
149+ - name : Download the Maven repo
150+ uses : actions/download-artifact@v4
151+ with :
152+ name : maven-repo
153+ path : ..
154+ - name : Unzip the Maven Repo
155+ shell : bash
156+ run : |
157+ tar -xzf ../maven-repo.tgz -C ~
103158
159+ - name : Run integration tests ${{matrix.module}}
160+ run : |
161+ cd integration-tests/${{matrix.module}} && ../../mvnw -B verify -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip -Dno-format -ntp
162+
163+ in-process-embedding-model-tests :
164+ needs : quick-build
165+ name : Native tests ${{matrix.module}}
166+ strategy :
167+ fail-fast : false
168+ matrix :
169+ module : ${{fromJson(needs.quick-build.outputs.in_process_embedding_modules)}}
170+ runs-on : ubuntu-latest
104171 steps :
105172 - uses : actions/checkout@v4
106173
@@ -120,6 +187,7 @@ jobs:
120187 run : |
121188 tar -xzf ../maven-repo.tgz -C ~
122189
123- - name : Run integration test ${{matrix.testModule }}
190+ - name : Run integration tests ${{matrix.module }}
124191 run : |
125- cd integration-tests/${{matrix.testModule}} && ../../mvnw -B verify -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip -Dno-format -ntp
192+ cd integration-tests/in-process-embedding-models/${{matrix.module}}
193+ ../../../mvnw -B verify -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip -Dno-format -ntp
0 commit comments