From 342c6167f5fe143d095eade7d5180960297babe7 Mon Sep 17 00:00:00 2001 From: Shuai Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:27:04 +0800 Subject: [PATCH] Add new pipeline using the latest webview2 from Edge Canary (#36317) * using the latest webview2 for testing --------- Signed-off-by: Shawn Yuan Co-authored-by: Clint Rutkas --- .github/actions/spell-check/expect.txt | 1 + .../v2/ci-test-with-canary-webview2.yml | 42 +++++++++++++++++++ .pipelines/v2/templates/job-test-project.yml | 26 ++++++++++++ .pipelines/v2/templates/pipeline-ci-build.yml | 4 ++ 4 files changed, 73 insertions(+) create mode 100644 .pipelines/v2/ci-test-with-canary-webview2.yml diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index a2887579c1..2b1d92721d 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -740,6 +740,7 @@ LExit lhwnd LIBID lindex +linkid LINKOVERLAY LINQTo listview diff --git a/.pipelines/v2/ci-test-with-canary-webview2.yml b/.pipelines/v2/ci-test-with-canary-webview2.yml new file mode 100644 index 0000000000..01f0454186 --- /dev/null +++ b/.pipelines/v2/ci-test-with-canary-webview2.yml @@ -0,0 +1,42 @@ +trigger: none +pr: none +schedules: + - cron: "0 0 * * *" # every day at midnight + displayName: "Daily midnight Build" + branches: + include: + - main + always: false # only run if there's code changes! + +name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) + +parameters: + - name: buildPlatforms + type: object + default: + - x64 + - arm64 + - name: enableMsBuildCaching + type: boolean + displayName: "Enable MSBuild Caching" + default: false + - name: runTests + type: boolean + displayName: "Run Tests" + default: true + - name: useVSPreview + type: boolean + displayName: "Build Using Visual Studio Preview" + default: false + - name: useLatestWebView2 + type: boolean + default: false + +extends: + template: templates/pipeline-ci-build.yml + parameters: + buildPlatforms: ${{ parameters.buildPlatforms }} + enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }} + runTests: ${{ parameters.runTests }} + useVSPreview: ${{ parameters.useVSPreview }} + useLatestWebView2: ${{ parameters.useLatestWebView2 }} diff --git a/.pipelines/v2/templates/job-test-project.yml b/.pipelines/v2/templates/job-test-project.yml index 212dbeccd8..0bf4641e42 100644 --- a/.pipelines/v2/templates/job-test-project.yml +++ b/.pipelines/v2/templates/job-test-project.yml @@ -8,6 +8,9 @@ parameters: - name: inputArtifactStem type: string default: "" + - name: useLatestWebView2 + type: boolean + default: false jobs: - job: Test${{ parameters.platform }}${{ parameters.configuration }} @@ -34,6 +37,29 @@ jobs: fetchDepth: 1 fetchTags: false + - ${{ if eq(parameters.useLatestWebView2, true) }}: + - powershell: | + $edge_url = 'https://go.microsoft.com/fwlink/?linkid=2084649&Channel=Canary&language=en' + $timeout = New-TimeSpan -Minutes 6 + $timeoutSeconds = [int]$timeout.TotalSeconds + $command = { + Invoke-WebRequest -Uri $using:edge_url -OutFile $(Pipeline.Workspace)\MicrosoftEdgeSetup.exe + Write-Host "##[command]Installing Canary channel of Microsoft Edge" + Start-Process $(Pipeline.Workspace)\MicrosoftEdgeSetup.exe -ArgumentList '/silent /install' -Wait + } + + $job = Start-Job -ScriptBlock $command + Wait-Job $job -Timeout $timeoutSeconds + if ($job.State -eq "Running") { + Stop-Job $job + Write-Host "##[warning]The job was stopped because it exceeded the time limit." + } + displayName: "Install the latest MSEdge Canary" + + - script: + reg add "HKLM\Software\Policies\Microsoft\Edge\WebView2\ReleaseChannels" /v PowerToys.exe /t REG_SZ /d "3" + displayName: "Enable WebView2 Canary Channel" + - download: current displayName: Download artifacts artifact: build-${{ parameters.platform }}-${{ parameters.configuration }}${{ parameters.inputArtifactStem }} diff --git a/.pipelines/v2/templates/pipeline-ci-build.yml b/.pipelines/v2/templates/pipeline-ci-build.yml index b7db8a7ae1..8183b50c02 100644 --- a/.pipelines/v2/templates/pipeline-ci-build.yml +++ b/.pipelines/v2/templates/pipeline-ci-build.yml @@ -22,6 +22,9 @@ parameters: - name: useVSPreview type: boolean default: false + - name: useLatestWebView2 + type: boolean + default: false - name: useLatestWinAppSDK type: boolean default: false @@ -79,3 +82,4 @@ stages: parameters: platform: ${{ platform }} configuration: Release + useLatestWebView2: ${{ parameters.useLatestWebView2 }}