Adding the build configuration (#82)
This commit is contained in:
Родитель
4cec809cba
Коммит
dec15da4ca
|
@ -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'))
|
|
@ -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) "Remove-Item -Path $(RepoArtifacts) -Recurse -Force -ErrorAction Ignore"" IgnoreExitCode="true" />
|
||||
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(MSBuildThisFileDirectory) -Recurse -Include 'bin','obj','TestResults' | Remove-Item -Recurse -Force -ErrorAction Ignore"" 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 "$(TestOutputDirectory)"" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,11 @@
|
|||
<Project>
|
||||
|
||||
<!-- Custom -->
|
||||
<PropertyGroup>
|
||||
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
||||
<RepoSrc>$(RepoRoot)src/</RepoSrc>
|
||||
<RepoArtifacts>$(RepoRoot)artifacts/</RepoArtifacts>
|
||||
<RepoTools>$(RepoRoot)tools/</RepoTools>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче