Skip to content

Commit 995efef

Browse files
committed
Complete backport: Add missing improvements to maintenance-fast.yml
- Add run-name for better visibility in workflow list - Add workflow_dispatch with commit SHA input for manual testing - Add paths-ignore to reduce noise from docs/workflow changes - Add "Checkout specific commit" step for manual testing capability - Improve "Show commit range" with better formatting and context - Streamline "Compute impacted modules" to match main branch approach - Add conditional Ollama service startup based on module names - Use ci-fast-integration-tests profile for consistency - Disable Maven cache to reduce post-job noise - Add Testcontainers configuration Now maintenance-fast.yml has full feature parity with main-push-fast.yml Signed-off-by: Mark Pollack <[email protected]>
1 parent 6312cf4 commit 995efef

File tree

1 file changed

+89
-46
lines changed

1 file changed

+89
-46
lines changed

.github/workflows/maintenance-fast.yml

Lines changed: 89 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
name: Maintenance Push – Fast
2+
run-name: ${{ github.event.inputs.commit_sha && format('Manual Test - {0}', github.event.inputs.commit_sha) || format('Fast Build - {0}', github.event.head_commit.message) }}
23

34
on:
45
push:
56
branches: ['*.*.x']
7+
paths-ignore:
8+
- 'spring-ai-docs/**'
9+
- '*.md'
10+
- 'docs/**'
11+
- '.github/**'
12+
workflow_dispatch:
13+
inputs:
14+
commit_sha:
15+
description: 'Specific commit SHA to test (optional - defaults to latest)'
16+
required: false
17+
type: string
618

719
jobs:
820
fast-impacted:
9-
if: contains(github.event.head_commit.message, '(cherry picked from commit')
21+
name: Fast Build - Affected Modules
22+
if: ${{ contains(github.event.head_commit.message, '(cherry picked from commit') || github.event_name == 'workflow_dispatch' }}
1023
runs-on: ubuntu-latest
1124
permissions:
1225
contents: read
@@ -15,68 +28,98 @@ jobs:
1528
cancel-in-progress: true
1629
steps:
1730
- uses: actions/checkout@v4
18-
with: { fetch-depth: 2 } # Need HEAD and HEAD~1 for single commit diff
31+
with:
32+
fetch-depth: 0 # Always use full history for manual runs to find any commit
33+
34+
- name: Checkout specific commit
35+
if: github.event.inputs.commit_sha
36+
run: |
37+
echo "Checking out specific commit: ${{ github.event.inputs.commit_sha }}"
38+
# Save the latest branch reference
39+
LATEST_BRANCH=$(git rev-parse origin/${{ github.ref_name }})
40+
41+
# Checkout the target commit
42+
git checkout ${{ github.event.inputs.commit_sha }}
43+
44+
# Preserve all latest GitHub Actions scripts from branch
45+
echo "Using latest GitHub Actions scripts from ${{ github.ref_name }}..."
46+
# Copy all scripts from branch's .github/scripts directory (excluding __pycache__)
47+
for script in $(git ls-tree -r --name-only ${LATEST_BRANCH} .github/scripts/ | grep -v __pycache__); do
48+
echo " Updating ${script}"
49+
mkdir -p $(dirname ${script})
50+
git show ${LATEST_BRANCH}:${script} > ${script}
51+
done
52+
# Note: The workflow itself is already from branch (since that's what's running)
1953
2054
- uses: actions/setup-java@v4
2155
with:
2256
java-version: '17'
2357
distribution: 'temurin'
24-
cache: 'maven'
58+
# cache: 'maven' # Disabled for fast workflow - reduces post-job noise
2559

2660
- name: Set up Python
2761
uses: actions/setup-python@v5
2862
with:
2963
python-version: '3.11'
3064

65+
- name: Configure Testcontainers
66+
run: |
67+
echo "testcontainers.reuse.enable=true" > $HOME/.testcontainers.properties
68+
3169
- name: Show commit range
3270
run: |
33-
echo "Base ref: origin/$GITHUB_REF_NAME"
34-
git log --oneline "origin/$GITHUB_REF_NAME...HEAD"
71+
if [ -n "${{ github.event.inputs.commit_sha }}" ]; then
72+
echo "🧪 MANUAL TEST RUN"
73+
echo "Testing specific commit: ${{ github.event.inputs.commit_sha }}"
74+
echo ""
75+
echo "📋 Commit Details:"
76+
git log --format=" Author: %an <%ae>%n Date: %ad%n Message: %s" -1 HEAD
77+
echo ""
78+
echo "📁 Changed Files:"
79+
git diff --name-only HEAD~1..HEAD | head -10
80+
if [ $(git diff --name-only HEAD~1..HEAD | wc -l) -gt 10 ]; then
81+
echo " ... and $(( $(git diff --name-only HEAD~1..HEAD | wc -l) - 10 )) more files"
82+
fi
83+
else
84+
echo "🚀 AUTOMATIC BUILD"
85+
echo "Testing cherry-picked commit on ${{ github.ref_name }} branch"
86+
echo ""
87+
echo "📋 Commit Details:"
88+
git log --format=" Author: %an <%ae>%n Date: %ad%n Message: %s" -1 HEAD
89+
fi
3590
3691
- name: Compute impacted modules
3792
id: mods
3893
run: |
39-
echo "=== Module Detection Debug Info ==="
40-
echo "Environment variables:"
41-
echo " GITHUB_REF_NAME: $GITHUB_REF_NAME"
42-
echo " GITHUB_REF: $GITHUB_REF"
43-
echo " PWD: $(pwd)"
44-
echo ""
45-
46-
echo "Git state verification:"
47-
echo " HEAD: $(git rev-parse HEAD 2>/dev/null || echo 'FAILED')"
48-
echo " HEAD~1: $(git rev-parse HEAD~1 2>/dev/null || echo 'NOT AVAILABLE')"
49-
echo " Branch: $(git branch --show-current 2>/dev/null || echo 'DETACHED')"
50-
echo ""
51-
52-
echo "Testing different git diff approaches:"
53-
echo "1. HEAD~1..HEAD:"
54-
git diff --name-only HEAD~1..HEAD 2>&1 | head -10 || echo " FAILED: $?"
55-
56-
echo "2. git show HEAD:"
57-
git show --name-only --format= HEAD 2>&1 | head -10 || echo " FAILED: $?"
58-
59-
echo "3. Recent commits:"
60-
git log --oneline -3 2>/dev/null || echo " Git log failed"
61-
echo ""
62-
63-
echo "=== Running test_discovery.py with full debugging ==="
64-
set -x # Enable bash debug mode
65-
MODS=$(python3 .github/scripts/test_discovery.py modules-from-diff --base "origin/$GITHUB_REF_NAME" --verbose 2>&1)
66-
EXIT_CODE=$?
67-
set +x # Disable bash debug mode
68-
69-
echo ""
70-
echo "=== Test Discovery Results ==="
71-
echo "Exit code: $EXIT_CODE"
72-
echo "Output:"
73-
echo "$MODS"
74-
echo ""
75-
76-
# Extract just the module list (last line that isn't stderr logging)
77-
MODULE_LIST=$(echo "$MODS" | grep -v "^Detected base ref:" | grep -v "^Changed files" | grep -v "^Final module list:" | tail -1)
78-
echo "Extracted modules: '$MODULE_LIST'"
94+
echo "=== Detecting affected modules ==="
95+
echo "=== DEBUG: Changed files ==="
96+
git diff --name-only HEAD~1..HEAD
97+
echo "=== DEBUG: Running test discovery with full output ==="
98+
MODULE_LIST=$(python3 .github/scripts/test_discovery.py modules-from-diff --verbose)
99+
echo "=== DEBUG: Raw module list: '$MODULE_LIST' ==="
79100
echo "modules=$MODULE_LIST" >> "$GITHUB_OUTPUT"
101+
102+
if [ -n "$MODULE_LIST" ]; then
103+
echo "Affected modules detected: $MODULE_LIST"
104+
# Only start Ollama if we're testing Ollama-specific modules
105+
if echo "$MODULE_LIST" | grep -q "ollama"; then
106+
echo "Ollama-related modules detected - Ollama service needed"
107+
echo "needs_ollama=true" >> "$GITHUB_OUTPUT"
108+
else
109+
echo "Non-Ollama modules detected - Ollama service not needed"
110+
echo "needs_ollama=false" >> "$GITHUB_OUTPUT"
111+
fi
112+
else
113+
echo "No affected modules detected - only workflow/docs changes"
114+
echo "needs_ollama=false" >> "$GITHUB_OUTPUT"
115+
fi
116+
117+
- name: Start Ollama service for integration tests
118+
if: steps.mods.outputs.needs_ollama == 'true'
119+
run: |
120+
echo "Starting Ollama for integration tests..."
121+
docker run -d --name ollama-test -p 11434:11434 ollama/ollama:latest
122+
echo "Ollama container started"
80123
81124
- name: Test affected modules with integration tests
82125
env:
@@ -99,7 +142,7 @@ jobs:
99142
echo "INFO: Phase 1 - Building dependencies (this may take a few minutes)..."
100143
./mvnw -B -q -T 1C -DskipTests -pl "$MODS" -am install
101144
echo "INFO: Phase 2 - Running tests for affected modules..."
102-
./mvnw -B -q -T 1C -Pintegration-tests -DfailIfNoTests=false -pl "$MODS" -amd verify
145+
./mvnw -B -q -T 1C -Pci-fast-integration-tests -DfailIfNoTests=false -pl "$MODS" -amd verify
103146
echo "INFO: Testing complete"
104147
fi
105148

0 commit comments

Comments
 (0)