diff --git a/.github/workflows/roll_chromium_build.yml b/.github/workflows/roll_chromium_build.yml index 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 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 }}', }); diff --git a/browser_patches/chromium/BUILD_NUMBER b/browser_patches/chromium/BUILD_NUMBER index da98495970..83b33d238d 100644 --- a/browser_patches/chromium/BUILD_NUMBER +++ b/browser_patches/chromium/BUILD_NUMBER @@ -1 +1 @@ -984778 +1000 diff --git a/browser_patches/chromium/UPSTREAM_CONFIG.sh b/browser_patches/chromium/UPSTREAM_CONFIG.sh new file mode 100644 index 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.sh index 2e91416db5..077ffaee52 100755 --- a/browser_patches/chromium/build.sh +++ b/browser_patches/chromium/build.sh @@ -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 diff --git a/browser_patches/chromium/mirror.sh b/browser_patches/chromium/mirror.sh deleted file mode 100755 index 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< 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.sh new file mode 100755 index 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 < "${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.sh index 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 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.