mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-17 05:12:13 +08:00
663588f90b
Simplifying and improve build speed. - Decreases builds from 8-13 minutes down to ~2 minutes (while running more tests) - Moves to SQL Server 2019 on AppVeyor - Moves the 2 longest running tests with params to `[FactLongRunning]` - Bumps tests up to `netcoreapp3.1` - Also fixes .Contrib tests - Moves to `Build.csproj` - Simplifies `build.ps1` - Removed defunct `build.sh` - Nukes `IsAppveyor` (moves to environmental variable overloads) - Builds now work in Linux/macOS
44 lines
1.6 KiB
PowerShell
44 lines
1.6 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"
|
|
|
|
if ($PullRequestNumber) {
|
|
Write-Host "Building for a pull request (#$PullRequestNumber), skipping packaging." -ForegroundColor Yellow
|
|
$CreatePackages = $false
|
|
}
|
|
|
|
Write-Host "Building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
|
|
dotnet build ".\Build.csproj" -c Release /p:CI=true
|
|
Write-Host "Done building." -ForegroundColor "Green"
|
|
|
|
if ($RunTests) {
|
|
Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
|
|
dotnet test ".\Build.csproj" -c Release --no-build
|
|
if ($LastExitCode -ne 0) {
|
|
Write-Host "Error with tests, aborting build." -Foreground "Red"
|
|
Exit 1
|
|
}
|
|
Write-Host "Tests passed!" -ForegroundColor "Green"
|
|
}
|
|
|
|
if ($CreatePackages) {
|
|
New-Item -ItemType Directory -Path $packageOutputFolder -Force | 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"
|
|
dotnet pack ".\Build.csproj" --no-build -c Release /p:PackageOutputPath=$packageOutputFolder /p:CI=true
|
|
}
|
|
Write-Host "Build Complete." -ForegroundColor "Green"
|