devops: switch chromium to build from chromium-beta branch (#13302)
This patch: - switches `//browser_patches/chromium` to checkout and build chromium-beta branch - introduces `//browser_patches/chromium/roll_to_current_beta.sh` script that pulls build configuration for beta from omaha proxy - switches Github Action to pull daily to the latest beta Drive-by: fix bug in argument parsing for Chromium building
This commit is contained in:
Родитель
3e65ef35cf
Коммит
732afa7cb9
|
@ -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 Build
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- 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 branch
|
||||
id: prepare-branch
|
||||
run: |
|
||||
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-actions
|
||||
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||
git 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@v4
|
||||
with:
|
||||
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 }}',
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
984778
|
||||
1000
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# CURRENT_VERSION: 101.0.4951.15
|
||||
# BRANCH_BASE_POSITION: 982481
|
||||
BRANCH_COMMIT="649f6a7ffd3198e3b83df70fe3f3d02c01ea38f3"
|
|
@ -94,7 +94,7 @@ compile_chromium() {
|
|||
fi
|
||||
fi
|
||||
|
||||
TARGETS="$@"
|
||||
TARGETS="${args[@]}"
|
||||
if [[ $(uname) == "MINGW" ]]; then
|
||||
if [[ -n "$TARGETS" ]]; then
|
||||
echo "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)"
|
||||
fi
|
||||
else
|
||||
gn gen out/Default
|
||||
if [[ -z "$TARGETS" ]]; then
|
||||
if [[ $(uname) == "Linux" ]]; then
|
||||
TARGETS="chrome chrome_sandbox clear_key_cdm"
|
||||
|
@ -115,6 +114,11 @@ compile_chromium() {
|
|||
TARGETS="chrome"
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
echo ">> Compiling Targets: $TARGETS"
|
||||
echo
|
||||
|
||||
gn gen out/Default
|
||||
if [[ -z "$USE_GOMA" ]]; then
|
||||
autoninja -C out/Default $TARGETS
|
||||
else
|
||||
|
|
|
@ -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"
|
|
@ -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"
|
|
@ -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 1
|
||||
fi
|
||||
|
||||
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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче