From 702fa76a15b189485a4dc65e5eb20019db6a9cdb Mon Sep 17 00:00:00 2001 From: Raghu Simha Date: Thu, 8 Apr 2021 12:13:03 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=20Update=20AMP's=20CI=20config=20t?= =?UTF-8?q?o=20work=20on=20the=20`main`=20branch=20(#33698)=20(#33711)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/check_config.sh | 18 +++++++++--------- .circleci/compute_merge_commit.sh | 6 +++--- .circleci/config.yml | 4 ++-- .circleci/fail_fast.sh | 2 +- .circleci/fetch_merge_commit.sh | 8 ++++---- .circleci/get_pr_number.sh | 4 ++-- .../workflows/create-design-review-issue.yml | 2 +- .github/workflows/cross-browser-tests.yml | 4 ++-- .renovaterc.json | 2 +- build-system/common/main-branch.js | 5 ++--- build-system/server/app-index/header-links.js | 2 +- 11 files changed, 28 insertions(+), 29 deletions(-) diff --git a/.circleci/check_config.sh b/.circleci/check_config.sh index ca9780b07ac1e..45441bfccf399 100755 --- a/.circleci/check_config.sh +++ b/.circleci/check_config.sh @@ -25,14 +25,14 @@ RED() { echo -e "\n\033[0;31m$1\033[0m"; } YELLOW() { echo -e "\033[0;33m$1\033[0m"; } CYAN() { echo -e "\033[0;36m$1\033[0m"; } -# Push builds are only run against master and amp-release branches. -if [[ "$CIRCLE_BRANCH" == "master" || "$CIRCLE_BRANCH" =~ ^amp-release-* ]]; then +# Push builds are only run against the main branch and amp-release branches. +if [[ "$CIRCLE_BRANCH" == "main" || "$CIRCLE_BRANCH" =~ ^amp-release-* ]]; then echo $(GREEN "Nothing to do because $CIRCLE_BRANCH is not a PR branch.") exit 0 fi # Check if the PR branch contains the most recent revision the CircleCI config. -CONFIG_REV=`git rev-list master -1 -- .circleci/config.yml` +CONFIG_REV=`git rev-list main -1 -- .circleci/config.yml` (set -x && git merge-base --is-ancestor $CONFIG_REV $CIRCLE_SHA1) || err=$? if [[ "$err" -ne "0" ]]; then @@ -46,23 +46,23 @@ if [[ "$err" -ne "0" ]]; then echo " ⤷ It can be found towards the bottom of the PR, after the list of checks." echo -e "\n" - echo "2. Pull the latest commits from $(CYAN "master") and re-push the PR branch." + echo "2. Pull the latest commits from $(CYAN "main") and re-push the PR branch." echo " ⤷ Follow these steps:" echo "" - echo " $(CYAN "git checkout master")" + echo " $(CYAN "git checkout main")" echo " $(CYAN "git pull")" echo " $(CYAN "git checkout ")" - echo " $(CYAN "git merge master")" + echo " $(CYAN "git merge main")" echo " $(CYAN "git push origin")" echo -e "\n" - echo "3. Rebase on $(CYAN "master") and re-push the PR branch." + echo "3. Rebase on $(CYAN "main") and re-push the PR branch." echo " ⤷ Follow these steps:" echo "" - echo " $(CYAN "git checkout master")" + echo " $(CYAN "git checkout main")" echo " $(CYAN "git pull")" echo " $(CYAN "git checkout ")" - echo " $(CYAN "git rebase master")" + echo " $(CYAN "git rebase main")" echo " $(CYAN "git push origin --force")" echo -e "\n" exit 1 diff --git a/.circleci/compute_merge_commit.sh b/.circleci/compute_merge_commit.sh index 51e2b503bbebd..ee9a49586326b 100755 --- a/.circleci/compute_merge_commit.sh +++ b/.circleci/compute_merge_commit.sh @@ -23,7 +23,7 @@ err=0 GREEN() { echo -e "\n\033[0;32m$1\033[0m"; } # Try to determine the PR number. -curl -sS https://raw.githubusercontent.com/ampproject/amphtml/master/.circleci/get_pr_number.sh | bash +curl -sS https://raw.githubusercontent.com/ampproject/amphtml/main/.circleci/get_pr_number.sh | bash if [[ -f "$BASH_ENV" ]]; then source $BASH_ENV fi @@ -34,8 +34,8 @@ if [[ -z "$PR_NUMBER" ]]; then fi # GitHub provides refs/pull//merge, an up-to-date merge branch for -# every PR branch that can be cleanly merged to master. For more details, see: -# https://discuss.circleci.com/t/show-test-results-for-prospective-merge-of-a-github-pr/1662 +# every PR branch that can be cleanly merged to the main branch. For more +# details, see: https://discuss.circleci.com/t/show-test-results-for-prospective-merge-of-a-github-pr/1662 MERGE_BRANCH="refs/pull/$PR_NUMBER/merge" echo $(GREEN "Computing merge SHA of $MERGE_BRANCH...") CIRCLE_MERGE_SHA="$(git ls-remote https://github.com/ampproject/amphtml.git "$MERGE_BRANCH" | awk '{print $1}')" diff --git a/.circleci/config.yml b/.circleci/config.yml index 8068d0047baed..d6733c8a2b7cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ push_builds_only: &push_builds_only filters: branches: only: - - master + - main - /^amp-release-.*$/ executors: @@ -100,7 +100,7 @@ jobs: steps: - run: name: 'Compute Merge Commit' - command: curl -sS https://raw.githubusercontent.com/ampproject/amphtml/master/.circleci/compute_merge_commit.sh | bash + command: curl -sS https://raw.githubusercontent.com/ampproject/amphtml/main/.circleci/compute_merge_commit.sh | bash - save_merge_commit 'Checks': executor: diff --git a/.circleci/fail_fast.sh b/.circleci/fail_fast.sh index 0cf0f1327e5eb..318505aa9c2a5 100755 --- a/.circleci/fail_fast.sh +++ b/.circleci/fail_fast.sh @@ -25,7 +25,7 @@ YELLOW() { echo -e "\n\033[0;33m$1\033[0m"; } # For push builds, continue in spite of failures so that other jobs like # bundle-size and visual-diff can establish their baselines for this commit. # Without this, our custom bots will not be able to function correctly. -if [[ "$CIRCLE_BRANCH" == "master" || "$CIRCLE_BRANCH" =~ ^amp-release-* ]]; then +if [[ "$CIRCLE_BRANCH" == "main" || "$CIRCLE_BRANCH" =~ ^amp-release-* ]]; then echo $(YELLOW "Not canceling build in spite of failures because $CIRCLE_BRANCH is not a PR branch.") exit 0 fi diff --git a/.circleci/fetch_merge_commit.sh b/.circleci/fetch_merge_commit.sh index f51b1ee122bc0..e6edf2e97ef5a 100755 --- a/.circleci/fetch_merge_commit.sh +++ b/.circleci/fetch_merge_commit.sh @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the license. -# This script fetches the merge commit of a PR branch with master to make sure -# PRs are tested against all the latest changes on CircleCI. +# This script fetches the merge commit of a PR branch with the main branch to +# make sure PRs are tested against all the latest changes on CircleCI. set -e err=0 @@ -51,9 +51,9 @@ echo $(GREEN "Fetching merge commit $CIRCLECI_MERGE_COMMIT...") # If a clean merge is not possible, do not proceed with the build. GitHub's UI # will show an error indicating there was a merge conflict. if [[ "$err" -ne "0" ]]; then - echo $(RED "Detected a merge conflict between $CIRCLE_BRANCH and master.") + echo $(RED "Detected a merge conflict between $CIRCLE_BRANCH and the main branch.") echo $(RED "Please rebase your PR branch.") exit $err fi -echo $(GREEN "Successfully fetched merge commit of $CIRCLE_BRANCH with master.") +echo $(GREEN "Successfully fetched merge commit of $CIRCLE_BRANCH with the main branch.") diff --git a/.circleci/get_pr_number.sh b/.circleci/get_pr_number.sh index 61ab493125e68..31cd5ec8de408 100755 --- a/.circleci/get_pr_number.sh +++ b/.circleci/get_pr_number.sh @@ -23,8 +23,8 @@ err=0 GREEN() { echo -e "\n\033[0;32m$1\033[0m"; } YELLOW() { echo -e "\n\033[0;33m$1\033[0m"; } -# Push builds are only run against master and amp-release branches. -if [[ "$CIRCLE_BRANCH" == "master" || "$CIRCLE_BRANCH" =~ ^amp-release-* ]]; then +# Push builds are only run against the main branch and amp-release branches. +if [[ "$CIRCLE_BRANCH" == "main" || "$CIRCLE_BRANCH" =~ ^amp-release-* ]]; then echo $(GREEN "Nothing to do because $CIRCLE_BRANCH is not a PR branch.") # Warn if the build is linked to a PR on a different repo (known CircleCI bug). if [[ -n "$CIRCLE_PULL_REQUEST" && ! "$CIRCLE_PULL_REQUEST" =~ ^https://github.com/ampproject/amphtml* ]]; then diff --git a/.github/workflows/create-design-review-issue.yml b/.github/workflows/create-design-review-issue.yml index 0b34a2bb39edd..a502cf3da689b 100644 --- a/.github/workflows/create-design-review-issue.yml +++ b/.github/workflows/create-design-review-issue.yml @@ -12,6 +12,6 @@ jobs: steps: - name: Create Design Review Issue run: | - wget -q -O - "https://raw.githubusercontent.com/$GITHUB_REPOSITORY/master/.github/workflows/create-design-review-issue.js" | node + wget -q -O - "https://raw.githubusercontent.com/ampproject/amphtml/main/.github/workflows/create-design-review-issue.js" | node env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cross-browser-tests.yml b/.github/workflows/cross-browser-tests.yml index c9eb1b0fc5b02..18d6a66bd4d50 100644 --- a/.github/workflows/cross-browser-tests.yml +++ b/.github/workflows/cross-browser-tests.yml @@ -2,10 +2,10 @@ name: GitHub Actions on: push: branches: - - master + - main pull_request: branches: - - master + - main jobs: build: diff --git a/.renovaterc.json b/.renovaterc.json index 08d41564452e2..abe4d92112808 100644 --- a/.renovaterc.json +++ b/.renovaterc.json @@ -16,7 +16,7 @@ "
", "How to resolve breaking changes", "This PR may introduce breaking changes that require manual intervention. In such cases, you will need to check out this branch, fix the cause of the breakage, and commit the fix to ensure a green CI build. To check out and update this PR, follow the steps below:", - "```sh\n# Check out the PR branch (these steps are from GitHub)\ngit checkout -b renovate-bot-{{{branchName}}} master\ngit pull https://github.com/renovate-bot/amphtml.git {{{branchName}}}\n\n# Directly make fixes and commit them\namp lint --fix # For lint errors in JS files\namp prettify --fix # For prettier errors in non-JS files\n# Edit source code in case of new compiler warnings / errors\n\n# Push the changes to the branch\ngit push git@github.com:renovate-bot/amphtml.git renovate-bot-{{{branchName}}}:{{{branchName}}}\n```", + "```sh\n# Check out the PR branch (these steps are from GitHub)\ngit checkout -b renovate-bot-{{{branchName}}} main\ngit pull https://github.com/renovate-bot/amphtml.git {{{branchName}}}\n\n# Directly make fixes and commit them\namp lint --fix # For lint errors in JS files\namp prettify --fix # For prettier errors in non-JS files\n# Edit source code in case of new compiler warnings / errors\n\n# Push the changes to the branch\ngit push git@github.com:renovate-bot/amphtml.git renovate-bot-{{{branchName}}}:{{{branchName}}}\n```", "
" ], diff --git a/build-system/common/main-branch.js b/build-system/common/main-branch.js index 1676d7f81c7d4..4995ef2bbd97a 100644 --- a/build-system/common/main-branch.js +++ b/build-system/common/main-branch.js @@ -15,10 +15,9 @@ */ /** - * TODO(rsimha, #32195): Change this to main when branch is renamed, and delete - * this file once the dust settles. + * TODO(rsimha, #32195): Delete this file once the dust settles. */ -const mainBranch = 'master'; +const mainBranch = 'main'; module.exports = { mainBranch, diff --git a/build-system/server/app-index/header-links.js b/build-system/server/app-index/header-links.js index a363ea0a77bfe..90164600601f9 100644 --- a/build-system/server/app-index/header-links.js +++ b/build-system/server/app-index/header-links.js @@ -37,7 +37,7 @@ module.exports = [ { 'name': 'CircleCI', 'href': - 'https://app.circleci.com/pipelines/github/ampproject/amphtml?branch=master', + 'https://app.circleci.com/pipelines/github/ampproject/amphtml?branch=main', }, { 'name': 'Percy',