Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
devops: switch chromium to build from chromium-beta branch (#13302)
Andrey Lushnikov732afa7cb9ac
diff --git a/.github/workflows/roll_chromium_build.yml b/.github/workflows/roll_chromium_build.ymlindex 3b4436abde..678c011d1d 100644--- a/.github/workflows/roll_chromium_build.yml+++ b/.github/workflows/roll_chromium_build.yml@@ -2,38 +2,34 @@ name: "PR: bump //browser_patches/chromium/BUILD_NUMBER"on:workflow_dispatch:schedule:- # At 10:00am UTC (3AM PST) on Monday and Friday- - cron: "0 10 * * 1,5"+ # At 10:00am UTC (3AM PST) every day to build every new Chromium beta+ - cron: "0 10 * * *"jobs:trigger-chromium-build:name: Trigger Buildruns-on: ubuntu-20.04steps:- uses: actions/checkout@v2- - uses: actions/github-script@v4- id: bump-chromium- with:- script: |- const fs = require('fs');- const response = await github.request('https://omahaproxy.appspot.com/all.json');- const win = response.data.find(({os}) => os === 'win');- const winCanary = win.versions.find(version => version.channel === 'canary');- fs.writeFileSync('browser_patches/chromium/BUILD_NUMBER', `${winCanary.branch_base_position}\n`)- core.setOutput('GIT_COMMIT', winCanary.chromium_commit);- core.setOutput('BASE_POSITION', winCanary.branch_base_position);+ - run: ./browser_patches/chromium/roll_to_current_beta.sh- name: Prepare branchid: prepare-branchrun: |- BASE_POSITION="${{ steps.bump-chromium.outputs.BASE_POSITION }}"- BRANCH_NAME="roll-chromium/${BASE_POSITION}"+ if [[ "$(git status --porcelain)" == "" ]]; then+ echo "there are no changes";+ exit 0;+ fi+ echo "::set-output name=HAS_CHANGES::1"+ CURRENT_DATE=$(date +%Y-%b-%d)+ BRANCH_NAME="roll-chromium/${CURRENT_DATE}"echo "::set-output name=BRANCH_NAME::$BRANCH_NAME"git config --global user.name github-actionsgit config --global user.email 41898282+github-actions[bot]@users.noreply.github.comgit checkout -b "$BRANCH_NAME"git add .- git commit -m "browser(chromium): roll to r${BASE_POSITION}"+ git commit -m "browser(chromium): roll to $CURRENT_DATE"git push origin $BRANCH_NAME- name: Create Pull Request+ if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}uses: actions/github-script@v4with:script: |@@ -42,6 +38,4 @@ jobs:repo: 'playwright',head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',base: 'main',- title: 'browser(chromium): roll to r${{ steps.bump-chromium.outputs.BASE_POSITION }}',- body: 'Upstream commit: https://github.com/chromium/chromium/commit/${{ steps.bump-chromium.outputs.GIT_COMMIT }}',});diff --git a/browser_patches/chromium/BUILD_NUMBER b/browser_patches/chromium/BUILD_NUMBERindex da98495970..83b33d238d 100644--- a/browser_patches/chromium/BUILD_NUMBER+++ b/browser_patches/chromium/BUILD_NUMBER@@ -1 +1 @@-984778+1000diff --git a/browser_patches/chromium/UPSTREAM_CONFIG.sh b/browser_patches/chromium/UPSTREAM_CONFIG.shnew file mode 100644index 0000000000..db88567ab7--- /dev/null+++ b/browser_patches/chromium/UPSTREAM_CONFIG.sh@@ -0,0 +1,3 @@+# CURRENT_VERSION: 101.0.4951.15+# BRANCH_BASE_POSITION: 982481+BRANCH_COMMIT="649f6a7ffd3198e3b83df70fe3f3d02c01ea38f3"diff --git a/browser_patches/chromium/build.sh b/browser_patches/chromium/build.shindex 2e91416db5..077ffaee52 100755--- a/browser_patches/chromium/build.sh+++ b/browser_patches/chromium/build.sh@@ -94,7 +94,7 @@ compile_chromium() {fifi- TARGETS="$@"+ TARGETS="${args[@]}"if [[ $(uname) == "MINGW" ]]; thenif [[ -n "$TARGETS" ]]; thenecho "ERROR: cannot compile custom targets on windows yet."@@ -107,7 +107,6 @@ compile_chromium() {/c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwingoma.bat)"fielse- gn gen out/Defaultif [[ -z "$TARGETS" ]]; thenif [[ $(uname) == "Linux" ]]; thenTARGETS="chrome chrome_sandbox clear_key_cdm"@@ -115,6 +114,11 @@ compile_chromium() {TARGETS="chrome"fifi+ echo+ echo ">> Compiling Targets: $TARGETS"+ echo++ gn gen out/Defaultif [[ -z "$USE_GOMA" ]]; thenautoninja -C out/Default $TARGETSelsediff --git a/browser_patches/chromium/mirror.sh b/browser_patches/chromium/mirror.shdeleted file mode 100755index 3b66b93450..0000000000--- a/browser_patches/chromium/mirror.sh+++ /dev/null@@ -1,68 +0,0 @@-#!/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 [[ -z "${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* || "${CURRENT_HOST_OS}" == MSYS* ]]; 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"diff --git a/browser_patches/chromium/roll_to_current_beta.sh b/browser_patches/chromium/roll_to_current_beta.shnew file mode 100755index 0000000000..7b1c7d6e04--- /dev/null+++ b/browser_patches/chromium/roll_to_current_beta.sh@@ -0,0 +1,32 @@+#!/bin/bash+set -e+set +x++trap "cd $(pwd -P)" EXIT+cd "$(dirname "$0")"+SCRIPT_FOLDER=$(pwd -P)++# 1. get current version+CURRENT_BETA_VERSION=$(curl https://omahaproxy.appspot.com/all | grep "win64,beta" | cut -d ',' -f 3)+VERSION_INFO_JSON=$(curl "https://omahaproxy.appspot.com/deps.json?version=$CURRENT_BETA_VERSION")++NODE_SCRIPT=$(cat <<EOF+const json = JSON.parse(fs.readFileSync(0));+console.log([+ '# CURRENT_VERSION: ' + json.chromium_version,+ '# BRANCH_BASE_POSITION: ' + json.chromium_base_position,+ 'BRANCH_COMMIT="' + json.chromium_commit + '"',+].join('\n'));+EOF+)+NEW_CONFIG=$(echo "${VERSION_INFO_JSON}" | node -e "${NODE_SCRIPT}")+CURRENT_CONFIG=$(cat "${SCRIPT_FOLDER}/UPSTREAM_CONFIG.sh")++if [[ "${CURRENT_CONFIG}" == "${NEW_CONFIG}" ]]; then+ echo "No changes!"+ exit 0+fi++echo "${NEW_CONFIG}" > "${SCRIPT_FOLDER}/UPSTREAM_CONFIG.sh"+BUILD_NUMBER=$(cat "${SCRIPT_FOLDER}/BUILD_NUMBER")+echo $(( $BUILD_NUMBER + 1 )) > "${SCRIPT_FOLDER}/BUILD_NUMBER"diff --git a/browser_patches/prepare_checkout.sh b/browser_patches/prepare_checkout.shindex 998daaca6e..700e427327 100755--- a/browser_patches/prepare_checkout.sh+++ b/browser_patches/prepare_checkout.sh@@ -36,12 +36,6 @@ function prepare_chromium_checkout {CR_CHECKOUT_PATH="$HOME/chromium"fi- # Get chromium SHA from the build revision.- # This will get us the last redirect URL from the crrev.com service.- CRREV=$(head -1 ./chromium/BUILD_NUMBER)- REVISION_URL=$(curl -ILs -o /dev/null -w %{url_effective} "https://crrev.com/${CRREV}")- CRSHA="${REVISION_URL##*/}"-# Update Chromium checkout.## This is based on https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md#get-the-code@@ -61,11 +55,12 @@ function prepare_chromium_checkout {exit 1fi+ source "${SCRIPT_PATH}/chromium/UPSTREAM_CONFIG.sh"cd "${CR_CHECKOUT_PATH}/src"- git checkout main- git pull origin main- git checkout "${CRSHA}"- gclient sync -D+ gclient sync --with_branch_heads+ git fetch origin+ git checkout "${BRANCH_COMMIT}"+ gclient sync -D --with_branch_heads}# FRIENDLY_CHECKOUT_PATH is used only for logging.