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 - x64
- arm64 - arm64
- name: pool
type: string
default: ''
- name: vsoOrg
type: string
- name: vsoProject
type: string
- name: esrp - name: esrp
type: object type: object
default: default:
@ -55,13 +65,19 @@ stages:
- stage: build - stage: build
jobs: jobs:
- job: - job:
displayName: "Formatting & localization checks" displayName: "Formatting & localization checks"
timeoutInMinutes: 30 timeoutInMinutes: 30
pool:
type: windows
variables: variables:
ob_outputDirectory: '$(Build.SourcesDirectory)\out' ob_outputDirectory: '$(Build.SourcesDirectory)\out'
${{ if eq(parameters.pool, '') }}:
pool: {'type': 'windows'}
${{ else }}:
pool: ${{ parameters.pool }}
steps: steps:
- script: python tools/devops/validate-localization.py localization/strings en-US - script: python tools/devops/validate-localization.py localization/strings en-US
displayName: Validate localization resources displayName: Validate localization resources
@ -88,8 +104,12 @@ stages:
- job: build - job: build
displayName: "Build WSL package" displayName: "Build WSL package"
timeoutInMinutes: 120 timeoutInMinutes: 120
pool:
type: windows ${{ if eq(parameters.pool, '') }}:
pool: {'type': 'windows'}
${{ else }}:
pool: ${{ parameters.pool }}
variables: variables:
NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS: 60 NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS: 60
@ -146,7 +166,7 @@ stages:
displayName: "CMake ${{ platform }}" displayName: "CMake ${{ platform }}"
inputs: inputs:
workingDirectory: "." 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. # 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: # Without this, building wsl settings may encounter the following error:
@ -161,6 +181,7 @@ stages:
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true)) condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
displayName: "Build ${{ target.target }} (${{ platform }})" displayName: "Build ${{ target.target }} (${{ platform }})"
- ${{ if eq(parameters.isRelease, 'true') }}:
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5 - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign ${{ target.target }} (${{ platform }})" displayName: "Sign ${{ target.target }} (${{ platform }})"
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true)) condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
@ -230,6 +251,7 @@ stages:
$arch = '${{ platform }}' $arch = '${{ platform }}'
Copy-Item -Path "bin\$arch\release\wsl.msi" -Destination "$(ob_outputDirectory)\bundle\wsl.$(version.WSL_PACKAGE_VERSION).$arch.msi" 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 - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign the bundle" displayName: "Sign the bundle"
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true)) condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
@ -279,6 +301,7 @@ stages:
- script: nuget.exe pack ${{ package }} -OutputDirectory $(ob_outputDirectory)\bin\nuget -NonInteractive - script: nuget.exe pack ${{ package }} -OutputDirectory $(ob_outputDirectory)\bin\nuget -NonInteractive
displayName: Build ${{ package }} displayName: Build ${{ package }}
- ${{ if eq(parameters.isRelease, 'true') }}:
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5 - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign nuget packages" displayName: "Sign nuget packages"
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true)) condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
@ -323,7 +346,7 @@ stages:
mkdir $pdbFolder mkdir $pdbFolder
foreach ($filter in @("*.pdb", "*.debug")) 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/**/*.exe
$(ob_outputDirectory)/bin/**/*.dll $(ob_outputDirectory)/bin/**/*.dll
- ${{ if ne(parameters.pool, '') }}:
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(ob_outputDirectory)
artifactName: $(ob_artifactBaseName)$(ob_artifactSuffix)
- task: CodeQL3000Finalize@0 - task: CodeQL3000Finalize@0
condition: ${{ and(parameters.isNightly, eq(variables['Build.SourceBranch'], 'refs/heads/main'))}} condition: ${{ and(parameters.isNightly, eq(variables['Build.SourceBranch'], 'refs/heads/main'))}}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<Provider Type="PipelineArtifacts"> <Provider Type="PipelineArtifacts">
<Properties> <Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[drop]" /> <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"/> <Add Name="PipelineArtifactName" Value="drop_wsl_build"/>
</Properties> </Properties>
</Provider> </Provider>
@ -13,21 +13,21 @@
<Properties> <Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[test_distro]" /> <Add Name="CloudTest.ProviderCustomName" Value="[test_distro]" />
<!-- When updating the drops for this make sure the rentention is set to never expire --> <!-- 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> </Properties>
</Provider> </Provider>
<Provider Type="VSODrop"> <Provider Type="VSODrop">
<Properties> <Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[test_packages]" /> <Add Name="CloudTest.ProviderCustomName" Value="[test_packages]" />
<!-- When updating the drops for this make sure the rentention is set to never expire --> <!-- 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> </Properties>
</Provider> </Provider>
<Provider Type="VSODrop"> <Provider Type="VSODrop">
<Properties> <Properties>
<Add Name="CloudTest.ProviderCustomName" Value="[dump_tool]" /> <Add Name="CloudTest.ProviderCustomName" Value="[dump_tool]" />
<!-- When updating the drops for this make sure the rentention is set to never expire --> <!-- 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> </Properties>
</Provider> </Provider>
</Providers> </Providers>