Skip to content

Commit

Permalink
Replacing MSBuild with dotnet in build.yml (#199)
Browse files Browse the repository at this point in the history
* Replaced MSBuild with dotnet in build.yml
* Bump version to 5.1.1 back
  • Loading branch information
abatishchev authored May 8, 2019
1 parent ce7ce3b commit 471b66d
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 87 deletions.
134 changes: 76 additions & 58 deletions .pipelines/build.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,76 @@
trigger:
- master

pool:
vmImage: 'windows-2019'

variables:
solution: 'JWT.sln'
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
dotNetVersion: '2.2.106'

steps:
- task: DotNetCoreInstaller@0
displayName: Install .NET Core v$(dotNetVersion)
inputs:
version: $(dotNetVersion)

- task: MSBuild@1
displayName: Build solution
inputs:
solution: $(solution)
msbuildArguments: /restore /t:build /p:CreatePackage=true /p:NoPackageAnalysis=true /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\artifacts
configuration: $(BuildConfiguration)
maximumCpuCount: true

- task: DotNetCoreCLI@2
displayName: Run .NET Core tests
inputs:
command: 'test'
projects: 'tests/**/JWT.Tests.Core.csproj'
arguments: ' -c $(buildConfiguration) --no-build --no-restore'
testRunner: VSTest
testResultsFiles: '**/*.trx'
testResultsFormat: 'xUnit'
failTaskOnFailedTests: true

- task: DotNetCoreCLI@2
displayName: Run .NET Framework tests
inputs:
command: 'test'
projects: 'tests/**/JWT.Tests.NetFramework.csproj'
arguments: ' -c $(buildConfiguration) --no-build --no-restore'
testRunner: VSTest
testResultsFiles: '**/*.trx'
testResultsFormat: 'xUnit'
failTaskOnFailedTests: true

- task: DotNetCoreCLI@2
displayName: Package NuGet package
inputs:
command: pack
packagesToPack: 'src/**/*.csproj'
configuration: $(BuildConfiguration)
nobuild: true

- task: PublishBuildArtifacts@1
displayName: Publish build artifacts
trigger:
- master

pool:
vmImage: 'windows-2019'

variables:
solution: 'JWT.sln'
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
coreVersion: '2.2.106'
nugetVersion: '4.9.4'

steps:
- task: DotNetCoreInstaller@0
displayName: Install .NET Core v$(coreVersion)
inputs:
version: $(coreVersion)

- task: DotNetCoreCLI@2
displayName: 'Restore NuGet packages for .NET Core'
inputs:
command: 'restore'
projects: '**/*.csproj'

- task: NuGetToolInstaller@0
displayName: Install NuGet v$(nugetVersion)
inputs:
versionSpec: $(nugetVersion)
checkLatest: true

- task: NuGetCommand@2
displayName: 'Restore NuGet packages for .NET Framework'
inputs:
command: 'restore'
restoreSolution: $(solution)

- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '-c $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: Run .NET Core tests
inputs:
command: 'test'
projects: 'tests/**/JWT.Tests.Core.csproj'
arguments: ' -c $(buildConfiguration) --no-build --no-restore'
testRunner: VSTest
testResultsFiles: '**/*.trx'
testResultsFormat: 'xUnit'
failTaskOnFailedTests: true

- task: DotNetCoreCLI@2
displayName: Run .NET Framework tests
inputs:
command: 'test'
projects: 'tests/**/JWT.Tests.NetFramework.csproj'
arguments: ' -c $(buildConfiguration) --no-build --no-restore'
testRunner: VSTest
testResultsFiles: '**/*.trx'
testResultsFormat: 'xUnit'
failTaskOnFailedTests: true

- task: DotNetCoreCLI@2
displayName: Package NuGet package
inputs:
command: pack
packagesToPack: 'src/**/*.csproj'
configuration: $(BuildConfiguration)
nobuild: true

- task: PublishBuildArtifacts@1
displayName: Publish build artifacts
6 changes: 6 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
6 changes: 3 additions & 3 deletions src/JWT/JWT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
</PropertyGroup>

<PropertyGroup>
<Company>Public Domain</Company>
<Copyright>Public Domain</Copyright>
Expand All @@ -18,7 +18,7 @@
<PackageProjectUrl>https://github.com/jwt-dotnet/jwt</PackageProjectUrl>
<Authors>Alexander Batishchev, John Sheehan, Michael Lehenbauer</Authors>
<PackageLicenseUrl>https://creativecommons.org/publicdomain/zero/1.0/</PackageLicenseUrl>
<Version>5.0.1</Version>
<Version>5.1.1</Version>
<PackageTags>jwt json</PackageTags>
<FileVersion>5.0.0.0</FileVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
Expand All @@ -28,7 +28,7 @@
<DefineConstants>TRACE;DEBUG</DefineConstants>
<OutputPath>bin\Debug\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>bin\Release\$(TargetFramework)\JWT.xml</DocumentationFile>
Expand Down
5 changes: 0 additions & 5 deletions tests/JWT.Tests.Common/JWT.Tests.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@

<ItemGroup>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\JWT\JWT.csproj" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
50 changes: 29 additions & 21 deletions tests/JWT.Tests.NETFramework/JWT.Tests.NETFramework.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.4.1\build\xunit.core.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -37,10 +39,25 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\JWT.Tests.Common\JwtBuilderDecodeTest.cs">
Expand Down Expand Up @@ -68,6 +85,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\JWT\JWT.csproj">
Expand All @@ -80,27 +98,17 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>16.0.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>9.0.1</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="xunit.analyzers">
<Version>0.10.0</Version>
</PackageReference>
<PackageReference Include="xunit.core">
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio">
<Version>2.4.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<Analyzer Include="..\..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\xunit.core.2.4.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.4.1\build\xunit.core.props'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<Import Project="..\..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\..\packages\xunit.core.2.4.1\build\xunit.core.targets')" />
</Project>
12 changes: 12 additions & 0 deletions tests/JWT.Tests.NETFramework/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
<package id="xunit" version="2.4.1" targetFramework="net462" />
<package id="xunit.abstractions" version="2.0.3" targetFramework="net462" />
<package id="xunit.analyzers" version="0.10.0" targetFramework="net462" />
<package id="xunit.assert" version="2.4.1" targetFramework="net462" />
<package id="xunit.core" version="2.4.1" targetFramework="net462" />
<package id="xunit.extensibility.core" version="2.4.1" targetFramework="net462" />
<package id="xunit.extensibility.execution" version="2.4.1" targetFramework="net462" />
<package id="xunit.runner.visualstudio" version="2.4.1" targetFramework="net462" developmentDependency="true" />
</packages>

0 comments on commit 471b66d

Please sign in to comment.