-
Notifications
You must be signed in to change notification settings - Fork 2.4k
281 lines (241 loc) · 10.2 KB
/
continuous-integration.yml
File metadata and controls
281 lines (241 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
name: Build + Deploy on development branches
on:
push:
branches:
- 'main'
- '[0-9].[0-9].x'
schedule:
- cron: '30 11 * * 1-5' # 12:30 PM CET / 6:30 AM
workflow_dispatch:
concurrency:
group: ${{ github.workflow_ref }}
cancel-in-progress: true
jobs:
build-all:
name: Build all modules
if: ${{ github.repository_owner == 'spring-projects' }}
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Setup Maven Build-Cache (~/.m2/build-cache)
if: ${{ github.event_name != 'schedule' }}
uses: actions/cache@v4
with:
path: ~/.m2/build-cache
# See pr-check.yml for an explanation of the key format
key: build-cache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
build-cache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}-
build-cache-${{ runner.os }}-
- name: Build all modules with unit tests
run: |
./mvnw --batch-mode -ntp --update-snapshots clean install
- name: Upload Spring-AI Built Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: ~/.m2/repository/org/springframework/ai
retention-days: 1 # Intent is to share only with downstream jobs in this workflow
- name: Purge Spring AI Built Artifacts # We don't want the setup-java m2 cache to capture our products, only our deps
run: |
rm -fr ~/.m2/repository/org/springframework/ai
test-ollama:
name: Test Ollama
if: ${{ github.repository_owner == 'spring-projects' }}
runs-on: ubuntu-latest
needs: build-all
services:
ollama:
image: ollama/ollama:latest
ports:
- 11434:11434
env:
OLLAMA_WITH_REUSE: true
OLLAMA_AUTOCONF_TESTS_ENABLED: "true"
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Setup Maven Build-Cache (~/.m2/build-cache)
uses: actions/cache@v4
if: ${{ github.event_name != 'schedule' }}
with:
path: ~/.m2/build-cache
key: build-cache-${{ runner.os }}-ollama-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
build-cache-${{ runner.os }}-ollama-${{ hashFiles('**/pom.xml') }}-
build-cache-${{ runner.os }}-
- name: Download Spring-AI Built Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ~/.m2/repository/org/springframework/ai
- name: Configure Testcontainers
run: |
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
- name: Test Ollama modules
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
./mvnw --batch-mode -ntp --no-snapshot-updates \
-pl models/spring-ai-ollama,auto-configurations/models/spring-ai-autoconfigure-model-ollama \
-Pci-fast-integration-tests \
-Dfailsafe.rerunFailingTestsCount=3 \
verify
test-openai:
name: Test OpenAI
if: ${{ github.repository_owner == 'spring-projects' }}
runs-on: ubuntu-latest
needs: build-all
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Setup Maven Build-Cache (~/.m2/build-cache)
uses: actions/cache@v4
with:
path: ~/.m2/build-cache
key: build-cache-${{ runner.os }}-openai-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
build-cache-${{ runner.os }}-openai-${{ hashFiles('**/pom.xml') }}-
build-cache-${{ runner.os }}-
- name: Download Spring-AI Built Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ~/.m2/repository/org/springframework/ai
- name: Configure Testcontainers
run: |
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
- name: Test OpenAI modules
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
./mvnw --batch-mode -ntp --no-snapshot-updates \
-pl models/spring-ai-openai,auto-configurations/models/spring-ai-autoconfigure-model-openai \
-Pci-fast-integration-tests \
-Dfailsafe.rerunFailingTestsCount=3 \
verify
test-remaining:
name: Test Remaining (MCP, Google GenAI, Chroma, PgVector)
if: ${{ github.repository_owner == 'spring-projects' }}
runs-on: ubuntu-latest
needs: build-all
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Setup Maven Build-Cache (~/.m2/build-cache)
uses: actions/cache@v4
with:
path: ~/.m2/build-cache
key: build-cache-${{ runner.os }}-other-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
build-cache-${{ runner.os }}-other-${{ hashFiles('**/pom.xml') }}-
build-cache-${{ runner.os }}-
- name: Download Spring-AI Built Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ~/.m2/repository/org/springframework/ai
- name: Configure Testcontainers
run: |
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
- name: Test remaining modules
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
./mvnw --batch-mode -ntp --no-snapshot-updates \
-pl models/spring-ai-google-genai,auto-configurations/models/spring-ai-autoconfigure-model-google-genai,mcp/common,mcp/mcp-annotations,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 \
-Pci-fast-integration-tests \
-Dfailsafe.rerunFailingTestsCount=3 \
verify
handle-documentation:
name: Generate and upload javadocs, trigger antora reference doc
if: ${{ github.repository_owner == 'spring-projects' && github.event_name != 'schedule'}}
runs-on: ubuntu-latest
permissions:
actions: write
needs: [build-all, test-ollama, test-openai, test-remaining]
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Trigger Antora build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run deploy-docs.yml -r docs-build
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
# NOT setting up maven build-cache b/c javadoc:aggregate-jar is forking lifecyle and can't benefit from it anyway
- name: Generate Java docs
run: ./mvnw --batch-mode -ntp javadoc:aggregate-jar
- name: Capture project version
run: echo PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV
- name: Setup SSH key
run: |
mkdir "$HOME/.ssh"
echo "${{ secrets.DOCS_SSH_KEY }}" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
echo "${{ secrets.DOCS_SSH_HOST_KEY }}" > "$HOME/.ssh/known_hosts"
- name: Deploy docs
run: |
ssh -i $HOME/.ssh/key ${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }} "cd ${{ secrets.DOCS_PATH }} && rm -fr $PROJECT_VERSION && mkdir -p $PROJECT_VERSION"
scp -i $HOME/.ssh/key target/spring-ai-parent-${PROJECT_VERSION}-javadoc.jar ${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}:${{ secrets.DOCS_PATH }}/$PROJECT_VERSION
ssh -i $HOME/.ssh/key ${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }} "cd ${{ secrets.DOCS_PATH }}/${PROJECT_VERSION} && unzip spring-ai-parent-${PROJECT_VERSION}-javadoc.jar -d api && rm spring-ai-parent-${PROJECT_VERSION}-javadoc.jar"
deploy-artifactory:
name: Deploy to Artifactory
runs-on: ubuntu-latest
needs: [build-all, test-ollama, test-openai, test-remaining]
if: ${{ github.repository_owner == 'spring-projects' && github.event_name != 'schedule' }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Setup Maven Build-Cache (~/.m2/build-cache)
uses: actions/cache@v4
with:
path: ~/.m2/build-cache
key: build-cache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
build-cache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}-
build-cache-${{ runner.os }}-
- name: Deploy to Artifactory
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: |
./mvnw -s settings.xml --batch-mode -ntp -Dmaven.test.skip deploy