Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboard 1ES PT #71

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 90 additions & 58 deletions .azuredevops/pipelines/official.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,101 @@
resources:
repositories:
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release
variables:
- template: templates\variables.yml
- template: /.azuredevops/pipelines/templates/variables.yml@self
- name: SignType
value: Test
value: Real
- name: TeamName
value: MSBuild

trigger:
batch: true
branches:
include:
- 'main'
- 'refs/tags/*'

# no PR triggers
pr: none

jobs:
- job: OfficialBuild
displayName: Official Build
variables:
VsInstallDir: $(Build.ArtifactStagingDirectory)/vs
pool:
name: VSEngSS-MicroBuild2022-1ES
steps:
- task: PowerShell@2
displayName: 'Update SignType, Build Number, and Add Build Tag for tagged commits'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
inputs:
targetType: 'inline'
script: |
Write-Host "Updating SignType to 'Real'"
Write-Host "##vso[task.setvariable variable=SignType;]Real"
Write-Host ""
$buildTag = [System.Text.RegularExpressions.Regex]::Match("$(Build.SourceBranchName)", "v.*")
if($buildTag.Success -eq $true)
{
Write-Host "Updating VSTS build number to ""$buildTag"""
Write-Host "##vso[build.updatebuildnumber]$buildTag"
Write-Host ""
Write-Host "Adding build tag ""$buildTag"""
Write-Host "##vso[build.addbuildtag]$buildTag"
}

- task: MicroBuildSigningPlugin@1
displayName: 'Install MicroBuild Signing Plugin'
inputs:
signType: '$(SignType)'
zipSources: false

- checkout: self
# Fetch all history for versioning
fetchDepth: 0

- template: templates\build-and-test.yml

- task: NuGetCommand@2
displayName: 'Push NuGet Packages to nuget.org'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
inputs:
command: 'push'
packagesToPush: '$(ArtifactsDirectory)/**/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'MSBuildCache-Push'

- publish: $(LogDirectory)
displayName: Publish Logs
artifact: 'logs'
condition: always()
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
sdl:
sbom:
enabled: false
pool:
name: VSEngSS-MicroBuild2022-1ES
demands:
- msbuild
- visualstudio
os: windows
stages:
- stage: ''
displayName: 'Build'
jobs:
- job: OfficialBuild
displayName: Official Build
variables:
VsInstallDir: $(Build.ArtifactStagingDirectory)/vs
pool:
name: VSEngSS-MicroBuild2022-1ES
templateContext:
mb:
signing:
enabled: true
signType: 'real'
zipSources: false
outputs:
- output: nuget
displayName: 'Push NuGet Packages to nuget.org'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
packageParentPath: '$(Build.ArtifactStagingDirectory)'
packagesToPush: '$(ArtifactsDirectory)/**/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'MSBuildCache-Push'
- output: pipelineArtifact
displayName: 'Publish Logs'
condition: always()
targetPath: $(LogDirectory)
artifactName: 'logs'
- output: pipelineArtifact
displayName: 'Publish Artifacts'
condition: always()
targetPath: $(ArtifactsDirectory)
artifactName: artifacts
steps:
- task: PowerShell@2
displayName: 'Update SignType, Build Number, and Add Build Tag for tagged commits'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
inputs:
targetType: 'inline'
script: |
Write-Host "Updating SignType to 'Real'"
Write-Host "##vso[task.setvariable variable=SignType;]Real"
Write-Host ""
$buildTag = [System.Text.RegularExpressions.Regex]::Match("$(Build.SourceBranchName)", "v.*")
if($buildTag.Success -eq $true)
{
Write-Host "Updating VSTS build number to ""$buildTag"""
Write-Host "##vso[build.updatebuildnumber]$buildTag"
Write-Host ""
Write-Host "Adding build tag ""$buildTag"""
Write-Host "##vso[build.addbuildtag]$buildTag"
}
- checkout: self
fetchDepth: 0
- task: UseDotNet@2
displayName: 'Install .NET $(DotNetVersion)'
inputs:
version: '$(DotNetVersion)'
- task: NuGetAuthenticate@1
displayName: NuGet Authenticate
- script: |
dotnet build $(Build.SourcesDirectory)/MSBuildCache.sln --configuration $(BuildConfiguration) -BinaryLogger:$(LogDirectory)/msbuild.binlog
displayName: Build
- task: DotNetCoreCLI@2
displayName: Run Unit Tests
inputs:
command: test
projects: $(Build.SourcesDirectory)/MSBuildCache.sln
arguments: -restore:false --no-build --configuration $(BuildConfiguration)
24 changes: 23 additions & 1 deletion .azuredevops/pipelines/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,29 @@ jobs:
# Fetch all history for versioning
fetchDepth: 0

- template: templates\build-and-test.yml
- task: UseDotNet@2
displayName: 'Install .NET $(DotNetVersion)'
inputs:
version: '$(DotNetVersion)'

- task: NuGetAuthenticate@1
displayName: NuGet Authenticate

- script: |
dotnet build $(Build.SourcesDirectory)/MSBuildCache.sln --configuration $(BuildConfiguration) -BinaryLogger:$(LogDirectory)/msbuild.binlog
displayName: Build

- task: DotNetCoreCLI@2
displayName: Run Unit Tests
inputs:
command: test
projects: $(Build.SourcesDirectory)/MSBuildCache.sln
arguments: -restore:false --no-build --configuration $(BuildConfiguration)

- publish: $(ArtifactsDirectory)
displayName: Publish Artifacts
artifact: artifacts
condition: always()

- publish: $(LogDirectory)
displayName: Publish Logs
Expand Down
24 changes: 0 additions & 24 deletions .azuredevops/pipelines/templates/build-and-test.yml

This file was deleted.