Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: split out Chromium mirroring to a separate script (#10399)

Andrey Lushnikov51f714f235fe
diff --git a/browser_patches/checkout_build_archive_upload.sh b/browser_patches/checkout_build_archive_upload.sh
index bbf6263cab..233e20d184 100755
--- a/browser_patches/checkout_build_archive_upload.sh
+++ b/browser_patches/checkout_build_archive_upload.sh
@@ -165,33 +165,6 @@ elif [[ "$BUILD_FLAVOR" == "chromium-with-symbols-linux-arm64" ]]; then
BUILD_BLOB_NAME="chromium-with-symbols-linux-arm64.zip"
BUILDS_LIST="EXPECTED_BUILDS_WITH_SYMBOLS"
-
-# ===========================
-# CHROMIUM MIRRORING
-# ===========================
-elif [[ "$BUILD_FLAVOR" == "chromium-linux-mirror-to-cdn" ]]; then
- BROWSER_NAME="chromium"
- EXTRA_BUILD_ARGS="--mirror-linux"
- EXTRA_ARCHIVE_ARGS="--mirror-linux"
- EXPECTED_HOST_OS="Ubuntu"
- EXPECTED_HOST_OS_VERSION="18.04"
- BUILD_BLOB_NAME="chromium-linux.zip"
-elif [[ "$BUILD_FLAVOR" == "chromium-mac-mirror-to-cdn" ]]; then
- BROWSER_NAME="chromium"
- EXTRA_BUILD_ARGS="--mirror-mac"
- EXTRA_ARCHIVE_ARGS="--mirror-mac"
- EXPECTED_HOST_OS="Ubuntu"
- EXPECTED_HOST_OS_VERSION="18.04"
- BUILD_BLOB_NAME="chromium-mac.zip"
-elif [[ "$BUILD_FLAVOR" == "chromium-win64-mirror-to-cdn" ]]; then
- BROWSER_NAME="chromium"
- EXTRA_BUILD_ARGS="--mirror-win64"
- EXTRA_ARCHIVE_ARGS="--mirror-win64"
- EXPECTED_HOST_OS="Ubuntu"
- EXPECTED_HOST_OS_VERSION="18.04"
- BUILD_BLOB_NAME="chromium-win64.zip"
-
-
# ===========================
# FIREFOX COMPILATION
# ===========================
diff --git a/browser_patches/chromium/build.sh b/browser_patches/chromium/build.sh
index d7e41b5e71..f8306e5810 100755
--- a/browser_patches/chromium/build.sh
+++ b/browser_patches/chromium/build.sh
@@ -6,9 +6,9 @@ trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")"
USAGE=$(cat<<EOF
- usage: $(basename "$0") [--mirror|--mirror-linux|--mirror-win64|--mirror-mac|--compile-mac-arm64|--compile-linux|--compile-linux-arm64|--compile-win64|--compile-mac] [--symbols] [--full]
+ usage: $(basename "$0") [--compile-mac-arm64|--compile-linux|--compile-linux-arm64|--compile-win64|--compile-mac] [--symbols] [--full]
- Either compiles chromium or mirrors it from Chromium Continuous Builds CDN.
+ Compiles chromium.
EOF
)
@@ -19,8 +19,6 @@ main() {
if [[ $1 == "--help" || $1 == "-h" ]]; then
echo "$USAGE"
exit 0
- elif [[ $1 == "--mirror"* ]]; then
- mirror_chromium "$1"
elif [[ $1 == "--compile"* ]]; then
compile_chromium "$1" "$2" "$3"
else
@@ -115,45 +113,4 @@ compile_chromium() {
fi
}
-mirror_chromium() {
- cd "$SCRIPT_FOLDER"
- rm -rf output
- mkdir -p output
- cd output
-
- CHROMIUM_URL=""
-
- PLATFORM="$1"
- if [[ "${PLATFORM}" == "--mirror" ]]; then
- CURRENT_HOST_OS="$(uname)"
- if [[ "${CURRENT_HOST_OS}" == "Darwin" ]]; then
- PLATFORM="--mirror-mac"
- elif [[ "${CURRENT_HOST_OS}" == "Linux" ]]; then
- PLATFORM="--mirror-linux"
- elif [[ "${CURRENT_HOST_OS}" == MINGW* ]]; then
- PLATFORM="--mirror-win64"
- else
- echo "ERROR: unsupported host platform - ${CURRENT_HOST_OS}"
- exit 1
- fi
- fi
-
- CRREV=$(head -1 "${SCRIPT_FOLDER}/BUILD_NUMBER")
- if [[ "${PLATFORM}" == "--mirror-win64" ]]; then
- CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${CRREV}/chrome-win.zip"
- elif [[ "${PLATFORM}" == "--mirror-mac" ]]; then
- CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Mac/${CRREV}/chrome-mac.zip"
- elif [[ "${PLATFORM}" == "--mirror-linux" ]]; then
- CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CRREV}/chrome-linux.zip"
- else
- echo "ERROR: unknown platform to build: $1"
- exit 1
- fi
-
- echo "--> Pulling Chromium ${CRREV} for ${PLATFORM#--}"
-
- curl --output chromium-upstream.zip "${CHROMIUM_URL}"
- unzip chromium-upstream.zip
-}
-
main "$1" "$2" "$3"
diff --git a/browser_patches/chromium/mirror.sh b/browser_patches/chromium/mirror.sh
new file mode 100755
index 0000000000..467db2d66b
--- /dev/null
+++ b/browser_patches/chromium/mirror.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+set -e
+set +x
+
+trap "cd $(pwd -P)" EXIT
+cd "$(dirname "$0")"
+
+USAGE=$(cat<<EOF
+ usage: $(basename "$0") [--linux|--win64|--mac]
+
+ Mirrors Chromium from Chromium Continuous Builds CDN.
+EOF
+)
+
+SCRIPT_FOLDER=$(pwd -P)
+source "${SCRIPT_FOLDER}/../utils.sh"
+
+main() {
+ if [[ $1 == "--help" || $1 == "-h" ]]; then
+ echo "$USAGE"
+ exit 0
+ else
+ mirror_chromium "$1"
+ fi
+}
+
+mirror_chromium() {
+ cd "$SCRIPT_FOLDER"
+ rm -rf output
+ mkdir -p output
+ cd output
+
+ CHROMIUM_URL=""
+
+ PLATFORM="$1"
+ if [[ -n "${PLATFORM}" ]]; then
+ CURRENT_HOST_OS="$(uname)"
+ if [[ "${CURRENT_HOST_OS}" == "Darwin" ]]; then
+ PLATFORM="--mac"
+ elif [[ "${CURRENT_HOST_OS}" == "Linux" ]]; then
+ PLATFORM="--linux"
+ elif [[ "${CURRENT_HOST_OS}" == MINGW* ]]; then
+ PLATFORM="--win64"
+ else
+ echo "ERROR: unsupported host platform - ${CURRENT_HOST_OS}"
+ exit 1
+ fi
+ fi
+
+ CRREV=$(head -1 "${SCRIPT_FOLDER}/BUILD_NUMBER")
+ if [[ "${PLATFORM}" == "--win64" ]]; then
+ CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${CRREV}/chrome-win.zip"
+ elif [[ "${PLATFORM}" == "--mac" ]]; then
+ CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Mac/${CRREV}/chrome-mac.zip"
+ elif [[ "${PLATFORM}" == "--linux" ]]; then
+ CHROMIUM_URL="https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CRREV}/chrome-linux.zip"
+ else
+ echo "ERROR: unknown platform to build: $1"
+ exit 1
+ fi
+
+ echo "--> Pulling Chromium ${CRREV} for ${PLATFORM#--}"
+
+ curl --output chromium-upstream.zip "${CHROMIUM_URL}"
+ unzip chromium-upstream.zip
+}
+
+main "$1" "$2" "$3"