Skip to content

Commit

Permalink
Simplify build script (#618)
Browse files Browse the repository at this point in the history
* simplify build script

* fix template path

* pack all projects
  • Loading branch information
Oren Novotny authored Jun 19, 2018
1 parent 29fa48f commit 55e967e
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 58 deletions.
46 changes: 12 additions & 34 deletions .vsts.ix-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
- 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
27 changes: 3 additions & 24 deletions .vsts.ix-pr.yml
Original file line number Diff line number Diff line change
@@ -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)
- template: .vsts.ix-shared.yml
36 changes: 36 additions & 0 deletions .vsts.ix-shared.yml
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions Ix.NET/Source/build/Sign-Package.ps1
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions Ix.NET/Source/build/appsettings.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}

0 comments on commit 55e967e

Please sign in to comment.