Files
metabuilder/frontends/nextjs/scripts/test-workflows.sh
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
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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"