From 7c780b90cc22b09f76fbb425fccc0c0bf529ef0e Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 14 Jan 2021 18:06:21 +0300 Subject: [PATCH 1/2] devops: support frequent minor releases of MacOS BigSur. Pre-BigSur, MacOS updates were labeled as "minor" releases, so we had to bake separate builds for different 10.X releases. In BigSur era, it doesn't seem to be the case, so for now we can re-use our BigSur builds across all BigSur versions (11.0, 11.1 and 11.2). If we ever need to have a custom build for some bigsur minor version, e.g. `11.6`, we'll have a new browser platform along with generic `mac11` platform. Fixes #4775. --- src/install/browserFetcher.ts | 27 +++++++++------------------ src/utils/browserPaths.ts | 30 ++++++++++++++---------------- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/src/install/browserFetcher.ts b/src/install/browserFetcher.ts index 7ebc21a71452c..2c1840077f474 100644 --- a/src/install/browserFetcher.ts +++ b/src/install/browserFetcher.ts @@ -67,8 +67,7 @@ function getDownloadUrl(browserName: BrowserName, revision: number, platform: Br ['mac10.13', '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip'], ['mac10.14', '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip'], ['mac10.15', '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip'], - ['mac11.0', '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip'], - ['mac11.1', '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip'], + ['mac11', '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip'], ['win32', '%s/chromium-browser-snapshots/Win/%d/chrome-win.zip'], ['win64', '%s/chromium-browser-snapshots/Win_x64/%d/chrome-win.zip'], ]).get(platform) : @@ -78,10 +77,8 @@ function getDownloadUrl(browserName: BrowserName, revision: number, platform: Br ['mac10.13', '%s/builds/chromium/%s/chromium-mac.zip'], ['mac10.14', '%s/builds/chromium/%s/chromium-mac.zip'], ['mac10.15', '%s/builds/chromium/%s/chromium-mac.zip'], - ['mac11.0', '%s/builds/chromium/%s/chromium-mac.zip'], - ['mac11.0-arm64', '%s/builds/chromium/%s/chromium-mac-arm64.zip'], - ['mac11.1', '%s/builds/chromium/%s/chromium-mac.zip'], - ['mac11.1-arm64', '%s/builds/chromium/%s/chromium-mac-arm64.zip'], + ['mac11', '%s/builds/chromium/%s/chromium-mac.zip'], + ['mac11-arm64', '%s/builds/chromium/%s/chromium-mac-arm64.zip'], ['win32', '%s/builds/chromium/%s/chromium-win32.zip'], ['win64', '%s/builds/chromium/%s/chromium-win64.zip'], ]).get(platform); @@ -96,8 +93,7 @@ function getDownloadUrl(browserName: BrowserName, revision: number, platform: Br ['mac10.13', '%s/builds/firefox/%s/firefox-mac.zip'], ['mac10.14', '%s/builds/firefox/%s/firefox-mac.zip'], ['mac10.15', '%s/builds/firefox/%s/firefox-mac.zip'], - ['mac11.0', '%s/builds/firefox/%s/firefox-mac.zip'], - ['mac11.1', '%s/builds/firefox/%s/firefox-mac.zip'], + ['mac11', '%s/builds/firefox/%s/firefox-mac.zip'], ['win32', '%s/builds/firefox/%s/firefox-win32.zip'], ['win64', '%s/builds/firefox/%s/firefox-win64.zip'], ]).get(platform) : @@ -107,10 +103,8 @@ function getDownloadUrl(browserName: BrowserName, revision: number, platform: Br ['mac10.13', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], ['mac10.14', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], ['mac10.15', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], - ['mac11.0', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], - ['mac11.0-arm64', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], - ['mac11.1', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], - ['mac11.1-arm64', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], + ['mac11', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], + ['mac11-arm64', '%s/builds/firefox/%s/firefox-mac-10.14.zip'], ['win32', '%s/builds/firefox/%s/firefox-win32.zip'], ['win64', '%s/builds/firefox/%s/firefox-win64.zip'], ]).get(platform); @@ -125,8 +119,7 @@ function getDownloadUrl(browserName: BrowserName, revision: number, platform: Br ['mac10.13', undefined], ['mac10.14', '%s/builds/webkit/%s/minibrowser-mac-10.14.zip'], ['mac10.15', '%s/builds/webkit/%s/minibrowser-mac-10.15.zip'], - ['mac11.0', '%s/builds/webkit/%s/minibrowser-mac-10.15.zip'], - ['mac11.1', '%s/builds/webkit/%s/minibrowser-mac-10.15.zip'], + ['mac11', '%s/builds/webkit/%s/minibrowser-mac-10.15.zip'], ['win32', '%s/builds/webkit/%s/minibrowser-win64.zip'], ['win64', '%s/builds/webkit/%s/minibrowser-win64.zip'], ]).get(platform) : @@ -136,10 +129,8 @@ function getDownloadUrl(browserName: BrowserName, revision: number, platform: Br ['mac10.13', undefined], ['mac10.14', '%s/builds/webkit/%s/webkit-mac-10.14.zip'], ['mac10.15', '%s/builds/webkit/%s/webkit-mac-10.15.zip'], - ['mac11.0', '%s/builds/webkit/%s/webkit-mac-10.15.zip'], - ['mac11.0-arm64', '%s/builds/webkit/%s/webkit-mac-11.0-arm64.zip'], - ['mac11.1', '%s/builds/webkit/%s/webkit-mac-10.15.zip'], - ['mac11.1-arm64', '%s/builds/webkit/%s/webkit-mac-11.0-arm64.zip'], + ['mac11', '%s/builds/webkit/%s/webkit-mac-10.15.zip'], + ['mac11-arm64', '%s/builds/webkit/%s/webkit-mac-11.0-arm64.zip'], ['win32', '%s/builds/webkit/%s/webkit-win64.zip'], ['win64', '%s/builds/webkit/%s/webkit-win64.zip'], ]).get(platform); diff --git a/src/utils/browserPaths.ts b/src/utils/browserPaths.ts index 2ccc0e9128eb2..0c26ac2b023c6 100644 --- a/src/utils/browserPaths.ts +++ b/src/utils/browserPaths.ts @@ -22,7 +22,7 @@ import { getUbuntuVersionSync } from './ubuntuVersion'; import { getFromENV } from './utils'; export type BrowserName = 'chromium'|'webkit'|'firefox'; -export type BrowserPlatform = 'win32'|'win64'|'mac10.13'|'mac10.14'|'mac10.15'|'mac11.0'|'mac11.0-arm64'|'mac11.1'|'mac11.1-arm64'|'ubuntu18.04'|'ubuntu20.04'; +export type BrowserPlatform = 'win32'|'win64'|'mac10.13'|'mac10.14'|'mac10.15'|'mac11'|'mac11-arm64'|'ubuntu18.04'|'ubuntu20.04'; export type BrowserDescriptor = { name: BrowserName, revision: string, @@ -32,15 +32,19 @@ export type BrowserDescriptor = { export const hostPlatform = ((): BrowserPlatform => { const platform = os.platform(); if (platform === 'darwin') { - const macVersion = execSync('sw_vers -productVersion', { + let [major, minor] = execSync('sw_vers -productVersion', { stdio: ['ignore', 'pipe', 'ignore'] - }).toString('utf8').trim().split('.').slice(0, 2).join('.'); + }).toString('utf8').trim().split('.').map(x => parseInt(x, 10)); let arm64 = false; - if (!macVersion.startsWith('10.')) { + // BigSur is the first version that might run on Apple Silicon. + if (major >= 11) { arm64 = execSync('sysctl -in hw.optional.arm64', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim() === '1'; } + // We do not want to differentiate between minor big sur releases + // since they don't change core APIs so far. + const macVersion = major === 10 ? `${major}.${minor}` : `${major}`; const archSuffix = arm64 ? '-arm64' : ''; return `mac${macVersion}${archSuffix}` as BrowserPlatform; } @@ -92,10 +96,8 @@ export function executablePath(browserPath: string, browser: BrowserDescriptor): ['mac10.13', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], ['mac10.14', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], ['mac10.15', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], - ['mac11.0', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], - ['mac11.0-arm64', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], - ['mac11.1', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], - ['mac11.1-arm64', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], + ['mac11', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], + ['mac11-arm64', ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium']], ['win32', ['chrome-win', 'chrome.exe']], ['win64', ['chrome-win', 'chrome.exe']], ]).get(hostPlatform); @@ -108,10 +110,8 @@ export function executablePath(browserPath: string, browser: BrowserDescriptor): ['mac10.13', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], ['mac10.14', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], ['mac10.15', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], - ['mac11.0', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], - ['mac11.0-arm64', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], - ['mac11.1', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], - ['mac11.1-arm64', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], + ['mac11', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], + ['mac11-arm64', ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox']], ['win32', ['firefox', 'firefox.exe']], ['win64', ['firefox', 'firefox.exe']], ]).get(hostPlatform); @@ -124,10 +124,8 @@ export function executablePath(browserPath: string, browser: BrowserDescriptor): ['mac10.13', undefined], ['mac10.14', ['pw_run.sh']], ['mac10.15', ['pw_run.sh']], - ['mac11.0', ['pw_run.sh']], - ['mac11.0-arm64', ['pw_run.sh']], - ['mac11.1', ['pw_run.sh']], - ['mac11.1-arm64', ['pw_run.sh']], + ['mac11', ['pw_run.sh']], + ['mac11-arm64', ['pw_run.sh']], ['win32', ['Playwright.exe']], ['win64', ['Playwright.exe']], ]).get(hostPlatform); From 531460049b909e3b5355777ebdcac19aee6f829e Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 14 Jan 2021 18:11:22 +0300 Subject: [PATCH 2/2] fix nit --- src/utils/browserPaths.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/browserPaths.ts b/src/utils/browserPaths.ts index 0c26ac2b023c6..8cdd088e23d9e 100644 --- a/src/utils/browserPaths.ts +++ b/src/utils/browserPaths.ts @@ -32,7 +32,7 @@ export type BrowserDescriptor = { export const hostPlatform = ((): BrowserPlatform => { const platform = os.platform(); if (platform === 'darwin') { - let [major, minor] = execSync('sw_vers -productVersion', { + const [major, minor] = execSync('sw_vers -productVersion', { stdio: ['ignore', 'pipe', 'ignore'] }).toString('utf8').trim().split('.').map(x => parseInt(x, 10)); let arm64 = false;