-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5b38d7
commit 794180e
Showing
5 changed files
with
68 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,84 @@ | ||
$logo = (Invoke-WebRequest "https://raw.githubusercontent.com/FantasticFiasco/logo/master/logo.raw").toString(); | ||
Write-Host "$logo" -ForegroundColor Green | ||
|
||
Write-Host "build: build started" | ||
Write-Host "build: dotnet cli v$(dotnet --version)" | ||
|
||
Push-Location $PSScriptRoot\.. | ||
|
||
# Clean artifacts | ||
if (Test-Path .\artifacts) | ||
{ | ||
Write-Host "build: cleaning .\artifacts" | ||
Remove-Item .\artifacts -Force -Recurse | ||
} | ||
Write-Host "[info] dotnet cli v$(dotnet --version)" | ||
|
||
$tagged_build = if ($env:APPVEYOR_REPO_TAG -eq "true") { $true } else { $false } | ||
Write-Host "build: triggered by git tag: $tagged_build" | ||
Write-Host "[info] triggered by git tag: $tagged_build" | ||
|
||
$git_sha = $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) | ||
Write-Host "build: git sha: $git_sha" | ||
Write-Host "[info] git sha: $git_sha" | ||
|
||
$is_pull_request = if ("$env:APPVEYOR_PULL_REQUEST_NUMBER" -eq "") { $false } else { $true } | ||
Write-Host "[info] is pull request: $is_pull_request" | ||
|
||
[xml]$build_props = Get-Content -Path .\Directory.Build.props | ||
$version_prefix = $build_props.Project.PropertyGroup.VersionPrefix | ||
Write-Host "build: build props version prefix: $version_prefix" | ||
Write-Host "[info] build props version prefix: $version_prefix" | ||
$version_suffix = $build_props.Project.PropertyGroup.VersionSuffix | ||
Write-Host "build: build props version suffix: $version_suffix" | ||
Write-Host "[info] build props version suffix: $version_suffix" | ||
|
||
# Build and pack | ||
foreach ($source in Get-ChildItem .\src\*) | ||
# Clean artifacts | ||
if (Test-Path .\artifacts) | ||
{ | ||
Push-Location $source | ||
Write-Host "[build] cleaning .\artifacts" | ||
Remove-Item .\artifacts -Force -Recurse | ||
} | ||
|
||
Write-Host "build: packaging project in $source" | ||
# Build and pack | ||
if ($tagged_build) | ||
{ | ||
Write-Host "[build] build" | ||
& dotnet build -c Release | ||
|
||
if ($tagged_build) | ||
Write-Host "[build] pack" | ||
& dotnet pack -c Release -o ..\..\artifacts --no-build | ||
} | ||
else | ||
{ | ||
# Use git tag if version suffix isn't specified | ||
if ($version_suffix -eq "") | ||
{ | ||
& dotnet build -c Release | ||
& dotnet pack -c Release -o ..\..\artifacts --no-build | ||
$version_suffix = $git_sha | ||
} | ||
else | ||
{ | ||
# Use git tag if version suffix isn't specified | ||
if ($version_suffix -eq "") | ||
{ | ||
$version_suffix = $git_sha | ||
} | ||
|
||
& dotnet build -c Release --version-suffix=$version_suffix | ||
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$version_suffix --no-build | ||
} | ||
Write-Host "[build] build" | ||
& dotnet build -c Release --version-suffix=$version_suffix | ||
|
||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
exit 1 | ||
} | ||
Write-Host "[build] pack" | ||
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$version_suffix --no-build | ||
} | ||
|
||
Pop-Location | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
exit 1 | ||
} | ||
|
||
# Test | ||
foreach ($test in Get-ChildItem test/*Tests) | ||
Write-Host "[test] test" | ||
& dotnet test -c Release --no-build --collect:"XPlat Code Coverage" | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
Push-Location $test | ||
exit 1 | ||
} | ||
|
||
Write-Host "build: testing project in $test" | ||
If ($is_pull_request -eq $false) | ||
{ | ||
foreach ($testResult in Get-ChildItem .\test\Serilog.Sinks.HttpTests\TestResults\*) | ||
{ | ||
Push-Location $testResult | ||
|
||
& dotnet test -c Release | ||
if ($LASTEXITCODE -ne 0) { exit 2 } | ||
Write-Host "[test] upload coverage report from $testResult" | ||
Invoke-WebRequest -Uri "https://codecov.io/bash" -OutFile codecov.sh | ||
bash codecov.sh -f "coverage.cobertura.xml" | ||
|
||
Pop-Location | ||
} | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
exit 1 | ||
} | ||
|
||
Pop-Location | ||
Pop-Location | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters