CI/CD build #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD build | |
on: | |
schedule: | |
# Daily builds at reasonable intervals | |
- cron: '0 9 * * 1-5' # 9:00 AM UTC weekdays | |
- cron: '0 21 * * 1-5' # 9:00 PM UTC weekdays | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/**' | |
- 'docs/**' | |
- '*.md' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/**' | |
- 'docs/**' | |
- '*.md' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
if: ${{ github.repository_owner == 'spring-ai-community' }} | |
concurrency: | |
group: continuous-integration-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Install Claude Code CLI | |
run: | | |
# Install Claude Code CLI from npm globally - npm handles the symlink automatically | |
npm install -g @anthropic-ai/claude-code --silent | |
echo "✅ Claude Code CLI installed via npm" | |
- name: Install Gemini CLI | |
run: | | |
# Install official Gemini CLI from npm | |
npm install -g @google/gemini-cli --silent | |
echo "✅ Gemini CLI installed via npm" | |
- name: Verify CLI installations | |
run: | | |
echo "=== Verifying CLI installations ===" | |
# Check Claude CLI | |
if [ -L "/usr/local/bin/claude" ] && [ -f "/usr/local/bin/claude" ]; then | |
echo "✅ Claude CLI verified: $(/usr/local/bin/claude --version 2>&1)" | |
else | |
echo "❌ Claude CLI not found" | |
exit 1 | |
fi | |
# Check Gemini CLI | |
if [ -L "/usr/local/bin/gemini" ] && [ -f "/usr/local/bin/gemini" ]; then | |
echo "✅ Gemini CLI verified: $(/usr/local/bin/gemini --version 2>&1)" | |
else | |
echo "❌ Gemini CLI not found" | |
exit 1 | |
fi | |
- name: Build and test with Maven | |
env: | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
run: ./mvnw --batch-mode --quiet clean test | |
- name: Generate Java docs | |
if: github.ref == 'refs/heads/main' | |
run: ./mvnw --batch-mode --quiet javadoc:aggregate | |
- name: Build documentation | |
if: github.ref == 'refs/heads/main' | |
run: ./mvnw --quiet clean antora:antora -pl docs |