Skip to content

Commit 7112eeb

Browse files
committed
Add fast-continuous-integration workflow for parallel CI builds
Split monolithic CI build into 8 parallel jobs to reduce build time from 94 minutes to ~30 minutes: - build-all: Compiles all modules with parallel builds (-T 1C) - 6 parallel test jobs: Grouped by timing for balanced execution - deploy-artifacts: Only runs if all tests pass (main branch only)
1 parent e157775 commit 7112eeb

File tree

1 file changed

+386
-0
lines changed

1 file changed

+386
-0
lines changed
Lines changed: 386 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,386 @@
1+
name: Fast CI/CD build
2+
3+
on:
4+
workflow_dispatch:
5+
# Note: Schedule triggers commented out for initial testing
6+
# schedule:
7+
# - cron: '30 6 * * 1-5' # 7:30 AM CET / 1:30 AM EST
8+
# - cron: '30 11 * * 1-5' # 12:30 PM CET / 6:30 AM EST
9+
# - cron: '30 16 * * 1-5' # 7:30 PM CET / 11:30 AM EST
10+
# - cron: '30 21 * * 1-5' # 10:30 PM CET / 4:30 PM EST
11+
12+
jobs:
13+
build-all:
14+
name: Build all modules
15+
runs-on: ubuntu-latest
16+
if: ${{ github.repository_owner == 'spring-projects' }}
17+
steps:
18+
- name: Checkout source code
19+
uses: actions/checkout@v4
20+
21+
- name: Free Disk Space
22+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
23+
with:
24+
large-packages: false
25+
docker-images: false
26+
27+
- name: Set up JDK 17
28+
uses: actions/setup-java@v4
29+
with:
30+
java-version: '17'
31+
distribution: 'temurin'
32+
cache: 'maven'
33+
34+
- name: Build all modules (skip tests)
35+
run: |
36+
./mvnw -T 1C -DskipTests --batch-mode --update-snapshots clean install
37+
38+
- name: Generate Java docs
39+
if: github.ref == 'refs/heads/main'
40+
run: ./mvnw --batch-mode javadoc:aggregate
41+
42+
- name: Generate assembly
43+
if: github.ref == 'refs/heads/main'
44+
working-directory: spring-ai-docs
45+
run: ../mvnw --batch-mode assembly:single
46+
47+
- name: Upload Maven repository
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: maven-repo
51+
path: ~/.m2/repository
52+
retention-days: 1
53+
54+
- name: Upload Javadoc
55+
if: github.ref == 'refs/heads/main'
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: javadoc
59+
path: target/site/apidocs
60+
retention-days: 1
61+
62+
- name: Upload assembly
63+
if: github.ref == 'refs/heads/main'
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: assembly
67+
path: spring-ai-docs/target/*.zip
68+
retention-days: 1
69+
70+
test-ollama:
71+
name: Test Ollama
72+
runs-on: ubuntu-latest
73+
needs: build-all
74+
if: ${{ github.repository_owner == 'spring-projects' }}
75+
services:
76+
ollama:
77+
image: ollama/ollama:latest
78+
ports:
79+
- 11434:11434
80+
env:
81+
OLLAMA_WITH_REUSE: true
82+
OLLAMA_AUTOCONF_TESTS_ENABLED: "true"
83+
steps:
84+
- name: Checkout source code
85+
uses: actions/checkout@v4
86+
87+
- name: Set up JDK 17
88+
uses: actions/setup-java@v4
89+
with:
90+
java-version: '17'
91+
distribution: 'temurin'
92+
cache: 'maven'
93+
94+
- name: Download Maven repository
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: maven-repo
98+
path: ~/.m2/repository
99+
100+
- name: Configure Testcontainers
101+
run: |
102+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
103+
104+
- name: Test Ollama modules
105+
env:
106+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
107+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
108+
run: |
109+
./mvnw --batch-mode --no-snapshot-updates \
110+
-pl auto-configurations/models/spring-ai-autoconfigure-model-ollama \
111+
-Pci-fast-integration-tests \
112+
-Dfailsafe.rerunFailingTestsCount=3 \
113+
verify
114+
115+
test-openai:
116+
name: Test OpenAI
117+
runs-on: ubuntu-latest
118+
needs: build-all
119+
if: ${{ github.repository_owner == 'spring-projects' }}
120+
steps:
121+
- name: Checkout source code
122+
uses: actions/checkout@v4
123+
124+
- name: Set up JDK 17
125+
uses: actions/setup-java@v4
126+
with:
127+
java-version: '17'
128+
distribution: 'temurin'
129+
cache: 'maven'
130+
131+
- name: Download Maven repository
132+
uses: actions/download-artifact@v4
133+
with:
134+
name: maven-repo
135+
path: ~/.m2/repository
136+
137+
- name: Configure Testcontainers
138+
run: |
139+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
140+
141+
- name: Test OpenAI modules
142+
env:
143+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
144+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
145+
run: |
146+
./mvnw --batch-mode --no-snapshot-updates \
147+
-pl models/spring-ai-openai,auto-configurations/models/spring-ai-autoconfigure-model-openai \
148+
-Pci-fast-integration-tests \
149+
-Dfailsafe.rerunFailingTestsCount=3 \
150+
verify
151+
152+
test-vector-stores-slow-1:
153+
name: Test Vector Stores (OpenSearch, Cassandra)
154+
runs-on: ubuntu-latest
155+
needs: build-all
156+
if: ${{ github.repository_owner == 'spring-projects' }}
157+
steps:
158+
- name: Checkout source code
159+
uses: actions/checkout@v4
160+
161+
- name: Set up JDK 17
162+
uses: actions/setup-java@v4
163+
with:
164+
java-version: '17'
165+
distribution: 'temurin'
166+
cache: 'maven'
167+
168+
- name: Download Maven repository
169+
uses: actions/download-artifact@v4
170+
with:
171+
name: maven-repo
172+
path: ~/.m2/repository
173+
174+
- name: Configure Testcontainers
175+
run: |
176+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
177+
178+
- name: Test OpenSearch and Cassandra vector stores
179+
env:
180+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
181+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
182+
run: |
183+
./mvnw --batch-mode --no-snapshot-updates \
184+
-pl vector-stores/spring-ai-opensearch-store,vector-stores/spring-ai-cassandra-store,\
185+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-opensearch,\
186+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-cassandra \
187+
-Pci-fast-integration-tests \
188+
-Dfailsafe.rerunFailingTestsCount=3 \
189+
verify
190+
191+
test-vector-stores-slow-2:
192+
name: Test Vector Stores (Elasticsearch, Couchbase, MongoDB)
193+
runs-on: ubuntu-latest
194+
needs: build-all
195+
if: ${{ github.repository_owner == 'spring-projects' }}
196+
steps:
197+
- name: Checkout source code
198+
uses: actions/checkout@v4
199+
200+
- name: Set up JDK 17
201+
uses: actions/setup-java@v4
202+
with:
203+
java-version: '17'
204+
distribution: 'temurin'
205+
cache: 'maven'
206+
207+
- name: Download Maven repository
208+
uses: actions/download-artifact@v4
209+
with:
210+
name: maven-repo
211+
path: ~/.m2/repository
212+
213+
- name: Configure Testcontainers
214+
run: |
215+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
216+
217+
- name: Test Elasticsearch, Couchbase, MongoDB vector stores
218+
env:
219+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
220+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
221+
run: |
222+
./mvnw --batch-mode --no-snapshot-updates \
223+
-pl vector-stores/spring-ai-elasticsearch-store,vector-stores/spring-ai-couchbase-store,\
224+
vector-stores/spring-ai-mongodb-atlas-store,\
225+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-elasticsearch,\
226+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-couchbase,\
227+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-mongodb-atlas \
228+
-Pci-fast-integration-tests \
229+
-Dfailsafe.rerunFailingTestsCount=3 \
230+
verify
231+
232+
test-vector-stores-medium:
233+
name: Test Vector Stores (Milvus, PgVector, Neo4j, MariaDB, Oracle)
234+
runs-on: ubuntu-latest
235+
needs: build-all
236+
if: ${{ github.repository_owner == 'spring-projects' }}
237+
steps:
238+
- name: Checkout source code
239+
uses: actions/checkout@v4
240+
241+
- name: Set up JDK 17
242+
uses: actions/setup-java@v4
243+
with:
244+
java-version: '17'
245+
distribution: 'temurin'
246+
cache: 'maven'
247+
248+
- name: Download Maven repository
249+
uses: actions/download-artifact@v4
250+
with:
251+
name: maven-repo
252+
path: ~/.m2/repository
253+
254+
- name: Configure Testcontainers
255+
run: |
256+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
257+
258+
- name: Test Milvus, PgVector, Neo4j, MariaDB, Oracle vector stores
259+
env:
260+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
261+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
262+
run: |
263+
./mvnw --batch-mode --no-snapshot-updates \
264+
-pl vector-stores/spring-ai-milvus-store,vector-stores/spring-ai-pgvector-store,\
265+
vector-stores/spring-ai-neo4j-store,vector-stores/spring-ai-mariadb-store,\
266+
vector-stores/spring-ai-oracle-store,\
267+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-milvus,\
268+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-pgvector,\
269+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-neo4j,\
270+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-mariadb,\
271+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-oracle \
272+
-Pci-fast-integration-tests \
273+
-Dfailsafe.rerunFailingTestsCount=3 \
274+
verify
275+
276+
test-remaining:
277+
name: Test Remaining (MCP, Google GenAI, Chroma, etc.)
278+
runs-on: ubuntu-latest
279+
needs: build-all
280+
if: ${{ github.repository_owner == 'spring-projects' }}
281+
steps:
282+
- name: Checkout source code
283+
uses: actions/checkout@v4
284+
285+
- name: Set up JDK 17
286+
uses: actions/setup-java@v4
287+
with:
288+
java-version: '17'
289+
distribution: 'temurin'
290+
cache: 'maven'
291+
292+
- name: Download Maven repository
293+
uses: actions/download-artifact@v4
294+
with:
295+
name: maven-repo
296+
path: ~/.m2/repository
297+
298+
- name: Configure Testcontainers
299+
run: |
300+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
301+
302+
- name: Test remaining modules
303+
env:
304+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
305+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
306+
run: |
307+
./mvnw --batch-mode --no-snapshot-updates \
308+
-pl models/spring-ai-google-genai,\
309+
auto-configurations/models/spring-ai-autoconfigure-model-google-genai,\
310+
mcp/common,mcp/mcp-annotations-spring,\
311+
auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-common,\
312+
auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-httpclient,\
313+
auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-webflux,\
314+
auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common,\
315+
auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webmvc,\
316+
auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux,\
317+
vector-stores/spring-ai-chroma-store,\
318+
auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-chroma \
319+
-Pci-fast-integration-tests \
320+
-Dfailsafe.rerunFailingTestsCount=3 \
321+
verify
322+
323+
deploy-artifacts:
324+
name: Deploy artifacts
325+
runs-on: ubuntu-latest
326+
needs: [build-all, test-ollama, test-openai, test-vector-stores-slow-1, test-vector-stores-slow-2, test-vector-stores-medium, test-remaining]
327+
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'spring-projects' }}
328+
steps:
329+
- name: Checkout source code
330+
uses: actions/checkout@v4
331+
332+
- name: Set up JDK 17
333+
uses: actions/setup-java@v4
334+
with:
335+
java-version: '17'
336+
distribution: 'temurin'
337+
cache: 'maven'
338+
339+
- name: Download Maven repository
340+
uses: actions/download-artifact@v4
341+
with:
342+
name: maven-repo
343+
path: ~/.m2/repository
344+
345+
- name: Download Javadoc
346+
uses: actions/download-artifact@v4
347+
with:
348+
name: javadoc
349+
path: target/site/apidocs
350+
351+
- name: Download assembly
352+
uses: actions/download-artifact@v4
353+
with:
354+
name: assembly
355+
path: spring-ai-docs/target
356+
357+
- name: Capture project version
358+
run: echo PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV
359+
360+
- name: Deploy to Artifactory
361+
env:
362+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
363+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
364+
run: |
365+
./mvnw -s settings.xml --batch-mode -DskipTests deploy
366+
367+
- name: Setup SSH key
368+
env:
369+
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
370+
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
371+
run: |
372+
mkdir "$HOME/.ssh"
373+
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
374+
chmod 600 "$HOME/.ssh/key"
375+
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
376+
377+
- name: Deploy docs
378+
env:
379+
DOCS_HOST: ${{ secrets.DOCS_HOST }}
380+
DOCS_PATH: ${{ secrets.DOCS_PATH }}
381+
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
382+
working-directory: spring-ai-docs/target
383+
run: |
384+
unzip spring-ai-$PROJECT_VERSION-docs.zip
385+
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && mkdir -p $PROJECT_VERSION"
386+
scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION

0 commit comments

Comments
 (0)