|
| 1 | +name: Fast CI/CD build |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Combined schedule covering both EST and CET working hours |
| 6 | + # Morning/Early builds |
| 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 | + # Midday builds |
| 10 | + - cron: '30 16 * * 1-5' # 7:30 PM CET / 11:30 AM EST |
| 11 | + # Afternoon/Evening builds |
| 12 | + - cron: '30 21 * * 1-5' # 10:30 PM CET / 4:30 PM EST |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-all: |
| 17 | + name: Build all modules |
| 18 | + runs-on: ubuntu-latest |
| 19 | + if: ${{ github.repository_owner == 'spring-projects' }} |
| 20 | + steps: |
| 21 | + - name: Checkout source code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Free Disk Space |
| 25 | + uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 |
| 26 | + with: |
| 27 | + large-packages: false |
| 28 | + docker-images: false |
| 29 | + |
| 30 | + - name: Set up JDK 17 |
| 31 | + uses: actions/setup-java@v4 |
| 32 | + with: |
| 33 | + java-version: '17' |
| 34 | + distribution: 'temurin' |
| 35 | + cache: 'maven' |
| 36 | + |
| 37 | + - name: Build all modules (skip tests) |
| 38 | + run: | |
| 39 | + ./mvnw -T 1C -DskipTests --batch-mode --update-snapshots clean install |
| 40 | +
|
| 41 | + - name: Generate Java docs |
| 42 | + if: github.ref == 'refs/heads/main' |
| 43 | + run: ./mvnw --batch-mode javadoc:aggregate |
| 44 | + |
| 45 | + - name: Generate assembly |
| 46 | + if: github.ref == 'refs/heads/main' |
| 47 | + working-directory: spring-ai-docs |
| 48 | + run: ../mvnw --batch-mode assembly:single |
| 49 | + |
| 50 | + - name: Upload Maven repository |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: maven-repo |
| 54 | + path: ~/.m2/repository |
| 55 | + retention-days: 1 |
| 56 | + |
| 57 | + - name: Upload Javadoc |
| 58 | + if: github.ref == 'refs/heads/main' |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: javadoc |
| 62 | + path: target/site/apidocs |
| 63 | + retention-days: 1 |
| 64 | + |
| 65 | + - name: Upload assembly |
| 66 | + if: github.ref == 'refs/heads/main' |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: assembly |
| 70 | + path: spring-ai-docs/target/*.zip |
| 71 | + retention-days: 1 |
| 72 | + |
| 73 | + test-ollama: |
| 74 | + name: Test Ollama |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: build-all |
| 77 | + if: ${{ github.repository_owner == 'spring-projects' }} |
| 78 | + services: |
| 79 | + ollama: |
| 80 | + image: ollama/ollama:latest |
| 81 | + ports: |
| 82 | + - 11434:11434 |
| 83 | + env: |
| 84 | + OLLAMA_WITH_REUSE: true |
| 85 | + OLLAMA_AUTOCONF_TESTS_ENABLED: "true" |
| 86 | + steps: |
| 87 | + - name: Checkout source code |
| 88 | + uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Set up JDK 17 |
| 91 | + uses: actions/setup-java@v4 |
| 92 | + with: |
| 93 | + java-version: '17' |
| 94 | + distribution: 'temurin' |
| 95 | + cache: 'maven' |
| 96 | + |
| 97 | + - name: Download Maven repository |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + name: maven-repo |
| 101 | + path: ~/.m2/repository |
| 102 | + |
| 103 | + - name: Configure Testcontainers |
| 104 | + run: | |
| 105 | + echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties |
| 106 | +
|
| 107 | + - name: Test Ollama modules |
| 108 | + env: |
| 109 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 110 | + SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 111 | + run: | |
| 112 | + ./mvnw --batch-mode --no-snapshot-updates \ |
| 113 | + -pl auto-configurations/models/spring-ai-autoconfigure-model-ollama \ |
| 114 | + -Pci-fast-integration-tests \ |
| 115 | + -Dfailsafe.rerunFailingTestsCount=3 \ |
| 116 | + verify |
| 117 | +
|
| 118 | + test-openai: |
| 119 | + name: Test OpenAI |
| 120 | + runs-on: ubuntu-latest |
| 121 | + needs: build-all |
| 122 | + if: ${{ github.repository_owner == 'spring-projects' }} |
| 123 | + steps: |
| 124 | + - name: Checkout source code |
| 125 | + uses: actions/checkout@v4 |
| 126 | + |
| 127 | + - name: Set up JDK 17 |
| 128 | + uses: actions/setup-java@v4 |
| 129 | + with: |
| 130 | + java-version: '17' |
| 131 | + distribution: 'temurin' |
| 132 | + cache: 'maven' |
| 133 | + |
| 134 | + - name: Download Maven repository |
| 135 | + uses: actions/download-artifact@v4 |
| 136 | + with: |
| 137 | + name: maven-repo |
| 138 | + path: ~/.m2/repository |
| 139 | + |
| 140 | + - name: Configure Testcontainers |
| 141 | + run: | |
| 142 | + echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties |
| 143 | +
|
| 144 | + - name: Test OpenAI modules |
| 145 | + env: |
| 146 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 147 | + SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 148 | + run: | |
| 149 | + ./mvnw --batch-mode --no-snapshot-updates \ |
| 150 | + -pl models/spring-ai-openai,auto-configurations/models/spring-ai-autoconfigure-model-openai \ |
| 151 | + -Pci-fast-integration-tests \ |
| 152 | + -Dfailsafe.rerunFailingTestsCount=3 \ |
| 153 | + verify |
| 154 | +
|
| 155 | + test-remaining: |
| 156 | + name: Test Remaining (MCP, Google GenAI, Chroma, PgVector) |
| 157 | + runs-on: ubuntu-latest |
| 158 | + needs: build-all |
| 159 | + if: ${{ github.repository_owner == 'spring-projects' }} |
| 160 | + steps: |
| 161 | + - name: Checkout source code |
| 162 | + uses: actions/checkout@v4 |
| 163 | + |
| 164 | + - name: Set up JDK 17 |
| 165 | + uses: actions/setup-java@v4 |
| 166 | + with: |
| 167 | + java-version: '17' |
| 168 | + distribution: 'temurin' |
| 169 | + cache: 'maven' |
| 170 | + |
| 171 | + - name: Download Maven repository |
| 172 | + uses: actions/download-artifact@v4 |
| 173 | + with: |
| 174 | + name: maven-repo |
| 175 | + path: ~/.m2/repository |
| 176 | + |
| 177 | + - name: Configure Testcontainers |
| 178 | + run: | |
| 179 | + echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties |
| 180 | +
|
| 181 | + - name: Test remaining modules |
| 182 | + env: |
| 183 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 184 | + SPRING_AI_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 185 | + run: | |
| 186 | + ./mvnw --batch-mode --no-snapshot-updates \ |
| 187 | + -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 \ |
| 188 | + -Pci-fast-integration-tests \ |
| 189 | + -Dfailsafe.rerunFailingTestsCount=3 \ |
| 190 | + verify |
| 191 | +
|
| 192 | + deploy-artifactory: |
| 193 | + name: Deploy to Artifactory |
| 194 | + runs-on: ubuntu-latest |
| 195 | + needs: [build-all, test-ollama, test-openai, test-remaining] |
| 196 | + if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'spring-projects' }} |
| 197 | + steps: |
| 198 | + - name: Checkout source code |
| 199 | + uses: actions/checkout@v4 |
| 200 | + |
| 201 | + - name: Set up JDK 17 |
| 202 | + uses: actions/setup-java@v4 |
| 203 | + with: |
| 204 | + java-version: '17' |
| 205 | + distribution: 'temurin' |
| 206 | + cache: 'maven' |
| 207 | + |
| 208 | + - name: Download Maven repository |
| 209 | + uses: actions/download-artifact@v4 |
| 210 | + with: |
| 211 | + name: maven-repo |
| 212 | + path: ~/.m2/repository |
| 213 | + |
| 214 | + - name: Deploy to Artifactory |
| 215 | + env: |
| 216 | + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} |
| 217 | + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} |
| 218 | + run: | |
| 219 | + ./mvnw -s settings.xml --batch-mode -DskipTests deploy |
| 220 | +
|
| 221 | + deploy-docs: |
| 222 | + name: Deploy documentation |
| 223 | + runs-on: ubuntu-latest |
| 224 | + needs: [build-all, test-ollama, test-openai, test-remaining] |
| 225 | + if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'spring-projects' }} |
| 226 | + steps: |
| 227 | + - name: Checkout source code |
| 228 | + uses: actions/checkout@v4 |
| 229 | + |
| 230 | + - name: Set up JDK 17 |
| 231 | + uses: actions/setup-java@v4 |
| 232 | + with: |
| 233 | + java-version: '17' |
| 234 | + distribution: 'temurin' |
| 235 | + cache: 'maven' |
| 236 | + |
| 237 | + - name: Download Javadoc |
| 238 | + uses: actions/download-artifact@v4 |
| 239 | + with: |
| 240 | + name: javadoc |
| 241 | + path: target/site/apidocs |
| 242 | + |
| 243 | + - name: Download assembly |
| 244 | + uses: actions/download-artifact@v4 |
| 245 | + with: |
| 246 | + name: assembly |
| 247 | + path: spring-ai-docs/target |
| 248 | + |
| 249 | + - name: Capture project version |
| 250 | + run: echo PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV |
| 251 | + |
| 252 | + - name: Setup SSH key |
| 253 | + env: |
| 254 | + DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }} |
| 255 | + DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }} |
| 256 | + run: | |
| 257 | + mkdir "$HOME/.ssh" |
| 258 | + echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key" |
| 259 | + chmod 600 "$HOME/.ssh/key" |
| 260 | + echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts" |
| 261 | +
|
| 262 | + - name: Deploy docs |
| 263 | + env: |
| 264 | + DOCS_HOST: ${{ secrets.DOCS_HOST }} |
| 265 | + DOCS_PATH: ${{ secrets.DOCS_PATH }} |
| 266 | + DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }} |
| 267 | + working-directory: spring-ai-docs/target |
| 268 | + run: | |
| 269 | + unzip spring-ai-$PROJECT_VERSION-docs.zip |
| 270 | + ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && mkdir -p $PROJECT_VERSION" |
| 271 | + scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION |
0 commit comments