-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wasm] Use latest stable version of chrome for testing (#77133)
* Use the latest `stable` chrome version by default * Install these by default on codespaces ## Details - Added a new task `GetChromeVersions` to get the latest version - This is applicable to library tests, debugger tests, and Wasm.Build.Tests - The channel used for getting the "latest" version is `$(ChromeChannel)=stable` - And they are installed in `artifacts/bin/chrome`, and `artifacts/bin/chromedriver` - A newer version is fetched only `$(ChromeVersionCheckThresholdDays)=3` days after the last version check - This is enabled by default on containers - And the behavior can be disabled with `$(InstallChromeForTests)=false`.
- Loading branch information
Showing
14 changed files
with
392 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
<Project> | ||
<!-- Version number to revision number mapping from http://omahaproxy.appspot.com/ and find the closest one in | ||
https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/ | ||
and https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/ | ||
Eg. latest stable version is 100.0.4896.88 with revision 972766. | ||
but the closest one available in the snapshosts is 972765. | ||
Please make sure to check both platforms as sometimes | ||
the same snapshot might not be available in both of them. | ||
<!-- | ||
Set ChromeChannel properties to get the latest versions | ||
--> | ||
<PropertyGroup> | ||
<ChromeChannel>stable</ChromeChannel> | ||
|
||
<ChromeOSIdentifier Condition="$([MSBuild]::IsOSPlatform('windows'))">win</ChromeOSIdentifier> | ||
<ChromeOSIdentifier Condition="$([MSBuild]::IsOSPlatform('linux'))">linux</ChromeOSIdentifier> | ||
<ChromeOSIdentifier Condition="$([MSBuild]::IsOSPlatform('mac'))">mac</ChromeOSIdentifier> | ||
|
||
<InstallChromeForTests Condition="'$(InstallChromeForTests)' == '' and '$(ChromeOSIdentifier)' == ''">false</InstallChromeForTests> | ||
|
||
<ChromeDir>$(ArtifactsBinDir)chrome\</ChromeDir> | ||
<ChromeDriverDir>$(ArtifactsBinDir)chromedriver\</ChromeDriverDir> | ||
|
||
<!-- Download all.json to get latest chrome versions, only if the last all.json | ||
is more than 3 days old --> | ||
<ChromeVersionCheckThresholdDays>3</ChromeVersionCheckThresholdDays> | ||
|
||
<FirefoxDir>$(ArtifactsBinDir)firefox\</FirefoxDir> | ||
<FirefoxStampFile>$([MSBuild]::NormalizePath($(FirefoxDir), '.install-firefox-$(FirefoxRevision).stamp'))</FirefoxStampFile> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(BrowserHost)' != 'windows'"> | ||
<ChromiumRevision>972765</ChromiumRevision> | ||
<ChromiumUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/$(ChromiumRevision)/chrome-linux.zip</ChromiumUrl> | ||
<ChromeDriverUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/$(ChromiumRevision)/chromedriver_linux64.zip</ChromeDriverUrl> | ||
<ChromiumDirName>chrome-linux</ChromiumDirName> | ||
<ChromeDriverDirName>chromedriver_linux64</ChromeDriverDirName> | ||
<ChromiumBinaryName>chrome</ChromiumBinaryName> | ||
<FirefoxRevision>97.0.1</FirefoxRevision> | ||
<FirefoxUrl>https://ftp.mozilla.org/pub/firefox/releases/$(FirefoxRevision)/linux-x86_64/en-US/firefox-$(FirefoxRevision).tar.bz2</FirefoxUrl> | ||
<FirefoxBinaryName>firefox</FirefoxBinaryName> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(BrowserHost)' == 'windows'"> | ||
<ChromiumRevision>972766</ChromiumRevision> | ||
<ChromiumUrl>https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/$(ChromiumRevision)/chrome-win.zip</ChromiumUrl> | ||
<ChromeDriverUrl>https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/$(ChromiumRevision)/chromedriver_win32.zip</ChromeDriverUrl> | ||
<ChromiumDirName>chrome-win</ChromiumDirName> | ||
<ChromeDriverDirName>chromedriver_win32</ChromeDriverDirName> | ||
<ChromiumBinaryName>chrome.exe</ChromiumBinaryName> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<Project> | ||
<Import Project="$(MSBuildThisFileDirectory)ProvisioningVersions.props" /> | ||
|
||
<PropertyGroup Condition="'$(ChromeOSIdentifier)' == 'linux'"> | ||
<ChromeDirName>chrome-linux</ChromeDirName> | ||
<ChromeDriverDirName>chromedriver_linux64</ChromeDriverDirName> | ||
<ChromeBinaryName>chrome</ChromeBinaryName> | ||
<ChromeDriverBinaryName>chromedriver</ChromeDriverBinaryName> | ||
<_ChromeOSPrefix>Linux_x64</_ChromeOSPrefix> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(ChromeOSIdentifier)' == 'win'"> | ||
<ChromeDirName>chrome-win</ChromeDirName> | ||
<ChromeDriverDirName>chromedriver_win32</ChromeDriverDirName> | ||
<ChromeBinaryName>chrome.exe</ChromeBinaryName> | ||
<ChromeDriverBinaryName>chromedriver.exe</ChromeDriverBinaryName> | ||
<_ChromeOSPrefix>Win_x64</_ChromeOSPrefix> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<_BrowserStampDir>$(ArtifactsBinDir)\</_BrowserStampDir> | ||
<ChromeBinaryPath>$([MSBuild]::NormalizePath($(ChromeDir), $(ChromeDirName), $(ChromeBinaryName)))</ChromeBinaryPath> | ||
<ChromeDriverBinaryPath>$([MSBuild]::NormalizePath($(ChromeDriverDir), $(ChromeDriverDirName), $(ChromeDriverBinaryName)))</ChromeDriverBinaryPath> | ||
</PropertyGroup> | ||
|
||
<Target Name="DownloadAndInstallChrome" | ||
AfterTargets="GetChromeVersion" | ||
Condition="(!Exists($(ChromeStampFile)) or !Exists($(ChromeBinaryPath))) and '$(InstallChromeForTests)' == 'true'"> | ||
|
||
<RemoveDir Directories="$(ChromeDir)" /> | ||
|
||
<Message Text="** Installing chrome version $(ChromeVersion), rev: $(ChromeRevision). To disable this set the msuild property InstallChromeForTests=false ." | ||
Importance="High" /> | ||
|
||
<DownloadFile SourceUrl="$(ChromeUrl)" DestinationFolder="$(ArtifactsObjDir)" SkipUnchangedFiles="false"> | ||
<Output TaskParameter="DownloadedFile" PropertyName="_DownloadedFile" /> | ||
</DownloadFile> | ||
<Unzip SourceFiles="$(_DownloadedFile)" DestinationFolder="$(ChromeDir)" /> | ||
|
||
<Error Text="Cannot find chrome at $(ChromeBinaryPath) in the downloaded copy" | ||
Condition="!Exists($(ChromeBinaryPath))" /> | ||
|
||
<Exec Command="chmod +x $(ChromeBinaryPath)" Condition="!$([MSBuild]::IsOSPlatform('windows'))" /> | ||
|
||
<Touch Files="$(ChromeStampFile)" AlwaysCreate="true" /> | ||
</Target> | ||
|
||
<Target Name="DownloadAndInstallChromeDriver" | ||
AfterTargets="GetChromeVersion" | ||
Condition="(!Exists($(ChromeDriverStampFile)) or !Exists($(ChromeDriverBinaryPath))) and '$(InstallChromeForTests)' == 'true'"> | ||
|
||
<RemoveDir Directories="$(ChromeDriverDir)" /> | ||
|
||
<Message Text="** Installing chromedriver version $(ChromeVersion), rev: $(ChromeRevision). To disable this set the msuild property InstallChromeForTests=false ." | ||
Importance="High" /> | ||
|
||
<DownloadFile SourceUrl="$(ChromeDriverUrl)" DestinationFolder="$(ArtifactsObjDir)" SkipUnchangedFiles="false"> | ||
<Output TaskParameter="DownloadedFile" PropertyName="_DownloadedFile" /> | ||
</DownloadFile> | ||
<Unzip SourceFiles="$(_DownloadedFile)" DestinationFolder="$(ChromeDriverDir)" /> | ||
|
||
<Error Text="Cannot find chromedriver at $(ChromeDriverBinaryPath) in the downloaded copy" | ||
Condition="!Exists($(ChromeDriverBinaryPath))" /> | ||
|
||
<Exec Command="chmod +x $(ChromeDriverBinaryPath)" Condition="!$([MSBuild]::IsOSPlatform('windows'))" /> | ||
|
||
<Touch Files="$(ChromeDriverStampFile)" AlwaysCreate="true" /> | ||
</Target> | ||
|
||
<Target Name="DownloadAndInstallFirefox" | ||
AfterTargets="Build" | ||
Condition="!Exists($(FirefoxStampFile)) and '$(InstallFirefoxForTests)' == 'true' and !$([MSBuild]::IsOSPlatform('windows'))"> | ||
<ItemGroup> | ||
<_StampFile Include="$(_BrowserStampDir).install-firefox*.stamp" /> | ||
</ItemGroup> | ||
|
||
<Delete Files="@(_StampFile)" /> | ||
<RemoveDir Directories="$(FirefoxDir)" /> | ||
|
||
<DownloadFile SourceUrl="$(FirefoxUrl)" DestinationFolder="$(FirefoxDir)" SkipUnchangedFiles="true"> | ||
<Output TaskParameter="DownloadedFile" PropertyName="_DownloadedFile" /> | ||
</DownloadFile> | ||
<Exec Command="tar -xf $(_DownloadedFile) -C $(FirefoxDir)"/> | ||
<Exec Command="rm -rf $(_DownloadedFile)"/> | ||
|
||
<PropertyGroup> | ||
<_FirefoxBinaryPath>$([MSBuild]::NormalizePath($(FirefoxDir), $(FirefoxBinaryName)))</_FirefoxBinaryPath> | ||
</PropertyGroup> | ||
|
||
<Error Text="Cannot find firefox at $(_FirefoxBinaryPath) in the downloaded copy" | ||
Condition="!Exists($(_FirefoxBinaryPath))" /> | ||
|
||
<Exec Command="chmod +x $(_FirefoxBinaryPath)"/> | ||
|
||
<Touch Files="$(FirefoxStampFile)" AlwaysCreate="true" /> | ||
</Target> | ||
|
||
<UsingTask AssemblyFile="$(WasmBuildTasksAssemblyPath)" | ||
TaskName="Microsoft.WebAssembly.Build.Tasks.GetChromeVersions" /> | ||
|
||
<Target Name="GetChromeVersion" AfterTargets="Build" Condition="'$(InstallChromeForTests)' == 'true'"> | ||
<GetChromeVersions | ||
OSIdentifier="$(ChromeOSIdentifier)" | ||
OSPrefix="$(_ChromeOSPrefix)" | ||
Channel="$(ChromeChannel)" | ||
IntermediateOutputPath="$(ArtifactsObjDir)"> | ||
<Output TaskParameter="ChromeVersion" PropertyName="ChromeVersion" /> | ||
<Output TaskParameter="V8Version" PropertyName="V8Version" /> | ||
<Output TaskParameter="BranchPosition" PropertyName="ChromeRevision" /> | ||
<Output TaskParameter="BaseSnapshotUrl" PropertyName="_ChromeBaseSnapshotUrl" /> | ||
</GetChromeVersions> | ||
|
||
<PropertyGroup Condition="'$(ChromeOSIdentifier)' == 'linux'"> | ||
<ChromeUrl>$(_ChromeBaseSnapshotUrl)/chrome-linux.zip</ChromeUrl> | ||
<ChromeDriverUrl>$(_ChromeBaseSnapshotUrl)/chromedriver_linux64.zip</ChromeDriverUrl> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(ChromeOSIdentifier)' == 'win'"> | ||
<ChromeUrl>$(_ChromeBaseSnapshotUrl)/chrome-win.zip</ChromeUrl> | ||
<ChromeDriverUrl>$(_ChromeBaseSnapshotUrl)/chromedriver_win32.zip</ChromeDriverUrl> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<ChromeStampFile>$([MSBuild]::NormalizePath('$(ChromeDir)', '.install-$(ChromeVersion)-$(ChromeRevision).stamp'))</ChromeStampFile> | ||
<ChromeDriverStampFile>$([MSBuild]::NormalizePath('$(ChromeDriverDir)', '.install-$(ChromeVersion)-$(ChromeRevision).stamp'))</ChromeDriverStampFile> | ||
</PropertyGroup> | ||
</Target> | ||
</Project> |
Oops, something went wrong.