mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-18 14:27:47 +08:00
522d150e25
MySql.Data is a travesty at this point - moving to something more stable. Really we weren't testing Dapper with previous test failures, we were testing what mood MySql.Data and NuGet extraction are in and which phase of the moon is about. Also speeds up the builds with 1 restore and 1 build. We can simplify here because everything is relevant (no wasted builds).
72 lines
2.2 KiB
PowerShell
72 lines
2.2 KiB
PowerShell
[CmdletBinding(PositionalBinding=$false)]
|
|
param(
|
|
[bool] $CreatePackages,
|
|
[bool] $RunTests = $true,
|
|
[string] $PullRequestNumber
|
|
)
|
|
|
|
Write-Host "Run Parameters:" -ForegroundColor Cyan
|
|
Write-Host " CreatePackages: $CreatePackages"
|
|
Write-Host " RunTests: $RunTests"
|
|
Write-Host " dotnet --version:" (dotnet --version)
|
|
|
|
$packageOutputFolder = "$PSScriptRoot\.nupkgs"
|
|
$projectsToBuild =
|
|
'Dapper',
|
|
'Dapper.StrongName',
|
|
'Dapper.Contrib',
|
|
'Dapper.EntityFramework',
|
|
'Dapper.EntityFramework.StrongName',
|
|
'Dapper.Rainbow',
|
|
'Dapper.SqlBuilder'
|
|
|
|
$testsToRun =
|
|
'Dapper.Tests',
|
|
'Dapper.Tests.Contrib'
|
|
|
|
if ($PullRequestNumber) {
|
|
Write-Host "Building for a pull request (#$PullRequestNumber), skipping packaging." -ForegroundColor Yellow
|
|
$CreatePackages = $false
|
|
}
|
|
|
|
Write-Host "Restoring all projects..." -ForegroundColor "Magenta"
|
|
dotnet restore
|
|
Write-Host "Done restoring." -ForegroundColor "Green"
|
|
|
|
Write-Host "Building all projects..." -ForegroundColor "Magenta"
|
|
dotnet build -c Release --no-restore /p:CI=true
|
|
Write-Host "Done building." -ForegroundColor "Green"
|
|
|
|
if ($RunTests) {
|
|
foreach ($project in $testsToRun) {
|
|
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta"
|
|
Push-Location ".\$project"
|
|
|
|
dotnet test -c Release
|
|
if ($LastExitCode -ne 0) {
|
|
Write-Host "Error with tests, aborting build." -Foreground "Red"
|
|
Pop-Location
|
|
Exit 1
|
|
}
|
|
|
|
Write-Host "Tests passed!" -ForegroundColor "Green"
|
|
Pop-Location
|
|
}
|
|
}
|
|
|
|
if ($CreatePackages) {
|
|
mkdir -Force $packageOutputFolder | Out-Null
|
|
Write-Host "Clearing existing $packageOutputFolder..." -NoNewline
|
|
Get-ChildItem $packageOutputFolder | Remove-Item
|
|
Write-Host "done." -ForegroundColor "Green"
|
|
|
|
Write-Host "Building all packages" -ForegroundColor "Green"
|
|
|
|
foreach ($project in $projectsToBuild) {
|
|
Write-Host "Packing $project (dotnet pack)..." -ForegroundColor "Magenta"
|
|
dotnet pack ".\$project\$project.csproj" --no-build -c Release /p:PackageOutputPath=$packageOutputFolder /p:NoPackageAnalysis=true /p:CI=true
|
|
Write-Host ""
|
|
}
|
|
}
|
|
Write-Host "Build Complete." -ForegroundColor "Green"
|