Skip to content

Commit

Permalink
Build process updates
Browse files Browse the repository at this point in the history
This follows the same process as MongoFramework
  • Loading branch information
Turnerj committed Aug 4, 2019
1 parent 1cf1eeb commit d558587
Show file tree
Hide file tree
Showing 8 changed files with 712 additions and 37 deletions.
41 changes: 20 additions & 21 deletions .appveyor.yml
@@ -1,29 +1,28 @@
version: '0.2.0+{build}' version: '{build}'
image: Visual Studio 2017 image: Visual Studio 2017
skip_branch_with_pr: true skip_branch_with_pr: true
branches:
only:
- master
skip_commits:
files:
- '**/*.md'


build:
verbosity: minimal
install: install:
- choco install opencover codecov - choco install opencover codecov
- ps: .\build\dotnet-install.ps1 -Version 3.0.100-preview5-011568



build_script: build_script:
- dotnet build -c Release - ps: .\build.appveyor.ps1 -IsTagBuild ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG))
- dotnet pack --no-build -c Release /p:PackageOutputPath=..\..\.nupkgs
test_script:
- OpenCover.Console.exe -register:user -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:"test tests/InfinityCrawler.Tests/InfinityCrawler.Tests.csproj /p:DebugType=Full" -filter:"+[InfinityCrawler]* -[InfinityCrawler.Tests]*" -output:".\coverage.xml" -oldstyle
- codecov -f coverage.xml


artifacts:
- path: '.nupkgs\*.nupkg'


- path: coverage.xml deploy:
name: Coverage Report - provider: NuGet
artifact: /.*nupkg/
api_key:
secure: eCdbkZMnfQfn//yoFtvyHHVUkoIX1yUfs6qRtOGsRxQq95pDPNMUMD0+XN9itbKp
on:
APPVEYOR_REPO_TAG: true
- provider: GitHub
artifact: /.*nupkg/
draft: true
release: $(APPVEYOR_REPO_TAG_NAME)
description: 'TODO'
auth_token:
secure: 8WGv8noklaCJAQEBpcs+VShk/Hql5zbyx0VPhMvzUw0RcG7rAd2KxKIh4gazXlBi
on:
APPVEYOR_REPO_TAG: true
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -328,3 +328,5 @@ ASALocalRun/


# MFractors (Xamarin productivity tool) working folder # MFractors (Xamarin productivity tool) working folder
.mfractor/ .mfractor/

/build-artifacts
11 changes: 7 additions & 4 deletions InfinityCrawler.sln
@@ -1,14 +1,17 @@


Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio Version 16
VisualStudioVersion = 15.0.28307.168 VisualStudioVersion = 16.0.29001.49
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{F0B4D082-200A-4DD3-9291-872B7F2A991E}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{F0B4D082-200A-4DD3-9291-872B7F2A991E}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.appveyor.yml = .appveyor.yml .appveyor.yml = .appveyor.yml
.codecov.yml = .codecov.yml .codecov.yml = .codecov.yml
.editorconfig = .editorconfig .editorconfig = .editorconfig
LICENSE = LICENSE .gitignore = .gitignore
build.appveyor.ps1 = build.appveyor.ps1
build.ps1 = build.ps1
License.txt = License.txt
README.md = README.md README.md = README.md
EndProjectSection EndProjectSection
EndProject EndProject
Expand All @@ -25,7 +28,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler.Tests", "te
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler.Tests.TestSite", "tests\InfinityCrawler.Tests.TestSite\InfinityCrawler.Tests.TestSite.csproj", "{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler.Tests.TestSite", "tests\InfinityCrawler.Tests.TestSite\InfinityCrawler.Tests.TestSite.csproj", "{483B6FC9-98E7-4BD4-BA09-80DF504E31B2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfinityCrawler.Tests.Benchmarks", "tests\InfinityCrawler.Tests.Benchmarks\InfinityCrawler.Tests.Benchmarks.csproj", "{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityCrawler.Tests.Benchmarks", "tests\InfinityCrawler.Tests.Benchmarks\InfinityCrawler.Tests.Benchmarks.csproj", "{F17C5CAC-DF32-434B-A4C5-21CBDDA86B97}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions build.appveyor.ps1
@@ -0,0 +1,14 @@
[CmdletBinding(PositionalBinding=$false)]
param(
[bool] $IsTagBuild
)


Write-Host "Initialising AppVeyor build..." -ForegroundColor "Magenta"

if ($IsTagBuild) {
.\build.ps1 -CreatePackages $True
}
else {
.\build.ps1 -CheckCoverage $True
}
64 changes: 64 additions & 0 deletions build.ps1
@@ -0,0 +1,64 @@
[CmdletBinding(PositionalBinding=$false)]
param(
[bool] $RunTests = $true,
[bool] $CheckCoverage,
[bool] $CreatePackages
)

$packageOutputFolder = "$PSScriptRoot\build-artifacts"
mkdir -Force $packageOutputFolder | Out-Null

Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host " RunTests: $RunTests"
Write-Host " CheckCoverage: $CheckCoverage"
Write-Host " CreatePackages: $CreatePackages"
Write-Host "Environment:" -ForegroundColor Cyan
Write-Host " .NET Version:" (dotnet --version)
Write-Host " Artifact Path: $packageOutputFolder"

Write-Host "Building solution..." -ForegroundColor "Magenta"
dotnet build -c Release
if ($LastExitCode -ne 0) {
Write-Host "Build failed, aborting!" -Foreground "Red"
Exit 1
}
Write-Host "Solution built!" -ForegroundColor "Green"

if ($RunTests -And -Not $CheckCoverage) {
Write-Host "Running tests without coverage..." -ForegroundColor "Magenta"
dotnet test tests/InfinityCrawler.Tests/InfinityCrawler.Tests.csproj
if ($LastExitCode -ne 0) {
Write-Host "Tests failed, aborting build!" -Foreground "Red"
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor "Green"
}
elseif ($RunTests -And $CheckCoverage) {
Write-Host "Running tests with coverage..." -ForegroundColor "Magenta"
OpenCover.Console.exe -register:user -target:"%LocalAppData%\Microsoft\dotnet\dotnet.exe" -targetargs:"test tests/InfinityCrawler.Tests/InfinityCrawler.Tests.csproj /p:DebugType=Full" -filter:"+[InfinityCrawler]* -[InfinityCrawler.Tests]*" -output:"$packageOutputFolder\coverage.xml" -oldstyle
if ($LastExitCode -ne 0 -Or -Not $?) {
Write-Host "Failure performing tests with coverage, aborting!" -Foreground "Red"
Exit 1
}
else {
Write-Host "Tests passed!" -ForegroundColor "Green"
Write-Host "Saving code coverage..." -ForegroundColor "Magenta"
codecov -f "$packageOutputFolder\coverage.xml"
if ($LastExitCode -ne 0 -Or -Not $?) {
Write-Host "Failure saving code coverage!" -Foreground "Red"
}
else {
Write-Host "Coverage saved!" -ForegroundColor "Green"
}
}
}

if ($CreatePackages) {
Write-Host "Clearing existing $packageOutputFolder... " -NoNewline
Get-ChildItem $packageOutputFolder | Remove-Item
Write-Host "Packages cleared!" -ForegroundColor "Green"

Write-Host "Packing..." -ForegroundColor "Magenta"
dotnet pack --no-build -c Release /p:PackageOutputPath=$packageOutputFolder
Write-Host "Packing complete!" -ForegroundColor "Green"
}

0 comments on commit d558587

Please sign in to comment.