diff --git a/Build.ps1 b/Build.ps1 index f58ea2e..7989cd2 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -7,8 +7,6 @@ if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse } -& dotnet restore --no-cache - $branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"] @@ -18,43 +16,20 @@ $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($c echo "build: Package version suffix is $suffix" echo "build: Build version suffix is $buildSuffix" -foreach ($src in gci src/*) { - Push-Location $src - - echo "build: Packaging project in $src" - - & dotnet build -c Release --version-suffix=$buildSuffix - - if($suffix) { - & dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix -p:ContinuousIntegrationBuild=true - } else { - & dotnet pack -c Release --include-source --no-build -o ../../artifacts -p:ContinuousIntegrationBuild=true - } - if($LASTEXITCODE -ne 0) { exit 1 } - - Pop-Location -} - -foreach ($test in gci test/*.Tests) { - Push-Location $test - - echo "build: Testing project in $test" +& dotnet build --configuration Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true - & dotnet test -c Release - if($LASTEXITCODE -ne 0) { exit 3 } +if($LASTEXITCODE -ne 0) { exit 1 } - Pop-Location +if($suffix) { + & dotnet pack src\Serilog.Settings.Configuration --configuration Release --no-build --no-restore -o artifacts --version-suffix=$suffix +} else { + & dotnet pack src\Serilog.Settings.Configuration --configuration Release --no-build --no-restore -o artifacts } -foreach ($test in gci test/*.PerformanceTests) { - Push-Location $test +if($LASTEXITCODE -ne 0) { exit 2 } - echo "build: Building performance test project in $test" +Write-Output "build: Testing" - & dotnet build -c Release - if($LASTEXITCODE -ne 0) { exit 2 } - - Pop-Location -} +& dotnet test test\Serilog.Settings.Configuration.Tests --configuration Release --no-build --no-restore -Pop-Location \ No newline at end of file +if($LASTEXITCODE -ne 0) { exit 3 } \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 272c7d7..b804999 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,9 +5,27 @@ skip_tags: true image: - Visual Studio 2022 - Ubuntu + - macOS build_script: -- pwsh: ./Build.ps1 +- pwsh: | + if ($isWindows) { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1" + ./dotnet-install.ps1 -JSonFile global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet' + ./Build.ps1 + } + if ($isLinux) { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh" + sudo chmod u+x dotnet-install.sh + sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/share/dotnet' + ./Build.ps1 + } + if ($isMacOS) { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh" + sudo chmod u+x dotnet-install.sh + sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/local/share/dotnet' + ./Build.ps1 + } test: off diff --git a/global.json b/global.json index 9acdfa6..1d927af 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.102", + "version": "7.0.201", "allowPrerelease": false, "rollForward": "latestFeature" } diff --git a/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj b/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj index f768c86..5836bfb 100644 --- a/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj +++ b/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj @@ -1,7 +1,8 @@  - net7.0;netcoreapp3.1;net48 + net48 + $(TargetFrameworks);net7.0;netcoreapp3.1