Skip to content

Commit 8e09331

Browse files
committed
Introduce new workflow
Signed-off-by: Eric Bottard <[email protected]>
1 parent e59be78 commit 8e09331

File tree

1 file changed

+294
-0
lines changed

1 file changed

+294
-0
lines changed
Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
name: Fast CI/CD build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- '[0-9].[0-9].x'
8+
- 'workflows-rework-main'
9+
10+
jobs:
11+
build-all:
12+
name: Build all modules
13+
runs-on: ubuntu-latest
14+
if: ${{ github.repository_owner == 'spring-projects' }}
15+
steps:
16+
- name: Checkout source code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '25'
23+
distribution: 'temurin'
24+
cache: 'maven'
25+
26+
- name: Setup Maven Build-Cache (~/.m2/build-cache)
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.m2/build-cache
30+
key: build-cache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: |
32+
build-cache-${{ runner.os }}-
33+
34+
- name: Build all modules with unit tests
35+
run: |
36+
./mvnw --batch-mode -ntp --update-snapshots clean install
37+
38+
- name: Upload Spring-AI Built Artifacts
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: build-artifacts
42+
path: ~/.m2/repository/org/springframework/ai
43+
retention-days: 1 # Intent is to share only with downstream jobs in this workflow
44+
45+
test-ollama:
46+
name: Test Ollama
47+
runs-on: ubuntu-latest
48+
needs: build-all
49+
if: ${{ github.repository_owner == 'spring-projects' }}
50+
services:
51+
ollama:
52+
image: ollama/ollama:latest
53+
ports:
54+
- 11434:11434
55+
env:
56+
OLLAMA_WITH_REUSE: true
57+
OLLAMA_AUTOCONF_TESTS_ENABLED: "true"
58+
steps:
59+
- name: Checkout source code
60+
uses: actions/checkout@v4
61+
62+
- name: Set up JDK
63+
uses: actions/setup-java@v4
64+
with:
65+
java-version: '25'
66+
distribution: 'temurin'
67+
cache: 'maven'
68+
69+
- name: Setup Maven Build-Cache (~/.m2/build-cache)
70+
uses: actions/cache@v4
71+
with:
72+
path: ~/.m2/build-cache
73+
key: build-cache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
74+
restore-keys: |
75+
build-cache-${{ runner.os }}-
76+
77+
- name: Download Spring-AI Built Artifacts
78+
uses: actions/download-artifact@v4
79+
with:
80+
name: build-artifacts
81+
path: ~/.m2/repository/org/springframework/ai
82+
83+
- name: Configure Testcontainers
84+
run: |
85+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
86+
87+
- name: Test Ollama modules
88+
env:
89+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
90+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
91+
run: |
92+
./mvnw --batch-mode -ntp --no-snapshot-updates \
93+
-pl models/spring-ai-ollama,auto-configurations/models/spring-ai-autoconfigure-model-ollama \
94+
-Pci-fast-integration-tests \
95+
-Dfailsafe.rerunFailingTestsCount=3 \
96+
verify
97+
98+
test-openai:
99+
name: Test OpenAI
100+
runs-on: ubuntu-latest
101+
needs: build-all
102+
if: ${{ github.repository_owner == 'spring-projects' }}
103+
steps:
104+
- name: Checkout source code
105+
uses: actions/checkout@v4
106+
107+
- name: Set up JDK
108+
uses: actions/setup-java@v4
109+
with:
110+
java-version: '25'
111+
distribution: 'temurin'
112+
cache: 'maven'
113+
114+
- name: Download Maven repository
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: maven-repo
118+
path: ~/.m2/repository
119+
120+
- name: Configure Testcontainers
121+
run: |
122+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
123+
124+
- name: Test OpenAI modules
125+
env:
126+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
127+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
128+
run: |
129+
./mvnw --batch-mode -ntp --no-snapshot-updates \
130+
-pl models/spring-ai-openai,auto-configurations/models/spring-ai-autoconfigure-model-openai \
131+
-Pci-fast-integration-tests \
132+
-Dfailsafe.rerunFailingTestsCount=3 \
133+
verify
134+
135+
test-remaining:
136+
name: Test Remaining (MCP, Google GenAI, Chroma, PgVector)
137+
runs-on: ubuntu-latest
138+
needs: build-all
139+
if: ${{ github.repository_owner == 'spring-projects' }}
140+
steps:
141+
- name: Checkout source code
142+
uses: actions/checkout@v4
143+
144+
- name: Set up JDK
145+
uses: actions/setup-java@v4
146+
with:
147+
java-version: '25'
148+
distribution: 'temurin'
149+
cache: 'maven'
150+
151+
- name: Download Maven repository
152+
uses: actions/download-artifact@v4
153+
with:
154+
name: maven-repo
155+
path: ~/.m2/repository
156+
157+
- name: Configure Testcontainers
158+
run: |
159+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
160+
161+
- name: Test remaining modules
162+
env:
163+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
164+
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
165+
run: |
166+
./mvnw --batch-mode -ntp --no-snapshot-updates \
167+
-pl models/spring-ai-google-genai,auto-configurations/models/spring-ai-autoconfigure-model-google-genai,mcp/common,mcp/mcp-annotations-spring,auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-common,auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-httpclient,auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-webflux,auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common,auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webmvc,auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux,vector-stores/spring-ai-chroma-store,vector-stores/spring-ai-pgvector-store,spring-ai-integration-tests \
168+
-Pci-fast-integration-tests \
169+
-Dfailsafe.rerunFailingTestsCount=3 \
170+
verify
171+
172+
generate-artifacts:
173+
name: Generate documentation artifacts
174+
runs-on: ubuntu-latest
175+
needs: [build-all, test-ollama, test-openai, test-remaining]
176+
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/1.1.x') && github.repository_owner == 'spring-projects' }}
177+
steps:
178+
- name: Checkout source code
179+
uses: actions/checkout@v4
180+
181+
- name: Set up JDK
182+
uses: actions/setup-java@v4
183+
with:
184+
java-version: '25'
185+
distribution: 'temurin'
186+
cache: 'maven'
187+
188+
- name: Download Maven repository
189+
uses: actions/download-artifact@v4
190+
with:
191+
name: maven-repo
192+
path: ~/.m2/repository
193+
194+
- name: Generate Java docs
195+
run: ./mvnw --batch-mode -ntp javadoc:aggregate
196+
197+
- name: Generate assembly
198+
working-directory: spring-ai-docs
199+
run: ../mvnw --batch-mode -ntp assembly:single
200+
201+
- name: Upload Javadoc
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: javadoc
205+
path: target/site/apidocs
206+
retention-days: 1
207+
208+
- name: Upload assembly
209+
uses: actions/upload-artifact@v4
210+
with:
211+
name: assembly
212+
path: spring-ai-docs/target/*.zip
213+
retention-days: 1
214+
215+
deploy-artifactory:
216+
name: Deploy to Artifactory
217+
runs-on: ubuntu-latest
218+
needs: [build-all, test-ollama, test-openai, test-remaining]
219+
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/1.1.x') && github.repository_owner == 'spring-projects' }}
220+
steps:
221+
- name: Checkout source code
222+
uses: actions/checkout@v4
223+
224+
- name: Set up JDK
225+
uses: actions/setup-java@v4
226+
with:
227+
java-version: '25'
228+
distribution: 'temurin'
229+
cache: 'maven'
230+
231+
- name: Download Maven repository
232+
uses: actions/download-artifact@v4
233+
with:
234+
name: maven-repo
235+
path: ~/.m2/repository
236+
237+
- name: Deploy to Artifactory
238+
env:
239+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
240+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
241+
run: |
242+
./mvnw -s settings.xml --batch-mode -ntp -DskipTests deploy
243+
244+
deploy-docs:
245+
name: Deploy documentation
246+
runs-on: ubuntu-latest
247+
needs: [generate-artifacts]
248+
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/1.1.x') && github.repository_owner == 'spring-projects' }}
249+
steps:
250+
- name: Checkout source code
251+
uses: actions/checkout@v4
252+
253+
- name: Set up JDK
254+
uses: actions/setup-java@v4
255+
with:
256+
java-version: '25'
257+
distribution: 'temurin'
258+
cache: 'maven'
259+
260+
- name: Download Javadoc
261+
uses: actions/download-artifact@v4
262+
with:
263+
name: javadoc
264+
path: target/site/apidocs
265+
266+
- name: Download assembly
267+
uses: actions/download-artifact@v4
268+
with:
269+
name: assembly
270+
path: spring-ai-docs/target
271+
272+
- name: Capture project version
273+
run: echo PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV
274+
275+
- name: Setup SSH key
276+
env:
277+
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
278+
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
279+
run: |
280+
mkdir "$HOME/.ssh"
281+
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
282+
chmod 600 "$HOME/.ssh/key"
283+
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
284+
285+
- name: Deploy docs
286+
env:
287+
DOCS_HOST: ${{ secrets.DOCS_HOST }}
288+
DOCS_PATH: ${{ secrets.DOCS_PATH }}
289+
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
290+
working-directory: spring-ai-docs/target
291+
run: |
292+
unzip spring-ai-$PROJECT_VERSION-docs.zip
293+
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && mkdir -p $PROJECT_VERSION"
294+
scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION

0 commit comments

Comments
 (0)