Adding the build configuration (#82)

This commit is contained in:
Isaiah Williams 2019-10-03 14:21:09 -05:00 коммит произвёл GitHub
Родитель 4cec809cba
Коммит dec15da4ca
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 93 добавлений и 0 удалений

33
azure-pipelines.yml Normal file
Просмотреть файл

@ -0,0 +1,33 @@
pool:
vmImage: 'ubuntu-latest'
pr:
- master
trigger:
- master
variables:
buildConfiguration: 'Release'
steps:
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: custom
custom: msbuild
arguments: 'build.proj /t:Build /p:Configuration=$(buildConfiguration)'
- task: CopyFiles@2
displayName: 'Copy build directory to $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: 'build\**'
TargetFolder: '$(build.artifactstagingdirectory)\'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

49
build.proj Normal file
Просмотреть файл

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
# Targets
/t:Build
Builds assemblies.
/t:Clean
Removes temporary build outputs.
/t:Test
Runs tests
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)repo.props" />
<PropertyGroup>
<!-- Folders -->
<TestOutputDirectory>$(RepoArtifacts)TestResults</TestOutputDirectory>
<StaticAnalysisOutputDirectory>$(RepoArtifacts)StaticAnalysisResults</StaticAnalysisOutputDirectory>
<!-- General -->
<Configuration Condition="'$(Configuration)' != 'Release'">Debug</Configuration>
<!-- PowerShell -->
<PowerShellCoreCommandPrefix>pwsh -NonInteractive -NoLogo -NoProfile -Command</PowerShellCoreCommandPrefix>
</PropertyGroup>
<Target Name="Build">
<!-- Build the project -->
<Exec Command="dotnet build Partner-Smart-Office.sln -c $(Configuration)" />
</Target>
<Target Name="Clean">
<Message Importance="high" Text="Cleaning..." />
<!-- Clean out the NuGet cache -->
<Exec Command="dotnet nuget locals global-packages --clear" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
<!-- Remove Package, Publish, bin, obj, and TestResults directories -->
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Remove-Item -Path $(RepoArtifacts) -Recurse -Force -ErrorAction Ignore&quot;" IgnoreExitCode="true" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Get-ChildItem -Path $(MSBuildThisFileDirectory) -Recurse -Include 'bin','obj','TestResults' | Remove-Item -Recurse -Force -ErrorAction Ignore&quot;" IgnoreExitCode="true" />
</Target>
<Target Name="Full" DependsOnTargets="Clean;Build;Test" />
<Target Name="Test">
<Message Importance="high" Text="Running unit tests..." />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<Exec Command="dotnet test Partner-Smart-Office.sln --configuration $(Configuration) --framework netcoreapp2.2 --logger trx --results-directory &quot;$(TestOutputDirectory)&quot;" />
</Target>
</Project>

11
repo.props Normal file
Просмотреть файл

@ -0,0 +1,11 @@
<Project>
<!-- Custom -->
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<RepoSrc>$(RepoRoot)src/</RepoSrc>
<RepoArtifacts>$(RepoRoot)artifacts/</RepoArtifacts>
<RepoTools>$(RepoRoot)tools/</RepoTools>
</PropertyGroup>
</Project>