Skip to content

Commit 6dc7376

Browse files
committed
Optimize fast workflow for true no-op builds
- Skip compilation entirely when no modules affected (saves 1m 47s) - Add conditional Ollama startup only when tests needed (saves 40s setup) - Reduce debug output verbosity for cleaner logs - Early exit for workflow/docs-only changes - Maintain full functionality for actual code changes Expected performance: - No-op builds: ~45 seconds (vs 3m 25s previously) - Code changes: Still fast with targeted testing Signed-off-by: [email protected]
1 parent 5204e04 commit 6dc7376

File tree

1 file changed

+22
-51
lines changed

1 file changed

+22
-51
lines changed

.github/workflows/main-push-fast.yml

Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ jobs:
2525
concurrency:
2626
group: ${{ github.workflow }}-${{ github.ref }}
2727
cancel-in-progress: true
28-
services:
29-
ollama:
30-
image: ollama/ollama:latest
31-
ports:
32-
- 11434:11434
33-
env:
34-
OLLAMA_WITH_REUSE: true
3528
steps:
3629
- uses: actions/checkout@v4
3730
with:
@@ -42,7 +35,7 @@ jobs:
4235
with:
4336
java-version: '17'
4437
distribution: 'temurin'
45-
cache: 'maven'
38+
# cache: 'maven' # Disabled for fast workflow - reduces post-job noise
4639

4740
- name: Set up Python
4841
uses: actions/setup-python@v5
@@ -70,46 +63,24 @@ jobs:
7063
- name: Compute impacted modules
7164
id: mods
7265
run: |
73-
echo "=== Module Detection Debug Info ==="
74-
echo "Environment variables:"
75-
echo " GITHUB_REF_NAME: $GITHUB_REF_NAME"
76-
echo " GITHUB_REF: $GITHUB_REF"
77-
echo " PWD: $(pwd)"
78-
echo ""
79-
80-
echo "Git state verification:"
81-
echo " HEAD: $(git rev-parse HEAD 2>/dev/null || echo 'FAILED')"
82-
echo " HEAD~1: $(git rev-parse HEAD~1 2>/dev/null || echo 'NOT AVAILABLE')"
83-
echo " Branch: $(git branch --show-current 2>/dev/null || echo 'DETACHED')"
84-
echo ""
85-
86-
echo "Testing different git diff approaches:"
87-
echo "1. HEAD~1..HEAD:"
88-
git diff --name-only HEAD~1..HEAD 2>&1 | head -10 || echo " FAILED: $?"
89-
90-
echo "2. git show HEAD:"
91-
git show --name-only --format= HEAD 2>&1 | head -10 || echo " FAILED: $?"
92-
93-
echo "3. Recent commits:"
94-
git log --oneline -3 2>/dev/null || echo " Git log failed"
95-
echo ""
96-
97-
echo "=== Running test_discovery.py for main branch ==="
98-
set -x # Enable bash debug mode
99-
# Capture stdout (the actual result) and stderr (verbose logging) separately
100-
MODULE_LIST=$(python3 .github/scripts/test_discovery.py modules-from-diff --verbose 2>/tmp/discovery_debug.log)
101-
EXIT_CODE=$?
102-
set +x # Disable bash debug mode
103-
104-
echo ""
105-
echo "=== Test Discovery Results ==="
106-
echo "Exit code: $EXIT_CODE"
107-
echo "Debug output:"
108-
cat /tmp/discovery_debug.log
109-
echo ""
110-
echo "Module list result: '$MODULE_LIST'"
111-
66+
echo "=== Detecting affected modules ==="
67+
MODULE_LIST=$(python3 .github/scripts/test_discovery.py modules-from-diff 2>/dev/null)
11268
echo "modules=$MODULE_LIST" >> "$GITHUB_OUTPUT"
69+
70+
if [ -n "$MODULE_LIST" ]; then
71+
echo "Affected modules detected: $MODULE_LIST"
72+
echo "needs_ollama=true" >> "$GITHUB_OUTPUT"
73+
else
74+
echo "No affected modules detected - only workflow/docs changes"
75+
echo "needs_ollama=false" >> "$GITHUB_OUTPUT"
76+
fi
77+
78+
- name: Start Ollama service for integration tests
79+
if: steps.mods.outputs.needs_ollama == 'true'
80+
run: |
81+
echo "Starting Ollama for integration tests..."
82+
docker run -d --name ollama-test -p 11434:11434 ollama/ollama:latest
83+
echo "Ollama container started"
11384
11485
- name: Test affected modules with integration tests
11586
env:
@@ -122,10 +93,10 @@ jobs:
12293
run: |
12394
MODS="${{ steps.mods.outputs.modules }}"
12495
if [ -z "$MODS" ]; then
125-
echo "INFO: No affected modules detected - running quick verification build"
126-
echo "This could mean no Java/build files were changed, or only docs were modified"
127-
echo "Running a minimal compile check to ensure the build isn't broken"
128-
./mvnw -B -q -T 1C compile -DfailIfNoTests=false
96+
echo "INFO: No affected modules detected - skipping build"
97+
echo "Only workflow, documentation, or non-build files were changed"
98+
echo "Fast workflow optimization: no compilation needed"
99+
exit 0
129100
else
130101
echo "INFO: Running tests for affected modules: $MODS"
131102
./mvnw -B -q -T 1C -Pci-fast-integration-tests -DfailIfNoTests=false -pl "$MODS" -amd verify

0 commit comments

Comments
 (0)