Files
metabuilder/frontends/nextjs/scripts/test-workflows.sh
T
copilot-swe-agent[bot] 6313f0ea24 feat: Add workflow validation and simulation tools
- Fix workflow file path references (ci.yml -> ci/ci.yml)
- Add validate-workflows.py for YAML syntax and structure validation
- Add simulate-workflows.sh for local job simulation without act
- Pin dependency-check action to specific SHA for security
- Update npm scripts with validation and simulation commands
- Add comprehensive workflow simulation documentation

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-27 02:48:16 +00:00

57 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Test GitHub Actions workflows locally using act
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
echo "🧪 Testing GitHub Actions Workflows Locally"
echo "==========================================="
echo
# Run diagnostics first
if [ -f "$SCRIPT_DIR/diagnose-workflows.sh" ]; then
bash "$SCRIPT_DIR/diagnose-workflows.sh"
else
echo "⚠️ diagnose-workflows.sh not found, skipping diagnostics"
fi
echo
echo "🏃 Running workflow tests..."
echo
# Test lint job
echo "1️⃣ Testing lint job..."
if act -W "$PROJECT_ROOT/.github/workflows/ci/ci.yml" -j lint --dryrun; then
echo "✅ Lint job syntax valid"
else
echo "❌ Lint job has issues"
fi
echo
# Test typecheck job
echo "2️⃣ Testing typecheck job..."
if act -W "$PROJECT_ROOT/.github/workflows/ci/ci.yml" -j typecheck --dryrun; then
echo "✅ Typecheck job syntax valid"
else
echo "❌ Typecheck job has issues"
fi
echo
# Test build job
echo "3️⃣ Testing build job..."
if act -W "$PROJECT_ROOT/.github/workflows/ci/ci.yml" -j build --dryrun; then
echo "✅ Build job syntax valid"
else
echo "❌ Build job has issues"
fi
echo
echo "✅ Workflow test complete!"
echo
echo "💡 To actually run workflows (not just validate):"
echo " npm run act:lint # Run lint job"
echo " npm run act:typecheck # Run typecheck job"
echo " npm run act:build # Run build job"