SWPCore/build.sh

39 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
# Build script for SWP.Core
# This script assumes .NET 9.0 SDK is installed
set -e
echo "Building SWP.Core Solution..."
# Check if dotnet is available
if ! command -v dotnet &> /dev/null; then
echo "Error: .NET SDK is not installed or not in PATH"
echo "Please install .NET 9.0 SDK from https://dotnet.microsoft.com/download"
exit 1
fi
# Check .NET version
DOTNET_VERSION=$(dotnet --version)
echo "Using .NET version: $DOTNET_VERSION"
# Restore packages
echo "Restoring NuGet packages..."
dotnet restore
# Build solution
echo "Building solution in Release mode..."
dotnet build --configuration Release --no-restore
# Run unit tests
echo "Running unit tests..."
dotnet test --configuration Release --no-build --filter "TestCategory!=Integration" --logger "console;verbosity=normal"
# Run integration tests (if database is available)
if [ "$RUN_INTEGRATION_TESTS" = "true" ]; then
echo "Running integration tests..."
dotnet test --configuration Release --no-build --filter "TestCategory=Integration" --logger "console;verbosity=normal"
fi
echo "Build completed successfully!"