Skip to content

Commit

Permalink
Migrate to dotnet foundation pipeline. (#2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
marabooy authored Aug 16, 2021
1 parent 80aeefd commit 2dafa01
Show file tree
Hide file tree
Showing 11 changed files with 287 additions and 14 deletions.
1 change: 1 addition & 0 deletions configs/filelist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.dll
Binary file added images/odata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions pipelines/azure_pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
trigger:
branches:
include:
- master

resources:
repositories:
- repository: self
type: git
ref: master

pr:
- master
variables:
BuildPlatform: 'Any Cpu'
BuildConfiguration: 'Release'
stages:
- stage: Build
jobs:
- job: Main
displayName: Main Build
# setting a 3hour timeout as webapi tests normally take about 2hr 30 mins
timeoutInMinutes: 180

pool:
vmImage: windows-latest

steps:
- template: ./common.yml
107 changes: 107 additions & 0 deletions pipelines/azure_pipelines_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
schedules:
- cron: "0 0 * * *"
displayName: Daily Nightly build
branches:
include:
- master
resources:
repositories:
- repository: self
type: git
ref: master
variables:
BuildPlatform: 'Any Cpu'
BuildConfiguration: 'Release'
RootDir: '$(Build.SourcesDirectory)'
ProductBinPath: '$(RootDir)\bin\$(BuildConfiguration)'
RELEASE_SEMANTICS: '$(ReleaseSemantics)'
SourcesRoot: '$(RootDir)'
stages:
- stage: Build
variables:
- group: SigningConfig
jobs:
- job: Main
displayName: Main Build
# setting a 3hour timeout as webapi tests normally take about 2hr 30 mins
timeoutInMinutes: 180
pool:
vmImage: windows-latest
steps:
- template: ./common.yml
- task: MSBuild@1
displayName: 'Get Nuget Package Metadata'
inputs:
solution: tools/GetNugetPackageMetadata.proj
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- pwsh: |
$date = Get-Date
$NightlyBuildVersion = $date.ToString('yyyyMMddHHmm')
echo "##vso[task.setvariable variable=NightlyBuildVersion]$NightlyBuildVersion"
displayName: Generate Nightly Build version
- task: DotNetCoreCLI@2
displayName: Packing ASP.NET Core OData
inputs:
command: custom
custom: pack
arguments: >
$(RootDir)\src\Microsoft.AspNetCore.OData\Microsoft.AspNetCore.OData.csproj
/p:NuspecFile=$(rootDir)\src\Microsoft.AspNetCore.OData\Microsoft.AspNetCore.OData.$(RELEASE_SEMANTICS).nuspec
--configuration=$(buildConfiguration)
--output=$(Build.ArtifactStagingDirectory)\Packages
-p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- task: NuGetCommand@2
displayName: 'Packing AspNet.OData'
inputs:
command: custom
arguments: pack $(RootDir)\src\Microsoft.AspNet.OData\Microsoft.AspNet.OData.$(RELEASE_SEMANTICS).nuspec -NonInteractive -OutputDirectory $(Build.ArtifactStagingDirectory)\Packages -Properties Configuration=$(BuildConfiguration);ProductRoot=$(ProductBinPath);SourcesRoot=$(Build.SourcesDirectory);VersionNuGetSemantic=$(VersionNuGetSemantic);NightlyBuildVersion=$(NightlyBuildVersion);AspNetPackageDependency="$(AspNetPackageDependency)";DependencyInjection1PackageDependency="$(DependencyInjection1PackageDependency)";ODataLibPackageDependency="$(ODataLibPackageDependency)" -Verbosity Detailed -Symbols -SymbolPackageFormat snupkg
- publish: $(Build.ArtifactStagingDirectory)\Packages
displayName: Publish Build Artifacts
artifact: BuildPackages
- pwsh: |
$config = "{""SignClient"":{""AzureAd"":{""AADInstance"":""$(AADInstance)"",""ClientId"":""$(ClientId)"",""TenantId"":""$(TenantId)""},""Service"":{""Url"":""https://codesign.dotnetfoundation.org/"",""ResourceId"":""$(ResourceId)""}}}"
$config > .\configs\SignClient.json
displayName: Generate Sign config
- publish: configs
displayName: Publish Signing Scripts
artifact: configs

- stage: CodeSign
condition: and(succeeded('Build'), not(eq(variables['build.reason'], 'PullRequest')))
jobs:
- deployment: CodeSign
displayName: Code Signing
pool:
vmImage: windows-latest
environment: Code Sign - Approvals
variables:
- group: Code Signing
strategy:
runOnce:
deploy:
steps:
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . SignClient
displayName: Install SignTool tool

- pwsh: |
.\SignClient "Sign" `
--baseDirectory "$(Pipeline.Workspace)\BuildPackages" `
--input "**/*.nupkg" `
--config "$(Pipeline.Workspace)\configs\SignClient.json" `
--filelist "$(Pipeline.Workspace)\configs\filelist.txt" `
--user "$(SignClientUser)" `
--secret "$(SignClientSecret)" `
--name "Code Sign packages" `
--description "Signing packages" `
--descriptionUrl "https://github.com/OData/WebApi"
displayName: Sign packages
- publish: $(Pipeline.Workspace)/BuildPackages
displayName: Publish Signed Packages
artifact: SignedPackages
121 changes: 121 additions & 0 deletions pipelines/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
steps:
- checkout: self

- task: NuGetToolInstaller@1
displayName: Use NuGet >=5.2.0
inputs:
versionSpec: '>=5.2.0'
checkLatest: true

- task: UseDotNet@2
displayName: Use .NET Core sdk 3.1
inputs:
version: 3.x

- task: UseDotNet@2
displayName: Use .NET Core sdk 2.0.x
inputs:
version: 2.0.x

- task: UseDotNet@2
displayName: Use .NET Core sdk 5.x
inputs:
version: 5.x
includePreviewVersions: true

- task: NuGetCommand@2
displayName: 'NuGet restore **\*.sln'
inputs:
restoreSolution: 'sln/WebApiOData.AspNet.sln;sln/WebApiOData.AspNetCore.sln;sln/WebApiOData.E2E.AspNet.sln;sln/WebApiOData.E2E.AspNetCore.sln'

- task: VSBuild@1
displayName: 'Build solution sln\WebApiOData.AspNet.sln'
inputs:
solution: 'sln\WebApiOData.AspNet.sln '
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'

- task: VSBuild@1
displayName: 'Build solution sln\WebApiOData.E2E.AspNet.sln'
inputs:
solution: 'sln\WebApiOData.E2E.AspNet.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'Build Microsoft.AspNetCore.OData.csproj '
inputs:
projects: '$(Build.SourcesDirectory)\src\Microsoft.AspNetCore.OData\Microsoft.AspNetCore.OData.csproj'
arguments: '--configuration $(BuildConfiguration) --no-incremental'

- task: DotNetCoreCLI@2
displayName: 'Build .NET Core Unit test project'
inputs:
projects: '$(Build.SourcesDirectory)\test\UnitTest\Microsoft.AspNetCore.OData.Test\Microsoft.AspNetCore.OData.Test.csproj'
arguments: '--configuration $(BuildConfiguration) --no-incremental'

- task: DotNetCoreCLI@2
displayName: 'Build .NET Core E2E test project'
inputs:
projects: '$(Build.SourcesDirectory)\test\E2ETest\Microsoft.Test.E2E.AspNet.OData\Build.AspNetCore\Microsoft.Test.E2E.AspNetCore.OData.csproj'
arguments: '--configuration $(BuildConfiguration) --no-incremental'

- task: DotNetCoreCLI@2
displayName: 'Build .NET Core 3x E2E test project'
inputs:
projects: '$(Build.SourcesDirectory)\test\E2ETest\Microsoft.Test.E2E.AspNet.OData\Build.AspNetCore3x\Microsoft.Test.E2E.AspNetCore3x.OData.csproj'
arguments: '--configuration $(BuildConfiguration) --no-incremental'

- powershell: |
$PROGRAMFILESX86 = [Environment]::GetFolderPath("ProgramFilesX86")
$SN = $PROGRAMFILESX86 + "\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe"
$SNx64 = $PROGRAMFILESX86 + "\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\sn.exe"
& $SN /Vr $(Build.SourcesDirectory)\bin\Release\Microsoft.AspNet.OData.dll
& $SNx64 /Vr $(Build.SourcesDirectory)\bin\Release\Microsoft.AspNet.OData.dll
& $SN /Vr $(Build.SourcesDirectory)\bin\release\netstandard2.0\Microsoft.AspNetCore.OData.dll
& $SNx64 /Vr $(Build.SourcesDirectory)\bin\release\netstandard2.0\Microsoft.AspNetCore.OData.dll
& $SN /Vr $(Build.SourcesDirectory)\bin\Release\UnitTest\AspNet\Microsoft.AspNet.OData.Test.dll
& $SNx64 /Vr $(Build.SourcesDirectory)\bin\Release\UnitTest\AspNet\Microsoft.AspNet.OData.Test.dll
& $SN /Vr $(Build.SourcesDirectory)\bin\Release\E2ETest\AspNet\Microsoft.Test.E2E.AspNet.OData.dll
& $SNx64 /Vr $(Build.SourcesDirectory)\bin\Release\E2ETest\AspNet\Microsoft.Test.E2E.AspNet.OData.dll
& $SN /Vr $(Build.SourcesDirectory)\bin\release\E2ETest\AspNetCore\Microsoft.Test.E2E.AspNetCore.OData.dll
& $SNx64 /Vr $(Build.SourcesDirectory)\bin\release\E2ETest\AspNetCore\Microsoft.Test.E2E.AspNetCore.OData.dll
displayName: 'Skip StrongName for Classic'

- task: DotNetCoreCLI@2
displayName: 'Core E2E Tests (Microsoft.Test.E2E.AspNetCore.OData.csproj)'
inputs:
command: test
projects: '$(Build.SourcesDirectory)\test\E2ETest\Microsoft.Test.E2E.AspNet.OData\Build.AspNetCore\Microsoft.Test.E2E.AspNetCore.OData.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build'

- task: DotNetCoreCLI@2
displayName: 'Core E2E 3x Tests (Microsoft.Test.E2E.AspNetCore3x.OData.csproj)'
inputs:
command: test
projects: '$(Build.SourcesDirectory)\test\E2ETest\Microsoft.Test.E2E.AspNet.OData\Build.AspNetCore3x\Microsoft.Test.E2E.AspNetCore3x.OData.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build --filter FullyQualifiedName!=Microsoft.Test.E2E.AspNet.OData.QueryComposition.SelectExpandEFTests.QueryForLongSelectList -v diag'

- task: VSTest@2
displayName: 'Classic Unit Tests (Microsoft.AspNet.OData.Test.dll)'
inputs:
testAssemblyVer2: '**\bin\**\UnitTest\**\Microsoft.AspNet.OData.Test.dll'

- task: DotNetCoreCLI@2
displayName: 'Core Unit Tests (Microsoft.AspNetCore.OData.Test.csproj) '
inputs:
command: test
projects: '$(Build.SourcesDirectory)\test\UnitTest\Microsoft.AspNetCore.OData.Test\Microsoft.AspNetCore.OData.Test.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build'

- task: VSTest@2
displayName: 'Classic E2E Tests (Microsoft.Test.E2E.AspNet.OData.dll)'
inputs:
testAssemblyVer2: '**\bin\**\E2ETest\**\Microsoft.Test.E2E.AspNet.OData.dll'
testFiltercriteria: '(DisplayName!=Microsoft.Test.E2E.AspNet.OData.ODataPathHandler.UnicodeRouteTests_Todoü.CRUDEntitySetShouldWork)'
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
<metadata>
<id>Microsoft.AspNet.OData</id>
<title>Microsoft ASP.NET Web API 2.2 for OData v4.0</title>
<version>$VersionFullSemantic$-Nightly$NightlyBuildVersion$</version>
<version>$VersionNuGetSemantic$-Nightly$NightlyBuildVersion$</version>
<authors>Microsoft</authors>
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
<description>This package contains everything you need to create OData v4.0 endpoints using ASP.NET Web API and to support OData query syntax for your web APIs.</description>
<summary>This package contains everything you need to create OData v4.0 endpoints using ASP.NET Web API.</summary>
<language>en-US</language>
<projectUrl>http://odata.github.io</projectUrl>
<licenseUrl>https://raw.githubusercontent.com/OData/WebApi/master/License.txt</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft AspNet WebApi AspNetWebApi OData</tags>
<iconUrl>http://static.tumblr.com/hgchgxz/9ualgdf98/icon.png</iconUrl>
<icon>images\odata.png</icon>
<repository type="git" url="https://github.com/OData/WebApi.git" branch="master"/>
<dependencies>
<dependency id="Microsoft.AspNet.WebApi.Client" version="$AspNetPackageDependency$" />
<dependency id="Microsoft.AspNet.WebApi.Core" version="$AspNetPackageDependency$" />
Expand All @@ -31,5 +32,6 @@
<file src="$ProductRoot$\Microsoft.AspNet.OData.xml" target="lib\net45" />
<file src="$SourcesRoot$\src\Microsoft.AspNet.OData\**\*.cs" target="src\Microsoft.AspNet.OData" />
<file src="$SourcesRoot$\src\Microsoft.AspNet.OData.Shared\**\*.cs" target="src\Microsoft.AspNet.OData.Shared" />
<file src="$SourcesRoot$\images\odata.png" target="images\" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
<releaseNotes>https://docs.microsoft.com/en-us/odata/changelog/webapi-7x</releaseNotes>
<language>en-US</language>
<projectUrl>http://odata.github.io</projectUrl>
<licenseUrl>https://raw.githubusercontent.com/OData/WebApi/master/License.txt</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft AspNet WebApi AspNetWebApi OData</tags>
<iconUrl>http://static.tumblr.com/hgchgxz/9ualgdf98/icon.png</iconUrl>
<icon>images\odata.png</icon>
<repository type="git" url="https://github.com/OData/WebApi.git" branch="master"/>
<dependencies>
<dependency id="Microsoft.AspNet.WebApi.Client" version="$AspNetPackageDependency$" />
<dependency id="Microsoft.AspNet.WebApi.Core" version="$AspNetPackageDependency$" />
Expand All @@ -32,5 +33,6 @@
<file src="$ProductRoot$\Microsoft.AspNet.OData.xml" target="lib\net45" />
<file src="$SourcesRoot$\src\Microsoft.AspNet.OData\**\*.cs" target="src\Microsoft.AspNet.OData" />
<file src="$SourcesRoot$\src\Microsoft.AspNet.OData.Shared\**\*.cs" target="src\Microsoft.AspNet.OData.Shared" />
<file src="$SourcesRoot$\images\odata.png" target="images\" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
<metadata>
<id>Microsoft.AspNetCore.OData</id>
<title>Microsoft ASP.NET Core 2.0 and 3.x for OData v4.0</title>
<version>$VersionFullSemantic$-Nightly$NightlyBuildVersion$</version>
<version>$VersionNuGetSemantic$-Nightly$NightlyBuildVersion$</version>
<authors>Microsoft</authors>
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
<description>This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC and to support OData query syntax for your web APIs.</description>
<summary>This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC.</summary>
<language>en-US</language>
<projectUrl>http://odata.github.io</projectUrl>
<licenseUrl>https://raw.githubusercontent.com/OData/WebApi/master/License.txt</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft AspNetCore WebApi OData</tags>
<iconUrl>http://static.tumblr.com/hgchgxz/9ualgdf98/icon.png</iconUrl>
<icon>images\odata.png</icon>
<repository type="git" url="https://github.com/OData/WebApi.git" branch="master"/>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.AspNetCore.Mvc.Core" version="$AspNetCorePackageDependency$" />
Expand All @@ -35,5 +36,6 @@
<file src="$ProductRoot$\netcoreapp3.1\Microsoft.AspNetCore.OData.xml" target="lib\netcoreapp3.1" />
<file src="$SourcesRoot$\src\Microsoft.AspNetCore.OData\**\*.cs" target="src\Microsoft.AspNetCore.OData" />
<file src="$SourcesRoot$\src\Microsoft.AspNet.OData.Shared\**\*.cs" target="src\Microsoft.AspNet.OData.Shared" />
<file src="$SourcesRoot$\images\odata.png" target="images\" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
<releaseNotes>https://docs.microsoft.com/en-us/odata/changelog/webapi-7x</releaseNotes>
<language>en-US</language>
<projectUrl>http://odata.github.io</projectUrl>
<licenseUrl>https://raw.githubusercontent.com/OData/WebApi/master/License.txt</licenseUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft AspNetCore WebApi OData</tags>
<iconUrl>http://static.tumblr.com/hgchgxz/9ualgdf98/icon.png</iconUrl>
<icon>images\odata.png</icon>
<repository type="git" url="https://github.com/OData/WebApi.git" branch="master"/>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.AspNetCore.Mvc.Core" version="$AspNetCorePackageDependency$" />
Expand All @@ -36,5 +37,6 @@
<file src="$ProductRoot$\netcoreapp3.1\Microsoft.AspNetCore.OData.xml" target="lib\netcoreapp3.1" />
<file src="$SourcesRoot$\src\Microsoft.AspNetCore.OData\**\*.cs" target="src\Microsoft.AspNetCore.OData" />
<file src="$SourcesRoot$\src\Microsoft.AspNet.OData.Shared\**\*.cs" target="src\Microsoft.AspNet.OData.Shared" />
<file src="$SourcesRoot$\images\odata.png" target="images\" />
</files>
</package>
11 changes: 11 additions & 0 deletions src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,15 @@
<DependentUpon>SRResources.resx</DependentUpon>
</Compile>
</ItemGroup>
<Target Name="SetNuspecProperties" BeforeTargets="GenerateNuspec">
<PropertyGroup>
<NuspecProperties>ProductRoot=$(ProductBinPath);VersionNuGetSemantic=$(VersionNuGetSemantic)</NuspecProperties>
<NuspecProperties>$(NuspecProperties);NightlyBuildVersion=$(NightlyBuildVersion)</NuspecProperties>
<NuspecProperties>$(NuspecProperties);SourcesRoot=$(RootDir)</NuspecProperties>
<NuspecProperties>$(NuspecProperties);AspNetCorePackageDependency=$(AspNetCorePackageDependency)</NuspecProperties>
<NuspecProperties>$(NuspecProperties);DependencyInjection2PackageDependency=$(DependencyInjection2PackageDependency)</NuspecProperties>
<NuspecProperties>$(NuspecProperties);ODataLibPackageDependency=$(ODataLibPackageDependency)</NuspecProperties>
<NuspecProperties>$(NuspecProperties);NewtonsoftJsonPackageDependency=$(NewtonsoftJsonPackageDependency)</NuspecProperties>
</PropertyGroup>
</Target>
</Project>
4 changes: 0 additions & 4 deletions tools/GetNugetPackageMetadata.proj
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="WebStack.versions.settings.targets" />
<PropertyGroup>
<VersionNugetNightlyBuild>$([System.DateTime]::Now.ToString("yyyyMMddHHmm"))</VersionNugetNightlyBuild>
</PropertyGroup>
<Target Name="Build">
<Message Importance="high" Text="##vso[task.setvariable variable=VersionFullSemantic]$(VersionFullSemantic)" />
<Message Importance="high" Text="##vso[task.setvariable variable=VersionFull]$(VersionFull)" />
<Message Importance="high" Text="##vso[task.setvariable variable=VersionNuGetSemantic]$(VersionNuGetSemantic)" />
<Message Importance="high" Text="##vso[task.setvariable variable=VersionNugetNightlyBuild]$(VersionNugetNightlyBuild)" />
<Message Importance="high" Text="##vso[task.setvariable variable=AspNetPackageDependency]$(AspNetPackageDependency)" />
<Message Importance="high" Text="##vso[task.setvariable variable=AspNetCorePackageDependency]$(AspNetCorePackageDependency)" />
<Message Importance="high" Text="##vso[task.setvariable variable=DependencyInjection1PackageDependency]$(DependencyInjection1PackageDependency)" />
Expand Down

0 comments on commit 2dafa01

Please sign in to comment.