Skip to content

Commit

Permalink
Merge branch 'main' into fix-erc20-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
hjetpoluru authored Dec 5, 2024
2 parents a0f03c6 + ceeb5b6 commit 3e808a3
Show file tree
Hide file tree
Showing 285 changed files with 13,827 additions and 7,128 deletions.
40 changes: 23 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ executors:
NODE_OPTIONS: --max_old_space_size=3072
node-linux-medium:
machine:
image: ubuntu-2404:current
image: ubuntu-2404:2024.05.1
resource_class: medium #// linux medium: 2 CPUs, 7.5 GB RAM, 10 credits/min
environment:
NODE_OPTIONS: --max_old_space_size=6144
Expand Down Expand Up @@ -45,11 +45,11 @@ rc_branch_only: &rc_branch_only
only:
- /^Version-v(\d+)[.](\d+)[.](\d+)/

develop_master_rc_only: &develop_master_rc_only
main_master_rc_only: &main_master_rc_only
filters:
branches:
only:
- develop
- main
- master
- /^Version-v(\d+)[.](\d+)[.](\d+)/

Expand Down Expand Up @@ -107,7 +107,9 @@ workflows:
- matches:
pattern: /^l10n_crowdin_action$/
value: << pipeline.git.branch >>
- equal: [rerun-from-failed, << pipeline.schedule.name >>]
- matches:
pattern: /^rerun-from-failed.*/
value: << pipeline.schedule.name >>
jobs:
- create_release_pull_request:
<<: *rc_branch_only
Expand All @@ -123,6 +125,8 @@ workflows:
branches:
ignore:
- master
requires:
- prep-deps
- test-deps-audit:
requires:
- prep-deps
Expand Down Expand Up @@ -172,7 +176,7 @@ workflows:
requires:
- prep-deps
- prep-build-test-flask-mv2:
<<: *develop_master_rc_only
<<: *main_master_rc_only
requires:
- prep-deps
- prep-build-test-mmi:
Expand Down Expand Up @@ -200,7 +204,7 @@ workflows:
requires:
- prep-deps
- test-e2e-chrome-webpack:
<<: *develop_master_rc_only
<<: *main_master_rc_only
requires:
- prep-build-test-webpack
- get-changed-files-with-git-diff
Expand All @@ -209,7 +213,7 @@ workflows:
- prep-build-test
- get-changed-files-with-git-diff
- test-e2e-firefox:
<<: *develop_master_rc_only
<<: *main_master_rc_only
requires:
- prep-build-test-mv2
- get-changed-files-with-git-diff
Expand All @@ -229,7 +233,7 @@ workflows:
- prep-build-test-flask
- get-changed-files-with-git-diff
- test-e2e-firefox-flask:
<<: *develop_master_rc_only
<<: *main_master_rc_only
requires:
- prep-build-test-flask-mv2
- test-e2e-chrome-mmi:
Expand All @@ -250,7 +254,7 @@ workflows:
filters:
branches:
only:
- develop
- main
- /^Version-v(\d+)[.](\d+)[.](\d+)/
requires:
- prep-build
Expand Down Expand Up @@ -349,25 +353,27 @@ workflows:
- job-publish-storybook:
filters:
branches:
only: develop
only: main
requires:
- prep-build-storybook
- job-publish-ts-migration-dashboard:
filters:
branches:
only: develop
only: main
requires:
- prep-build-ts-migration-dashboard

rerun-from-failed:
when:
equal: [rerun-from-failed, << pipeline.schedule.name >>]
matches:
pattern: /^rerun-from-failed.*/
value: << pipeline.schedule.name >>
jobs:
- prep-deps
- rerun-workflows-from-failed:
filters:
branches:
only: develop
only: main
requires:
- prep-deps

Expand Down Expand Up @@ -477,7 +483,7 @@ jobs:

# This job is used for the e2e quality gate.
# It must be run before any job which uses the run-all.js script.
# The job is skipped in develop, master or RC branches.
# The job is skipped in main, master or RC branches.
get-changed-files-with-git-diff:
executor: node-browsers-small
steps:
Expand All @@ -487,7 +493,7 @@ jobs:
at: .
- run:
name: Get changed files with git diff
command: npx tsx .circleci/scripts/git-diff-develop.ts
command: yarn git-diff-default-branch
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -1335,7 +1341,7 @@ jobs:
template: basic_fail_1
channel: C01LUJL3T98
- slack/notify:
branch_pattern: develop
branch_pattern: main
event: fail
mentions: <@antonio.regadas>, @ramon.acitores134
template: basic_fail_1
Expand Down Expand Up @@ -1745,7 +1751,7 @@ jobs:
command: echo 'whew - everything passed!'

check-mmi-trigger:
executor: node-browsers-medium
executor: node-browsers-small
steps:
- checkout
- run:
Expand Down
4 changes: 2 additions & 2 deletions .circleci/scripts/bundle-stats-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ then
exit 1
fi

if [[ "${CIRCLE_BRANCH}" != "develop" ]]
if [[ "${CIRCLE_BRANCH}" != "main" ]]
then
printf 'This is not develop branch'
printf 'This is not main branch'
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion .circleci/scripts/check_mmi_trigger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -z "$CIRCLE_PULL_REQUEST" ] || [ -z "$GITHUB_TOKEN" ]; then
exit 0
fi

if [[ $CIRCLE_BRANCH = 'develop' || $CIRCLE_BRANCH = 'master' || $CIRCLE_BRANCH =~ ^Version-v[0-9.]* ]]; then
if [[ $CIRCLE_BRANCH = 'main' || $CIRCLE_BRANCH = 'master' || $CIRCLE_BRANCH =~ ^Version-v[0-9.]* ]]; then
echo "Long-running branch detected, running MMI tests."
echo "run_mmi_tests=true" > mmi_trigger.env
exit 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const PR_NUMBER =
process.env.CIRCLE_PR_NUMBER ||
process.env.CIRCLE_PULL_REQUEST?.split('/').pop();

const MAIN_BRANCH = 'develop';
const GITHUB_DEFAULT_BRANCH = 'main';
const SOURCE_BRANCH = `refs/pull/${PR_NUMBER}/head`;

const CHANGED_FILES_DIR = 'changed-files';
Expand Down Expand Up @@ -48,7 +48,7 @@ async function getPrInfo(): Promise<PRInfo | null> {
*/
async function fetchWithDepth(depth: number): Promise<boolean> {
try {
await exec(`git fetch --depth ${depth} origin "${MAIN_BRANCH}"`);
await exec(`git fetch --depth ${depth} origin "${GITHUB_DEFAULT_BRANCH}"`);
await exec(
`git fetch --depth ${depth} origin "${SOURCE_BRANCH}:${SOURCE_BRANCH}"`,
);
Expand Down Expand Up @@ -84,7 +84,7 @@ async function fetchUntilMergeBaseFound() {
}
}
}
await exec(`git fetch --unshallow origin "${MAIN_BRANCH}"`);
await exec(`git fetch --unshallow origin "${GITHUB_DEFAULT_BRANCH}"`);
}

/**
Expand Down Expand Up @@ -137,7 +137,7 @@ async function storeGitDiffOutputAndPrBody() {
if (!baseRef) {
console.log('Not a PR, skipping git diff');
return;
} else if (baseRef !== MAIN_BRANCH) {
} else if (baseRef !== GITHUB_DEFAULT_BRANCH) {
console.log(`This is for a PR targeting '${baseRef}', skipping git diff`);
writePrBodyToFile(prInfo.body);
return;
Expand Down
13 changes: 7 additions & 6 deletions .circleci/scripts/rerun-ci-workflow-from-failed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const CIRCLE_TOKEN = process.env.API_V2_TOKEN;
const GITHUB_DEFAULT_BRANCH = 'main';

interface Actor {
login: string;
Expand Down Expand Up @@ -59,7 +60,7 @@ interface WorkflowStatusResponse {
* Note: the API returns the first 20 workflows by default.
* If we wanted to get older workflows, we would need to use the 'page-token' we would get in the first response
* and perform a subsequent request with the 'page-token' parameter.
* This seems unnecessary as of today, as the amount of daily PRs merged to develop is not that high.
* This seems unnecessary as of today, as the amount of daily PRs merged to main is not that high.
*
* @returns {Promise<WorkflowItem[]>} A promise that resolves to an array of workflow items.
* @throws Will throw an error if the CircleCI token is not defined or if the HTTP request fails.
Expand Down Expand Up @@ -177,7 +178,7 @@ async function rerunWorkflowById(workflowId: string) {
}

/**
* Re-runs failed CircleCI workflows from develop branch.
* Re-runs failed CircleCI workflows from default branch.
* The workflow will only be re-runed if:
* 1. It has the status of 'failed'
* 2. It has only been run once
Expand All @@ -186,9 +187,9 @@ async function rerunWorkflowById(workflowId: string) {
*
* @throws Will throw an error if fetching the workflows or re-running a workflow fails.
*/
async function rerunFailedWorkflowsFromDevelop() {
console.log('Getting Circle Ci workflows from develop branch...');
const workflows = await getCircleCiWorkflowsByBranch('develop');
async function rerunFailedWorkflowsFromDefaultBranch() {
console.log('Getting Circle Ci workflows from main branch...');
const workflows = await getCircleCiWorkflowsByBranch(GITHUB_DEFAULT_BRANCH);

console.log('Assessing if any of the workflows needs to be rerun...');
for (const item of workflows) {
Expand All @@ -204,7 +205,7 @@ async function rerunFailedWorkflowsFromDevelop() {
console.log('Task completed successfully!');
}

rerunFailedWorkflowsFromDevelop()
rerunFailedWorkflowsFromDefaultBranch()
.catch((error) => {
console.error(error);
process.exitCode = 1;
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/download-builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function getGitBranch() {
const gitOutput = execSync('git status').toString();

const branchRegex = /On branch (?<branch>.*)\n/;
return gitOutput.match(branchRegex)?.groups?.branch || 'develop';
return gitOutput.match(branchRegex)?.groups?.branch || 'main';
}

async function getCircleJobs(branch: string) {
Expand Down
28 changes: 19 additions & 9 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Lines starting with '#' are comments.

# GUIDELINES:
# Each line is a file pattern followed by one or more owners.
# Owners bear a responsibility to the organization and the users of this
# application. Repository administrators have the ability to merge pull
Expand All @@ -7,8 +9,10 @@
# follows all policies or without full understanding of the impact of
# those changes on build, release and publishing outcomes.

* @MetaMask/extension-devs
development/ @MetaMask/extension-devs @kumavis
# LavaMoat policy changes can highlight security risks. Teams are encouraged to
# audit these changes on their own, and leave their analysis in a comment.
# These codeowners will review this analysis, and review the policy changes in
# further detail if warranted.
lavamoat/ @MetaMask/extension-devs @MetaMask/supply-chain

# The offscreen.ts script file that is included in the offscreen document html
Expand All @@ -28,7 +32,7 @@ offscreen/scripts/offscreen.ts @MetaMask/snaps-devs
# empower our CI steps. ANY addition of orbs to our CircleCI config
# should be brought to the attention of engineering leadership for
# discussion
.circleci/ @MetaMask/library-admins @kumavis
.circleci/ @MetaMask/extension-security-team

# The privacy-snapshot.json file includes a list of all hosts that the
# extension communicates with during the E2E test suite runs. It is not a
Expand All @@ -45,11 +49,11 @@ privacy-snapshot.json @MetaMask/extension-privacy-reviewers
# of contributors. Modifications to this file result in a modification of
# that agreement and can only be approved by those with the knowledge
# and responsibility to publish libraries under the MetaMask name.
.github/CODEOWNERS @MetaMask/library-admins @kumavis
.github/CODEOWNERS @MetaMask/extension-security-team

# For now, restricting approvals inside the .devcontainer folder to devs
# who were involved with the Codespaces project.
.devcontainer/ @MetaMask/library-admins @HowardBraham @plasmacorral
.devcontainer/ @MetaMask/extension-security-team @HowardBraham

# Confirmations team to own code for confirmations on UI.
app/scripts/lib/ppom @MetaMask/confirmations
Expand All @@ -69,21 +73,24 @@ ui/selectors/institutional @MetaMask/mmi
# Slack handle: @metamask-design-system-team | Slack channel: #metamask-design-system
ui/components/component-library @MetaMask/design-system-engineers

# The Notifications team is responsible for code related to notifications,
# authentication, and profile syncing inside the Extension.
# The Notifications team is responsible for code related to notifications

# Controllers
**/controllers/authentication/** @MetaMask/notifications
**/controllers/metamask-notifications/** @MetaMask/notifications
**/controllers/push-platform-notifications/** @MetaMask/notifications
**/controllers/user-storage/** @MetaMask/notifications

# UI
**/metamask-notifications/** @MetaMask/notifications
**/multichain/notification*/** @MetaMask/notifications
**/pages/notification*/** @MetaMask/notifications
**/utils/notification.util.ts @MetaMask/notifications

# Identity team is responsible for authentication and profile syncing inside the Extension.
# Slack handle: @identity_team | Slack channel: #metamask-identity
**/identity/** @MetaMask/identity
ui/pages/settings/security-tab/profile-sync-toggle @MetaMask/identity


# Accounts team is responsible for code related with snap management accounts
# Slack handle: @accounts-team-devs | Slack channel: #metamask-accounts-team

Expand All @@ -93,6 +100,9 @@ app/scripts/lib/snap-keyring @MetaMask/accounts-engineers
ui/pages/swaps @MetaMask/swaps-engineers
app/scripts/controllers/swaps @MetaMask/swaps-engineers

# Ramps team to own code for the ramps folder
**/ramps/** @MetaMask/ramp

# Snaps
**/snaps/** @MetaMask/snaps-devs
shared/constants/permissions.ts @MetaMask/snaps-devs
Expand Down
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ If you're picking up a bounty or an existing issue, feel free to ask clarifying
### Submitting a pull request
When you're done with your project / bugfix / feature and ready to submit a PR, there are a couple guidelines we ask you to follow:

- [ ] **Make sure you followed our [`coding guidelines`](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md)**: These guidelines aim to maintain consistency and readability across the codebase. They help ensure that the code is easy to understand, maintain, and modify, which is particularly important when working with multiple contributors.
- [ ] **Make sure you followed our [`coding guidelines`](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md)**: These guidelines aim to maintain consistency and readability across the codebase. They help ensure that the code is easy to understand, maintain, and modify, which is particularly important when working with multiple contributors.
- [ ] **Test it**: For any new programmatic functionality, we like unit tests when possible, so if you can keep your code cleanly isolated, please do add a test file to the `tests` folder.
- [ ] **Meet the spec**: Make sure the PR adds functionality that matches the issue you're closing. This is especially important for bounties: sometimes design or implementation details are included in the conversation, so read carefully!
- [ ] **Close the issue**: If this PR closes an open issue, fill out the "Related issues" section with `Fixes: #$ISSUE_NUMBER`. Ex. For closing issue 418, include the line `Fixes: #418`. If it doesn't close the issue but addresses it partially, just include a reference to the issue number, like `#418`.
- [ ] **Keep it simple**: Try not to include multiple features in a single PR, and don't make extraneous changes outside the scope of your contribution. All those touched files make things harder to review ;)
- [ ] **PR against `develop`**: Submit your PR against the `develop` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging.
- [ ] **PR against `main`**: Submit your PR against the `main` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging.
- [ ] **Get reviewed by MetaMask Internal Developers**: All PRs require 2 approvals from MetaMask Internal Developers before merging.
- [ ] **Ensure the PR is correctly labeled.**: More detail about PR labels can be found [here](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md).
- [ ] **Ensure the PR is correctly labeled.**: More detail about PR labels can be found [here](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md).
- [ ] **PR Titles**: Must adhere to the [Conventional Commits specification](https://www.conventionalcommits.org)
- `<type>[optional scope]: <description>`
- Example: `feat(parser): add ability to parse arrays`
Expand Down
2 changes: 1 addition & 1 deletion .github/guidelines/LABELING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ It's essential to ensure that PRs have the appropriate labels before they are co
- **regression-RC-x.y.z**: This label is manually added to a bug report issue by release engineers when a bug is found during release regerssion testing phase. The `x.y.z` in the label represents the release candidate (RC) version in which the bug's been discovered.

### Optional labels:
- **regression-develop**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on the development branch, i.e., `develop`, but is not yet released in production.
- **regression-main**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on the development branch, i.e., `main`, but is not yet released in production.
- **needs-qa**: If the PR includes a new features, complex testing steps, or large refactors, this label must be added to indicated PR requires a full manual QA prior being merged and added to a release.

### Labels prohibited when PR needs to be merged:
Expand Down
4 changes: 2 additions & 2 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Fixes:

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors.
- [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors.

## **Pre-merge reviewer checklist**

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/check-pr-has-required-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function main(): Promise<void> {
if (!hasTeamLabel) {
errorMessage += 'No team labels found on the PR. ';
}
errorMessage += `Please make sure the PR is appropriately labeled before merging it.\n\nSee labeling guidelines for more detail: https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md`;
errorMessage += `Please make sure the PR is appropriately labeled before merging it.\n\nSee labeling guidelines for more detail: https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md`;
core.setFailed(errorMessage);
process.exit(1);
}
Loading

0 comments on commit 3e808a3

Please sign in to comment.