Implement a CI pipeline (#13003)

This commit is contained in:
Blue 2025-05-29 16:31:17 -07:00 committed by GitHub
parent 4e1784d737
commit 0fcad801bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 180 additions and 135 deletions

View File

@ -36,6 +36,16 @@ parameters:
- x64
- arm64
- name: pool
type: string
default: ''
- name: vsoOrg
type: string
- name: vsoProject
type: string
- name: esrp
type: object
default:
@ -55,13 +65,19 @@ stages:
- stage: build
jobs:
- job:
displayName: "Formatting & localization checks"
timeoutInMinutes: 30
pool:
type: windows
variables:
ob_outputDirectory: '$(Build.SourcesDirectory)\out'
${{ if eq(parameters.pool, '') }}:
pool: {'type': 'windows'}
${{ else }}:
pool: ${{ parameters.pool }}
steps:
- script: python tools/devops/validate-localization.py localization/strings en-US
displayName: Validate localization resources
@ -88,8 +104,12 @@ stages:
- job: build
displayName: "Build WSL package"
timeoutInMinutes: 120
pool:
type: windows
${{ if eq(parameters.pool, '') }}:
pool: {'type': 'windows'}
${{ else }}:
pool: ${{ parameters.pool }}
variables:
NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS: 60
@ -146,7 +166,7 @@ stages:
displayName: "CMake ${{ platform }}"
inputs:
workingDirectory: "."
cmakeArgs: . --fresh -A ${{ platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DPIPELINE_BUILD_ID=$(Build.BuildId)
cmakeArgs: . --fresh -A ${{ platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }}
# This additional Restore NuGet package task is added as a workaround for WSL Settings to have its' packages restored properly.
# Without this, building wsl settings may encounter the following error:
@ -161,6 +181,7 @@ stages:
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
displayName: "Build ${{ target.target }} (${{ platform }})"
- ${{ if eq(parameters.isRelease, 'true') }}:
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign ${{ target.target }} (${{ platform }})"
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
@ -230,6 +251,7 @@ stages:
$arch = '${{ platform }}'
Copy-Item -Path "bin\$arch\release\wsl.msi" -Destination "$(ob_outputDirectory)\bundle\wsl.$(version.WSL_PACKAGE_VERSION).$arch.msi"
- ${{ if eq(parameters.isRelease, 'true') }}:
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign the bundle"
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
@ -279,6 +301,7 @@ stages:
- script: nuget.exe pack ${{ package }} -OutputDirectory $(ob_outputDirectory)\bin\nuget -NonInteractive
displayName: Build ${{ package }}
- ${{ if eq(parameters.isRelease, 'true') }}:
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign nuget packages"
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
@ -323,7 +346,7 @@ stages:
mkdir $pdbFolder
foreach ($filter in @("*.pdb", "*.debug"))
{
foreach ($e in (Get-ChildItem -Recurse -Path $binFolder -Filter $filter)) {Copy-Item -Path $e.fullname -Destination (Join-Path $pdbFolder $e.name)}
foreach ($e in (Get-ChildItem -Recurse -Path $binFolder -Filter $filter)) {Move-Item -Path $e.fullname -Destination (Join-Path $pdbFolder $e.name)}
}
}
@ -380,5 +403,11 @@ stages:
$(ob_outputDirectory)/bin/**/*.exe
$(ob_outputDirectory)/bin/**/*.dll
- ${{ if ne(parameters.pool, '') }}:
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(ob_outputDirectory)
artifactName: $(ob_artifactBaseName)$(ob_artifactSuffix)
- task: CodeQL3000Finalize@0
condition: ${{ and(parameters.isNightly, eq(variables['Build.SourceBranch'], 'refs/heads/main'))}}

View File

@ -11,6 +11,10 @@ parameters:
- name: run
type: boolean
- name: pool
type: string
default: ''
jobs:
- job: test_${{ parameters.branch }}_${{ parameters.version }}
displayName: "${{ parameters.version }} tests - ${{ parameters.branch }}"
@ -22,8 +26,11 @@ jobs:
ob_artifactSuffix: '_test'
timeoutInMinutes: 360
cancelTimeoutInMinutes: 420
pool:
type: cloudtestagentless
${{ if eq(parameters.pool, '') }}:
pool: {'type': 'cloudtestagentless'}
${{ else }}:
pool: ${{ parameters.pool }}
steps:
- task: CloudTestServerBuildTask@2
inputs:

View File

@ -3,6 +3,10 @@ parameters:
type: boolean
default: false
- name: pool
type: string
default: ''
- name: versions
type: object
default:
@ -35,3 +39,4 @@ stages:
version: ${{ version }}
image: "${{ image.image }}"
run: ${{ or(not(parameters.rs_prerelease_only), eq(image.name, 'rs_prerelease')) }}
pool: "${{ parameters.pool }}"

View File

@ -44,6 +44,8 @@ extends:
parameters:
isRelease: false
isNightly: true
vsoOrg: microsoft
vsoProject: Microsoft.WSL
- template: test-stage.yml@self
parameters:

View File

@ -4,15 +4,15 @@ trigger:
- master
- release/*
git:
fetchDepth: -1
fetchTags: true
stages:
- template: build-stage.yml@self
parameters:
isRelease: false
pool: 'wsl-build'
vsoOrg: shine-oss
vsoProject: wsl
- template: test-stage.yml@self
parameters:
rs_prerelease_only: true
pool: server

View File

@ -52,6 +52,8 @@ extends:
isRelease: true
packageVersion: ${{ iif(eq(parameters.testVersion, ''), variables['Build.SourceBranchName'], parameters.testVersion) }}
traceLoggingConfig: $(ReleaseTraceLoggingConfig)
vsoOrg: microsoft
vsoProject: Microsoft.WSL
- template: test-stage.yml@self
parameters:

View File

@ -5,7 +5,7 @@
<Provider Type="PipelineArtifacts">
<Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[drop]" />
<Add Name="PipelineArtifactBuildUrl" Value="https://microsoft.visualstudio.com/Microsoft.WSL/_build/results?buildId=${PIPELINE_BUILD_ID}"/>
<Add Name="PipelineArtifactBuildUrl" Value="https://${VSO_ORG}.visualstudio.com/${VSO_PROJECT}/_build/results?buildId=${PIPELINE_BUILD_ID}"/>
<Add Name="PipelineArtifactName" Value="drop_wsl_build"/>
</Properties>
</Provider>
@ -13,21 +13,21 @@
<Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[test_distro]" />
<!-- When updating the drops for this make sure the rentention is set to never expire -->
<Add Name="DropURL" Value="https://microsoft.artifacts.visualstudio.com/DefaultCollection/_apis/drop/drops/WSL/${CLOUDTEST_TEST_DISTRO_DROP}"/>
<Add Name="DropURL" Value="https://${VSO_ORG}.artifacts.visualstudio.com/_apis/drop/drops/WSL/${CLOUDTEST_TEST_DISTRO_DROP}"/>
</Properties>
</Provider>
<Provider Type="VSODrop">
<Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[test_packages]" />
<!-- When updating the drops for this make sure the rentention is set to never expire -->
<Add Name="DropURL" Value="https://microsoft.artifacts.visualstudio.com/DefaultCollection/_apis/drop/drops/WSL/${CLOUDTEST_TEST_PACKAGES}"/>
<Add Name="DropURL" Value="https://${VSO_ORG}.artifacts.visualstudio.com/_apis/drop/drops/WSL/${CLOUDTEST_TEST_PACKAGES}"/>
</Properties>
</Provider>
<Provider Type="VSODrop">
<Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[dump_tool]" />
<!-- When updating the drops for this make sure the rentention is set to never expire -->
<Add Name="DropURL" Value="https://microsoft.artifacts.visualstudio.com/DefaultCollection/_apis/drop/drops/WSL/${DUMPTOOL_DROP}"/>
<Add Name="DropURL" Value="https://${VSO_ORG}.artifacts.visualstudio.com/_apis/drop/drops/WSL/${DUMPTOOL_DROP}"/>
</Properties>
</Provider>
</Providers>