diff --git a/.azure/azure-pipelines.ci.yml b/.azure/azure-pipelines.ci.yml index b24d826a5..33b34e968 100644 --- a/.azure/azure-pipelines.ci.yml +++ b/.azure/azure-pipelines.ci.yml @@ -1,213 +1,236 @@ -# -# Continuous Integration (CI) -# This pipeline builds and validates MsQuic for all configurations. -# - -trigger: - batch: true - branches: - include: - - master - - release/* - - feature/* -pr: -- master -- release/* -- feature/* - -name: 0.$(Date:yyMM).$(DayOfMonth)$(Rev:rr).0 - -# -# Builds -# - -stages: - -- stage: build_windows - displayName: Build Windows - dependsOn: [] - jobs: - # Officially supported configurations. - - template: ./templates/build-config-user.yml - parameters: - image: windows-latest - platform: windows - arch: x86 - tls: schannel - - template: ./templates/build-config-user.yml - parameters: - image: windows-latest - platform: windows - arch: x64 - tls: schannel - - template: ./templates/build-config-user.yml - parameters: - image: windows-latest - platform: windows - arch: arm - tls: schannel - - template: ./templates/build-config-user.yml - parameters: - image: windows-latest - platform: windows - arch: arm64 - tls: schannel - # Other configurations. - - template: ./templates/build-config-user.yml - parameters: - image: windows-latest - platform: windows - arch: x64 - tls: stub - - template: ./templates/build-config-user.yml - parameters: - image: windows-latest - platform: windows - arch: x64 - tls: mitls - -- stage: build_winkernel - displayName: Build Windows Drivers - dependsOn: [] - jobs: - - template: ./templates/build-config-winkernel.yml - parameters: - arch: x64 - - template: ./templates/build-config-winkernel.yml - parameters: - arch: x86 - - template: ./templates/build-config-winkernel.yml - parameters: - arch: arm - - template: ./templates/build-config-winkernel.yml - parameters: - arch: arm64 - -- stage: build_dbgext - displayName: Build WinDbg Extension - dependsOn: [] - jobs: - - template: ./templates/build-config-dbgext.yml - parameters: - arch: x64 - - template: ./templates/build-config-dbgext.yml - parameters: - arch: x86 - -- stage: build_linux - displayName: Build Linux - dependsOn: [] - jobs: - # Officially supported configurations. - - template: ./templates/build-config-user.yml - parameters: - image: ubuntu-latest - platform: linux - arch: x64 - tls: openssl - extraBuildArgs: -DisableLogs - # Other configurations. - - template: ./templates/build-config-user.yml - parameters: - image: ubuntu-latest - platform: linux - arch: x64 - tls: stub - extraBuildArgs: -DisableLogs - -# -# Mirror -# - -- stage: mirror - displayName: Mirror - dependsOn: - - build_windows - - build_winkernel - - build_dbgext - - build_linux - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/'))) - jobs: - - job: mirror - displayName: Mirror branch - pool: - vmImage: windows-latest - steps: - - checkout: self - persistCredentials: true - - task: PowerShell@2 - displayName: Sync Changes to AzDO Mirror Branch - inputs: - pwsh: true - filePath: .azure/scripts/sync-mirror.ps1 - arguments: -Branch $(Build.SourceBranch) - env: - AzDO_PAT: $(AzDO_PAT) - -# -# Build Verification Tests -# - -- stage: test_bvt - displayName: Build Verification Tests - dependsOn: - - build_windows - - build_linux - jobs: - - template: ./templates/run-bvt.yml - parameters: - image: windows-latest - platform: windows - arch: x64 - tls: schannel - extraArgs: -Filter "ParameterValidation.*:-*Events" - - template: ./templates/run-bvt.yml - parameters: - image: windows-latest - platform: windows - arch: x64 - tls: mitls - logProfile: Full.Light - extraArgs: -Filter -*Unreachable/0:CryptTest/CryptTest.Encryption/2 - - template: ./templates/run-bvt.yml - parameters: - image: ubuntu-latest - platform: linux - arch: x64 - tls: openssl - - template: ./templates/run-bvt.yml - parameters: - image: ubuntu-latest - platform: linux - config: Release - arch: x64 - tls: stub - -# -# SpinQuic Tests -# - -- stage: spinquic - displayName: SpinQuic Tests - dependsOn: - - build_windows - - build_linux - jobs: - - template: ./templates/run-spinquic.yml - parameters: - image: windows-latest - platform: windows - arch: x64 - tls: stub - - template: ./templates/run-spinquic.yml - parameters: - image: ubuntu-latest - platform: linux - arch: x64 - tls: stub - - template: ./templates/run-spinquic.yml - parameters: - image: ubuntu-latest - platform: linux - arch: x64 - tls: openssl +# +# Continuous Integration (CI) +# This pipeline builds and validates MsQuic for all configurations. +# + +trigger: + batch: true + branches: + include: + - master + - release/* + - feature/* +pr: +- master +- release/* +- feature/* + +name: 0.$(Date:yyMM).$(DayOfMonth)$(Rev:rr).0 + +# +# Builds +# + +stages: + +- stage: build_windows + displayName: Build Windows + dependsOn: [] + jobs: + # Officially supported configurations. + - template: ./templates/build-config-user.yml + parameters: + image: windows-latest + platform: windows + arch: x86 + tls: schannel + - template: ./templates/build-config-user.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: schannel + - template: ./templates/build-config-user.yml + parameters: + image: windows-latest + platform: windows + arch: arm + tls: schannel + - template: ./templates/build-config-user.yml + parameters: + image: windows-latest + platform: windows + arch: arm64 + tls: schannel + # Other configurations. + - template: ./templates/build-config-user.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: stub + - template: ./templates/build-config-user.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: mitls + +- stage: build_winkernel + displayName: Build Windows Drivers + dependsOn: [] + jobs: + - template: ./templates/build-config-winkernel.yml + parameters: + arch: x64 + - template: ./templates/build-config-winkernel.yml + parameters: + arch: x86 + - template: ./templates/build-config-winkernel.yml + parameters: + arch: arm + - template: ./templates/build-config-winkernel.yml + parameters: + arch: arm64 + +- stage: build_dbgext + displayName: Build WinDbg Extension + dependsOn: [] + jobs: + - template: ./templates/build-config-dbgext.yml + parameters: + arch: x64 + - template: ./templates/build-config-dbgext.yml + parameters: + arch: x86 + +- stage: build_linux + displayName: Build Linux + dependsOn: [] + jobs: + # Officially supported configurations. + - template: ./templates/build-config-user.yml + parameters: + image: ubuntu-latest + platform: linux + arch: x64 + tls: openssl + extraBuildArgs: -DisableLogs + # Other configurations. + - template: ./templates/build-config-user.yml + parameters: + image: ubuntu-latest + platform: linux + arch: x64 + tls: stub + extraBuildArgs: -DisableLogs + +# +# Mirror +# + +- stage: mirror + displayName: Mirror + dependsOn: + - build_windows + - build_winkernel + - build_dbgext + - build_linux + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/'))) + jobs: + - job: mirror + displayName: Mirror branch + pool: + vmImage: windows-latest + steps: + - checkout: self + persistCredentials: true + - task: PowerShell@2 + displayName: Sync Changes to AzDO Mirror Branch + inputs: + pwsh: true + filePath: .azure/scripts/sync-mirror.ps1 + arguments: -Branch $(Build.SourceBranch) + env: + AzDO_PAT: $(AzDO_PAT) + +# +# Build Verification Tests +# + +- stage: test_bvt + displayName: Build Verification Tests + dependsOn: + - build_windows + - build_linux + jobs: + - template: ./templates/run-bvt.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: schannel + extraArgs: -Filter "ParameterValidation.*:-*Events" + - template: ./templates/run-bvt.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: mitls + logProfile: Full.Light + extraArgs: -Filter -*Unreachable/0:CryptTest/CryptTest.Encryption/2 + - template: ./templates/run-bvt.yml + parameters: + image: ubuntu-latest + platform: linux + arch: x64 + tls: openssl + - template: ./templates/run-bvt.yml + parameters: + image: ubuntu-latest + platform: linux + config: Release + arch: x64 + tls: stub + +# +# SpinQuic Tests +# + +- stage: spinquic + displayName: SpinQuic Tests + dependsOn: + - build_windows + - build_linux + jobs: + - template: ./templates/run-spinquic.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: stub + - template: ./templates/run-spinquic.yml + parameters: + image: ubuntu-latest + platform: linux + arch: x64 + tls: stub + - template: ./templates/run-spinquic.yml + parameters: + image: ubuntu-latest + platform: linux + arch: x64 + tls: openssl + +# +# QuicInterop +# + +- stage: quicinterop + displayName: QuicInterop Tests + dependsOn: + - build_windows + - build_linux + jobs: + - template: ./templates/run-quicinterop.yml + parameters: + image: windows-latest + platform: windows + arch: x64 + tls: mitls + - template: ./templates/run-quicinterop.yml + parameters: + image: ubuntu-latest + platform: linux + arch: x64 + tls: openssl diff --git a/.azure/templates/run-quicinterop.yml b/.azure/templates/run-quicinterop.yml new file mode 100644 index 000000000..0d700b644 --- /dev/null +++ b/.azure/templates/run-quicinterop.yml @@ -0,0 +1,45 @@ +# This template contains steps to run quicinterop for a single configuration. + +parameters: + image: '' + platform: '' + config: 'Release' + arch: '' + tls: '' + +jobs: +- job: interop_${{ parameters.platform }}_${{ parameters.arch }}_${{ parameters.tls }} + displayName: QuicInterop ${{ parameters.platform }} ${{ parameters.arch }} ${{ parameters.tls }} + pool: + vmImage: ${{ parameters.image }} + steps: + - checkout: self + + - template: ./download-artifacts.yml + parameters: + platform: ${{ parameters.platform }} + arch: ${{ parameters.arch }} + tls: ${{ parameters.tls }} + + - task: PowerShell@2 + displayName: Prepare Test Machine + inputs: + pwsh: true + filePath: scripts/prepare-machine.ps1 + arguments: -Configuration Test + + - task: PowerShell@2 + displayName: Run QuicInterop + timeoutInMinutes: 5 + continueOnError: true + inputs: + pwsh: true + filePath: scripts/interop.ps1 + arguments: -GenerateXmlResults -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} + + - template: ./upload-test-artifacts.yml + parameters: + platform: ${{ parameters.platform }} + config: ${{ parameters.config }} + arch: ${{ parameters.arch }} + tls: ${{ parameters.tls }} diff --git a/.azure/templates/run-spinquic.yml b/.azure/templates/run-spinquic.yml index d2afd47c3..b70f1c00b 100644 --- a/.azure/templates/run-spinquic.yml +++ b/.azure/templates/run-spinquic.yml @@ -14,7 +14,6 @@ jobs: vmImage: ${{ parameters.image }} steps: - checkout: self - persistCredentials: true - template: ./download-artifacts.yml parameters: diff --git a/scripts/interop.ps1 b/scripts/interop.ps1 new file mode 100644 index 000000000..b6065c7b9 --- /dev/null +++ b/scripts/interop.ps1 @@ -0,0 +1,98 @@ +<# + +.SYNOPSIS +This script runs quicinterop locally. + +.PARAMETER Config + Specifies the build configuration to use. + +.PARAMETER Arch + The CPU architecture to use. + +.PARAMETER Tls + The TLS library use. + +.PARAMETER KeepOutputOnSuccess + Don't discard console output or logs on success. + +.PARAMETER GenerateXmlResults + Generates an xml Test report for the run. + +.PARAMETER Debugger + Attaches the debugger to the process. + +.PARAMETER LogProfile + The name of the profile to use for log collection. + +.PARAMETER ConvertLogs + Convert any collected logs to text. Only works when LogProfile is set. + +#> + +param ( + [Parameter(Mandatory = $false)] + [ValidateSet("Debug", "Release")] + [string]$Config = "Debug", + + [Parameter(Mandatory = $false)] + [ValidateSet("x86", "x64", "arm", "arm64")] + [string]$Arch = "x64", + + [Parameter(Mandatory = $false)] + [ValidateSet("schannel", "openssl", "stub", "mitls")] + [string]$Tls = "schannel", + + [Parameter(Mandatory = $false)] + [switch]$KeepOutputOnSuccess = $false, + + [Parameter(Mandatory = $false)] + [switch]$GenerateXmlResults = $false, + + [Parameter(Mandatory = $false)] + [switch]$Debugger = $false, + + [Parameter(Mandatory = $false)] + [ValidateSet("None", "Basic.Light", "Basic.Verbose", "Full.Light", "Full.Verbose", "SpinQuic.Light")] + [string]$LogProfile = "None", + + [Parameter(Mandatory = $false)] + [switch]$ConvertLogs = $false +) + +Set-StrictMode -Version 'Latest' +$PSDefaultParameterValues['*:ErrorAction'] = 'Stop' + +# Root directory of the project. +$RootDir = Split-Path $PSScriptRoot -Parent + +# Path to the run-executable Powershell script. +$RunExecutable = Join-Path $RootDir ".azure/scripts/run-executable.ps1" + +# Path to the quicinterop exectuable. +$SpinQuic = $null +if ($IsWindows) { + $SpinQuic = Join-Path $RootDir "\artifacts\windows\$($Arch)_$($Config)_$($Tls)\quicinterop.exe" +} else { + $SpinQuic = Join-Path $RootDir "/artifacts/linux/$($Arch)_$($Config)_$($Tls)/quicinterop" +} + +# Build up all the arguments to pass to the Powershell script. +$Arguments = "-Path $($SpinQuic) -ShowOutput" +if ($KeepOutputOnSuccess) { + $Arguments += " -KeepOutputOnSuccess" +} +if ($GenerateXmlResults) { + $Arguments += " -GenerateXmlResults" +} +if ($Debugger) { + $Arguments += " -Debugger" +} +if ("None" -ne $LogProfile) { + $Arguments += " -LogProfile $($LogProfile)" +} +if ($ConvertLogs) { + $Arguments += " -ConvertLogs" +} + +# Run the script. +Invoke-Expression ($RunExecutable + " " + $Arguments)