@@ -319,6 +319,15 @@ runs:
319319 run : |
320320 set -euo pipefail
321321 GO_MODULE_DIR="${{ env.GO_MODULE_DIR }}"
322+ BUILD_STRATEGY="${MAGE_X_BUILD_STRATEGY:-smart}"
323+
324+ # Allow skipping pre-build entirely (useful when packages OOM on standard runners)
325+ if [ "$BUILD_STRATEGY" == "skip" ]; then
326+ echo "⏭️ Build pre-compilation skipped (MAGE_X_BUILD_STRATEGY=skip)"
327+ echo "ℹ️ Module cache is still warmed — build cache will populate on first real build"
328+ exit 0
329+ fi
330+
322331 echo "🔧 Build cache miss - pre-building packages..."
323332
324333 echo "============================================================"
@@ -333,21 +342,21 @@ runs:
333342 echo "🔧 Multi-module mode - running build commands from repository root"
334343 echo "📦 magex will discover all Go modules and pre-build packages"
335344 # Use configured parallelism to avoid OOM on GitHub Actions runners
336- magex build:prebuild p="$PARALLEL_JOBS" strategy="${MAGE_X_BUILD_STRATEGY:-smart }" batch_size="${MAGE_X_BUILD_BATCH_SIZE:-20}" batch_delay="${MAGE_X_BUILD_BATCH_DELAY_MS:-0}" exclude="${MAGE_X_BUILD_EXCLUDE_PATTERN:-}"
345+ magex build:prebuild p="$PARALLEL_JOBS" strategy="${BUILD_STRATEGY }" batch_size="${MAGE_X_BUILD_BATCH_SIZE:-20}" batch_delay="${MAGE_X_BUILD_BATCH_DELAY_MS:-0}" exclude="${MAGE_X_BUILD_EXCLUDE_PATTERN:-}"
337346
338347 echo "🏗️ Building stdlib for host platform..."
339348 magex install:stdlib
340349 elif [ -n "$GO_MODULE_DIR" ]; then
341350 echo "🔧 Running build commands from directory: $GO_MODULE_DIR"
342351 # Use configured parallelism to avoid OOM on GitHub Actions runners
343- (cd "$GO_MODULE_DIR" && magex build:prebuild p="$PARALLEL_JOBS" strategy="${MAGE_X_BUILD_STRATEGY:-smart }" batch_size="${MAGE_X_BUILD_BATCH_SIZE:-20}" batch_delay="${MAGE_X_BUILD_BATCH_DELAY_MS:-0}" exclude="${MAGE_X_BUILD_EXCLUDE_PATTERN:-}")
352+ (cd "$GO_MODULE_DIR" && magex build:prebuild p="$PARALLEL_JOBS" strategy="${BUILD_STRATEGY }" batch_size="${MAGE_X_BUILD_BATCH_SIZE:-20}" batch_delay="${MAGE_X_BUILD_BATCH_DELAY_MS:-0}" exclude="${MAGE_X_BUILD_EXCLUDE_PATTERN:-}")
344353
345354 echo "🏗️ Building stdlib for host platform..."
346355 (cd "$GO_MODULE_DIR" && magex install:stdlib)
347356 else
348357 echo "🔧 Running build commands from repository root"
349358 # Use configured parallelism to avoid OOM on GitHub Actions runners
350- magex build:prebuild p="$PARALLEL_JOBS" strategy="${MAGE_X_BUILD_STRATEGY:-smart }" batch_size="${MAGE_X_BUILD_BATCH_SIZE:-20}" batch_delay="${MAGE_X_BUILD_BATCH_DELAY_MS:-0}" exclude="${MAGE_X_BUILD_EXCLUDE_PATTERN:-}"
359+ magex build:prebuild p="$PARALLEL_JOBS" strategy="${BUILD_STRATEGY }" batch_size="${MAGE_X_BUILD_BATCH_SIZE:-20}" batch_delay="${MAGE_X_BUILD_BATCH_DELAY_MS:-0}" exclude="${MAGE_X_BUILD_EXCLUDE_PATTERN:-}"
351360
352361 echo "🏗️ Building stdlib for host platform..."
353362 magex install:stdlib
@@ -360,7 +369,7 @@ runs:
360369 # ────────────────────────────────────────────────────────────────────────────
361370 - name : 💾 Save Go build cache
362371 if : steps.setup-go.outputs.build-cache-hit != 'true'
363- uses : actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
372+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
364373 with :
365374 path : |
366375 ~/.cache/go-build
@@ -372,7 +381,7 @@ runs:
372381 # ────────────────────────────────────────────────────────────────────────────
373382 - name : 💾 Save Go module cache
374383 if : steps.setup-go.outputs.module-cache-hit != 'true'
375- uses : actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
384+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
376385 with :
377386 path : ~/go/pkg/mod
378387 key : ${{ steps.cache-keys.outputs.module-key }}
0 commit comments