diff --git a/.vsts.ix-ci.yml b/.vsts.ix-ci.yml index 9263520598..dffc4c44de 100644 --- a/.vsts.ix-ci.yml +++ b/.vsts.ix-ci.yml @@ -11,40 +11,18 @@ trigger: - NuGet.Config queue: Hosted VS2017 - variables: BuildConfiguration: Release - BuildPlatform: Any CPU - + steps: -- task: BatchScript@1 - inputs: - filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat" - arguments: -no_logo - modifyEnvironment: true - displayName: Setup Environment Variables - -- task: DotNetCoreCLI@2 - inputs: - command: build - projects: Ix.NET/Source/build/setversion.csproj - arguments: -c $(BuildConfiguration) - displayName: Set Version - -- task: PowerShell@1 - inputs: - scriptName: 'Ix.NET/Source/build-new.ps1' - workingFolder: 'Ix.NET/Source' - env: - VSTS_ACCESS_TOKEN: $(System.AccessToken) - SignClientUser: $(SignClientUser) - SignClientSecret: $(SignClientSecret) - COVERALLS_REPO_TOKEN: $(CoverallsToken) - displayName: Build - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: 'Ix.NET/Source/artifacts' - ArtifactName: artifacts - publishLocation: Container - condition: always() \ No newline at end of file +- template: .vsts.ix-shared.yml + parameters: + signStep: + - task: PowerShell@2 + displayName: Authenticode Sign Packages + inputs: + filePath: Ix.NET/Source/build/Sign-Package.ps1 + env: + SignClientUser: $(SignClientUser) + SignClientSecret: $(SignClientSecret) + ArtifactDirectory: $(Build.ArtifactStagingDirectory)\artifacts \ No newline at end of file diff --git a/.vsts.ix-pr.yml b/.vsts.ix-pr.yml index f94f52ca2b..ff4a24111e 100644 --- a/.vsts.ix-pr.yml +++ b/.vsts.ix-pr.yml @@ -1,29 +1,8 @@ trigger: none -queue: Hosted VS2017 +queue: Hosted VS2017 variables: BuildConfiguration: Release - BuildPlatform: Any CPU - + steps: -- task: BatchScript@1 - inputs: - filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat" - arguments: -no_logo - modifyEnvironment: true - displayName: Setup Environment Variables - -- task: PowerShell@1 - inputs: - scriptName: 'Ix.NET/Source/build-new.ps1' - workingFolder: 'Ix.NET/Source' - env: - VSTS_ACCESS_TOKEN: $(System.AccessToken) - displayName: Build - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: 'Ix.NET/Source/artifacts' - ArtifactName: artifacts - publishLocation: Container - condition: eq(variables['system.pullrequest.isfork'], false) \ No newline at end of file +- template: .vsts.ix-shared.yml diff --git a/.vsts.ix-shared.yml b/.vsts.ix-shared.yml new file mode 100644 index 0000000000..cb78a18b4e --- /dev/null +++ b/.vsts.ix-shared.yml @@ -0,0 +1,36 @@ +parameters: + signStep: [] + +steps: +- task: DotNetCoreCLI@2 + inputs: + command: build + projects: Ix.NET/Source/build/setversion.csproj + arguments: -c $(BuildConfiguration) + displayName: Set Version + condition: eq(variables['system.pullrequest.isfork'], false) + +- task: DotNetCoreCLI@2 + inputs: + command: pack + packagesToPack: Ix.NET/Source/**/System.Interactive*.csproj;!Ix.NET/Source/**/*.Tests*.csproj + configuration: $(BuildConfiguration) + packDirectory: $(Build.ArtifactStagingDirectory)\artifacts + verbosityPack: Minimal + displayName: Pack + +- task: DotNetCoreCLI@2 + inputs: + command: test + projects: Ix.NET/Source/**/*.Tests.csproj + arguments: -c $(BuildConfiguration) + displayName: Run Tests + +- ${{ parameters.signStep }} + +- task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)\artifacts + ArtifactName: artifacts + publishLocation: Container + condition: eq(variables['system.pullrequest.isfork'], false) \ No newline at end of file diff --git a/Ix.NET/Source/build/Sign-Package.ps1 b/Ix.NET/Source/build/Sign-Package.ps1 new file mode 100644 index 0000000000..97329d8f68 --- /dev/null +++ b/Ix.NET/Source/build/Sign-Package.ps1 @@ -0,0 +1,26 @@ + +$currentDirectory = split-path $MyInvocation.MyCommand.Definition + +# See if we have the ClientSecret available +if([string]::IsNullOrEmpty($Env:SignClientSecret)){ + Write-Host "Client Secret not found, not signing packages" + return; +} + +dotnet tool install --tool-path . SignClient + +# Setup Variables we need to pass into the sign client tool + +$appSettings = "$currentDirectory\appsettings.json" + +$nupkgs = gci $Env:ArtifactDirectory\*.nupkg -recurse | Select -ExpandProperty FullName + +foreach ($nupkg in $nupkgs){ + Write-Host "Submitting $nupkg for signing" + + .\SignClient 'sign' -c $appSettings -i $nupkg -r $Env:SignClientUser -s $Env:SignClientSecret -n 'Ix.NET' -d 'Ix.NET' -u 'https://github.com/dotnet/reactive' + + Write-Host "Finished signing $nupkg" +} + +Write-Host "Sign-package complete" \ No newline at end of file diff --git a/Ix.NET/Source/build/appsettings.json b/Ix.NET/Source/build/appsettings.json new file mode 100644 index 0000000000..3276a45de5 --- /dev/null +++ b/Ix.NET/Source/build/appsettings.json @@ -0,0 +1,13 @@ +{ + "SignClient": { + "AzureAd": { + "AADInstance": "https://login.microsoftonline.com/", + "ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8", + "TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e" + }, + "Service": { + "Url": "https://codesign.dotnetfoundation.org/", + "ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001" + } + } +} \ No newline at end of file