Files
bifrost/.github/workflows/scripts/test-core.sh
Beyhan Oğur 880f412e2c first commit
2026-04-26 21:52:23 +03:00

58 lines
1.5 KiB
Bash
Executable File
Raw 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.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
# Test core component
# Usage: ./test-core.sh
# Setup Go workspace for CI
source "$(dirname "$0")/setup-go-workspace.sh"
echo "🧪 Running core tests..."
# Build MCP test servers for STDIO tests
echo "🔧 Building MCP test servers..."
for mcp_dir in examples/mcps/*/; do
if [ -d "$mcp_dir" ]; then
mcp_name=$(basename "$mcp_dir")
if [ -f "$mcp_dir/go.mod" ]; then
echo " Building $mcp_name (Go)..."
mkdir -p "$mcp_dir/bin"
pushd "$mcp_dir" > /dev/null
GOWORK=off go build -o "bin/$mcp_name" .
popd > /dev/null
elif [ -f "$mcp_dir/package.json" ]; then
echo " Building $mcp_name (TypeScript)..."
pushd "$mcp_dir" > /dev/null
npm install --silent && npm run build
popd > /dev/null
fi
fi
done
echo "✅ MCP test servers built"
# Validate core build
echo "🔨 Validating core build..."
cd core
go mod download
go build ./...
echo "✅ Core build validation successful"
# Run core tests with coverage
echo "🧪 Running core tests with coverage..."
go test -race -timeout 20m -coverprofile=coverage.txt -coverpkg=./... ./...
# Upload coverage to Codecov
if [ -n "${CODECOV_TOKEN:-}" ]; then
echo "📊 Uploading coverage to Codecov..."
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t "$CODECOV_TOKEN" -f coverage.txt -F core
rm -f codecov coverage.txt
else
echo " CODECOV_TOKEN not set, skipping coverage upload"
rm -f coverage.txt
fi
cd ..
echo "✅ Core tests completed successfully"