Skip to content

Commit 89da3ed

Browse files
authored
Chrome upgrade PR should bump mac versions as well. (#129974)
## Problem 1 In #124852 we added chrome for mac version to provisioning list. Since then the version was not updated because it's not added to platforms covered by automation. ## Problem 2 In #129851 we manually upgraded v8 version. The next automated PR #129934 downgraded it. ## Changes - Add mac to automated version check - Add mac smoke tests running only on the automated bump PRs, following the pattern used in library tests on mac. - Automated update can be only an upgrade: always check if the new value > old value.
1 parent 422a449 commit 89da3ed

9 files changed

Lines changed: 97 additions & 30 deletions

File tree

.github/workflows/bump-chrome-version.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
make -C src/mono/wasm build-tasks &&
2929
PATH=$PWD/.dotnet:$PATH dotnet build eng/testing/bump-chrome-version.proj -p:Configuration=Release &&
3030
git add eng/testing/BrowserVersions.props &&
31-
cat eng/testing/bump-chrome-pr.env >> "$GITHUB_ENV"
31+
if [ -f eng/testing/bump-chrome-pr.env ]; then cat eng/testing/bump-chrome-pr.env >> "$GITHUB_ENV"; fi
3232
3333
- name: Check for changes
3434
id: check_changes
@@ -50,8 +50,8 @@ jobs:
5050
uses: actions/github-script@v9
5151
with:
5252
script: |
53-
const { CHROME_LINUX_VER, CHROME_WIN_VER } = process.env;
54-
const title = `[wasm] Bump chrome for testing - linux: ${CHROME_LINUX_VER}, windows: ${CHROME_WIN_VER}`;
53+
const { CHROME_LINUX_VER, CHROME_WIN_VER, CHROME_MAC_VER } = process.env;
54+
const title = `[wasm] Bump chrome for testing - linux: ${CHROME_LINUX_VER}, windows: ${CHROME_WIN_VER}, mac: ${CHROME_MAC_VER}`;
5555
const { data: pullRequest } = await github.rest.pulls.create({
5656
base: context.ref,
5757
head: "update-chrome-version-${{ github.run_id }}",

eng/pipelines/common/platform-matrix.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,25 @@ jobs:
538538
buildConfig: ${{ parameters.buildConfig }}
539539
${{ insert }}: ${{ parameters.jobParameters }}
540540

541+
# Browser WebAssembly on macOS
542+
543+
- ${{ if containsValue(parameters.platforms, 'browser_wasm_mac') }}:
544+
- template: xplat-setup.yml
545+
parameters:
546+
jobTemplate: ${{ parameters.jobTemplate }}
547+
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
548+
variables: ${{ parameters.variables }}
549+
osGroup: browser
550+
archType: wasm
551+
targetRid: browser-wasm
552+
platform: browser_wasm_mac
553+
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
554+
jobParameters:
555+
hostedOs: osx
556+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
557+
buildConfig: ${{ parameters.buildConfig }}
558+
${{ insert }}: ${{ parameters.jobParameters }}
559+
541560
# FreeBSD
542561
- ${{ if containsValue(parameters.platforms, 'freebsd_x64') }}:
543562
- template: xplat-setup.yml

eng/pipelines/common/templates/wasm-library-tests.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ parameters:
99
scenarios: ['WasmTestOnChrome']
1010
shouldContinueOnError: false
1111
shouldRunSmokeOnly: false
12+
runOnlyOnChromeVersionUpdate: false
1213

1314
jobs:
1415

@@ -87,10 +88,16 @@ jobs:
8788
# - then run only if it would not have run on default pipelines (based
8889
# on path changes)
8990
# - else run based on path changes
90-
condition: >-
91-
or(
92-
eq(variables['alwaysRunVar'], true),
93-
eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines']))
91+
${{ if eq(parameters.runOnlyOnChromeVersionUpdate, true) }}:
92+
condition: >-
93+
or(
94+
eq(variables['alwaysRunVar'], true),
95+
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_chrome.containsChange'], true))
96+
${{ else }}:
97+
condition: >-
98+
or(
99+
eq(variables['alwaysRunVar'], true),
100+
eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines']))
94101
# extra steps, run tests
95102
postBuildSteps:
96103
- template: /eng/pipelines/libraries/helix.yml

eng/pipelines/common/xplat-setup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ jobs:
176176
os: linux
177177

178178
# OSX Public Build Pool (we don't have on-prem OSX BuildPool).
179-
${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), eq(variables['System.TeamProject'], 'public')) }}:
179+
${{ if and(or(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), eq(parameters.jobParameters.hostedOs, 'osx')), eq(variables['System.TeamProject'], 'public')) }}:
180180
vmImage: 'macos-15'
181181

182182
# Official build OSX pool
183-
${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), ne(variables['System.TeamProject'], 'public')) }}:
183+
${{ if and(or(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), eq(parameters.jobParameters.hostedOs, 'osx')), ne(variables['System.TeamProject'], 'public')) }}:
184184
name: "Azure Pipelines"
185185
vmImage: 'macos-latest-internal'
186186
os: macOS

eng/pipelines/libraries/helix-queues-setup.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,8 @@ jobs:
188188
- ${{ if or(eq(variables['isRollingBuild'], true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
189189
- (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly@sha256:8e4f47735cd1ace47f522d4c317426c4fe567f88340f93d63940660c3edcef77
190190

191+
# Browser WebAssembly macOS
192+
- ${{ if eq(parameters.platform, 'browser_wasm_mac') }}:
193+
- $(helix_macos_arm64)
194+
191195
${{ insert }}: ${{ parameters.jobParameters }}

eng/pipelines/runtime.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,18 @@ extends:
976976
scenarios:
977977
- WasmTestOnChrome
978978

979+
- template: /eng/pipelines/common/templates/wasm-library-tests.yml
980+
parameters:
981+
platforms:
982+
- browser_wasm_mac
983+
alwaysRun: ${{ variables.isRollingBuild }}
984+
runOnlyOnChromeVersionUpdate: true
985+
shouldRunSmokeOnly: 'true'
986+
nameSuffix: _SmokeMac
987+
extraBuildArgs: /p:AotHostArchitecture=arm64 /p:AotHostOS=$(_hostedOS)
988+
scenarios:
989+
- WasmTestOnChrome
990+
979991
# WebAssembly CoreCLR
980992
- template: /eng/pipelines/common/templates/wasm-coreclr-library-tests.yml
981993
parameters:

eng/testing/WasmRunnerTemplate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ if [[ "$XHARNESS_COMMAND" == "test" ]]; then
4848
fi
4949
else
5050
if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then
51+
if [[ -z "$BROWSER_PATH" && "$(uname -s)" == "Darwin" && -n "$HELIX_CORRELATION_PAYLOAD" ]]; then
52+
BROWSER_PATH="--browser-path=$HELIX_CORRELATION_PAYLOAD/chrome-mac/Chromium.app/Contents/MacOS/Chromium"
53+
fi
5154
if [[ -z "$JS_ENGINE_ARGS" ]]; then
5255
JS_ENGINE_ARGS="--browser-arg=--js-flags=--stack-trace-limit=1000"
5356
fi
@@ -62,7 +65,7 @@ else
6265
fi
6366

6467
if [[ -z "$XHARNESS_ARGS" ]]; then
65-
XHARNESS_ARGS="$JS_ENGINE $JS_ENGINE_ARGS $MAIN_JS"
68+
XHARNESS_ARGS="$JS_ENGINE $JS_ENGINE_ARGS $BROWSER_PATH $MAIN_JS"
6669
fi
6770

6871
if [[ -n "$PREPEND_PATH" ]]; then
@@ -83,6 +86,7 @@ echo XHARNESS_COMMAND=$XHARNESS_COMMAND
8386
echo MAIN_JS=$MAIN_JS
8487
echo JS_ENGINE=$JS_ENGINE
8588
echo JS_ENGINE_ARGS=$JS_ENGINE_ARGS
89+
echo BROWSER_PATH=$BROWSER_PATH
8690
echo XHARNESS_ARGS=$XHARNESS_ARGS
8791

8892
function _buildAOTFunc()

eng/testing/bump-chrome-version.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
</PropertyGroup>
1313

1414
<UpdateChromeVersions
15-
OSIdentifiers="linux;Windows"
16-
OSPrefixes="Linux_x64;Win_x64"
15+
OSIdentifiers="linux;Windows;Mac"
16+
OSPrefixes="Linux_x64;Win_x64;Mac_Arm"
1717
Channel="$(ChromeChannel)"
1818
MaxMajorVersionsToCheck="1"
1919
IntermediateOutputPath="$(ArtifactsObjDir)"

src/tasks/WasmBuildTasks/UpdateChromeVersions.cs

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private async Task<bool> ExecuteInternalAsync()
8787
}
8888
if (VersionsChanged)
8989
{
90-
UpdateEnvVarsForPRFile(versions);
90+
UpdateEnvVarsForPRFile(chromeVersionsXmlDoc, versions);
9191
}
9292
return !Log.HasLoggedErrors;
9393
}
@@ -98,23 +98,30 @@ private async Task<bool> ExecuteInternalAsync()
9898
}
9999
}
100100

101-
private static bool AreVersionsChanged(XmlDocument xmlDoc, ChromeVersionSpec version, string baseUrl)
101+
private bool AreVersionsChanged(XmlDocument xmlDoc, ChromeVersionSpec version, string baseUrl)
102102
{
103-
if (string.Equals(version.os, "Linux", StringComparison.OrdinalIgnoreCase))
103+
string nodePrefix = version.os switch
104104
{
105-
string linuxChromeBaseSnapshotUrl = GetNodeValue(xmlDoc, "linux_ChromeBaseSnapshotUrl");
106-
string linuxV8Version = GetNodeValue(xmlDoc, "linux_V8Version");
107-
return version.v8_version != linuxV8Version ||
108-
baseUrl != linuxChromeBaseSnapshotUrl;
109-
}
110-
else if (string.Equals(version.os, "Windows", StringComparison.OrdinalIgnoreCase))
105+
_ when string.Equals(version.os, "Linux", StringComparison.OrdinalIgnoreCase) => "linux",
106+
_ when string.Equals(version.os, "Windows", StringComparison.OrdinalIgnoreCase) => "win",
107+
_ when string.Equals(version.os, "Mac", StringComparison.OrdinalIgnoreCase) => "macos",
108+
_ => throw new Exception($"UpdateChromeVersions task was used with unknown OS: {version.os}")
109+
};
110+
111+
string existingChromeVersion = GetNodeValue(xmlDoc, $"{nodePrefix}_ChromeVersion");
112+
if (Version.TryParse(existingChromeVersion, out Version? existing) &&
113+
Version.TryParse(version.version, out Version? candidate) &&
114+
candidate < existing)
111115
{
112-
string winChromeBaseSnapshotUrl = GetNodeValue(xmlDoc, "win_ChromeBaseSnapshotUrl");
113-
string winV8Version = GetNodeValue(xmlDoc, "win_V8Version");
114-
return version.v8_version != winV8Version ||
115-
baseUrl != winChromeBaseSnapshotUrl;
116+
Log.LogMessage(MessageImportance.High,
117+
$"Skipping {version.os}: candidate version {version.version} is older than existing {existingChromeVersion}.");
118+
return false;
116119
}
117-
throw new Exception($"UpdateChromeVersions task was used with unknown OS: {version.os}");
120+
121+
string existingChromeBaseSnapshotUrl = GetNodeValue(xmlDoc, $"{nodePrefix}_ChromeBaseSnapshotUrl");
122+
string existingV8Version = GetNodeValue(xmlDoc, $"{nodePrefix}_V8Version");
123+
return version.v8_version != existingV8Version ||
124+
baseUrl != existingChromeBaseSnapshotUrl;
118125
}
119126

120127
private static string GetNodeValue(XmlDocument xmlDoc, string nodeName)
@@ -139,6 +146,13 @@ private bool UpdateChromeVersionsFile(XmlDocument xmlDoc, ChromeVersionSpec vers
139146
UpdateNodeValue(xmlDoc, "win_ChromeBaseSnapshotUrl", baseUrl);
140147
UpdateNodeValue(xmlDoc, "win_V8Version", version.v8_version);
141148
}
149+
else if (string.Equals(version.os, "Mac", StringComparison.OrdinalIgnoreCase))
150+
{
151+
UpdateNodeValue(xmlDoc, "macos_ChromeVersion", version.version);
152+
UpdateNodeValue(xmlDoc, "macos_ChromeRevision", version.branch_base_position);
153+
UpdateNodeValue(xmlDoc, "macos_ChromeBaseSnapshotUrl", baseUrl);
154+
UpdateNodeValue(xmlDoc, "macos_V8Version", version.v8_version);
155+
}
142156
else
143157
{
144158
throw new Exception($"UpdateChromeVersions task was used with unknown OS: {version.os}");
@@ -147,18 +161,22 @@ private bool UpdateChromeVersionsFile(XmlDocument xmlDoc, ChromeVersionSpec vers
147161
return true;
148162
}
149163

150-
private void UpdateEnvVarsForPRFile(List<ChromeVersionSpec> versions)
164+
private void UpdateEnvVarsForPRFile(XmlDocument xmlDoc, List<ChromeVersionSpec> versions)
151165
{
152166
using StreamWriter writer = new StreamWriter(EnvVarsForPRPath);
153167
foreach (var version in versions)
154168
{
155169
if (string.Equals(version.os, "Linux", StringComparison.OrdinalIgnoreCase))
156170
{
157-
writer.WriteLine($"CHROME_LINUX_VER={version.version}");
171+
writer.WriteLine($"CHROME_LINUX_VER={GetNodeValue(xmlDoc, "linux_ChromeVersion")}");
158172
}
159173
else if (string.Equals(version.os, "Windows", StringComparison.OrdinalIgnoreCase))
160174
{
161-
writer.WriteLine($"CHROME_WIN_VER={version.version}");
175+
writer.WriteLine($"CHROME_WIN_VER={GetNodeValue(xmlDoc, "win_ChromeVersion")}");
176+
}
177+
else if (string.Equals(version.os, "Mac", StringComparison.OrdinalIgnoreCase))
178+
{
179+
writer.WriteLine($"CHROME_MAC_VER={GetNodeValue(xmlDoc, "macos_ChromeVersion")}");
162180
}
163181
else
164182
{
@@ -210,7 +228,9 @@ private static void UpdateNodeValue(XmlDocument xmlDoc, string nodeName, string
210228
? "linux_V8Version"
211229
: string.Equals(osIdentifier, "windows", StringComparison.OrdinalIgnoreCase)
212230
? "win_V8Version"
213-
: throw new LogAsErrorException($"Unknown OS identifier '{osIdentifier}' for V8 version fallback");
231+
: string.Equals(osIdentifier, "Mac", StringComparison.OrdinalIgnoreCase)
232+
? "macos_V8Version"
233+
: throw new LogAsErrorException($"Unknown OS identifier '{osIdentifier}' for V8 version fallback");
214234
foundV8Version = GetNodeValue(existingDoc, existingV8VersionNodeName);
215235
if (string.IsNullOrEmpty(foundV8Version))
216236
throw new LogAsErrorException($"V8 binary for {osIdentifier} not available on CDN and no existing version found in {ChromeVersionsPath}");
@@ -265,6 +285,7 @@ private static string GetV8BinaryUrl(string osPrefix, string v8Version)
265285
{
266286
"Linux_x64" => "linux64",
267287
"Win_x64" => "win32",
288+
"Mac_Arm" => "mac-arm64",
268289
_ => throw new ArgumentException($"Unknown OS prefix '{osPrefix}' for V8 binary URL")
269290
};
270291
return $"{s_v8CanaryBaseUrl}/v8-{jsvuPlatform}-rel-{v8Version}.zip";

0 commit comments

Comments
 (0)